aki77の日記

2010-12-30

[][] CentOS5 に SMALL LIGHT をインストール

$ sudo yum -y install ImageMagick ImageMagick-devel
$ sudo yum -y --enablerepo=rpmforge install imlib2 imlib2-devel

$ cd /usr/local/src
$ wget http://smalllight.googlecode.com/files/mod_small_light-1.0.0.tar.gz
$ tar xvzf mod_small_light-1.0.0.tar.gz
$ cd mod_small_light-1.0.0

そのままだと Symbol not found エラーが発生したので Makefile.in を修正


$ ./configure --with-apxs=/usr/sbin/apxs
$ make && sudo make install


追記

  • 2010/01/06 : Gist 貼り付けの際にタブがスペースに置き換わっていたミス修正

2010-12-06

[][]symfony 1.4 + Propel の DBレプリケーションで任意のタイミングでマスタ接続に切り替える


データ更新後はマスタに接続する

app.yml

all:
  propel:
    force_master_flashes: [notice]

frontendConfiguration.class.php

<?php
    public function configure()
    {
        $this->dispatcher->connect('context.load_factories', array($this, 'loadFactoriesEvent'));
    }

    public function loadFactoriesEvent(sfEvent $event)
    {
        $user = $event->getSubject()->getUser();

        foreach (sfConfig::get('app_propel_force_master_flashes') as $name) {
            if ($user->hasFlash($name)) {
                Propel::setForceMasterConnection(true);
                break;
            }
        }
    }

特定のアクションでは常にマスタに接続する

app.yml

all:
  propel:
    force_master_actions:
      - [module, action]

frontendConfiguration.class.php

<?php
    public function configure()
    {
        $this->dispatcher->connect('controller.change_action', array($this, 'changeActionEvent'));
    }

    public function changeActionEvent(sfEvent $event)
    {
        $mod_act = array($event['module'], $event['action']);

        if (in_array($mod_act, sfConfig::get('app_propel_force_master_actions'))) {
            Propel::setForceMasterConnection(true);
        }
    }

symfony 1.3 + Propel 1.4 で MySQLレプリケーション - aki77の日記