/** * 初始化共享内存和信号量 * * @throws ZtChart_Model_Monitor_Exception */ public function __construct($config) { if (!extension_loaded('pcntl')) { throw new ZtChart_Model_Monitor_Daemon_Exception('Pcntl extension is not loaded !'); } if (!extension_loaded('inotify')) { throw new ZtChart_Model_Monitor_Daemon_Exception('Inotify extension is not loaded !'); } if (!extension_loaded('sysvshm')) { throw new ZtChart_Model_Monitor_Daemon_Exception('System V shared memory extension is not loaded !'); } $this->_shmId = shm_attach(ftok(__FILE__, '1'), self::SHM_SIZE); if (!extension_loaded('sysvsem')) { throw new ZtChart_Model_Monitor_Daemon_Exception('System V semaphore extension is not loaded !'); } $this->_semId = sem_get(ftok(__FILE__, 2)); parent::__construct($config); }
/** * 初始化使用Infobright数据库的类 */ protected function _initInfobright() { $infobright = $this->bootstrap('multidb')->getResource('multidb')->getDb('infobright'); ZtChart_Model_Monitor_Daemon_Abstract::setDefaultDb($infobright); ZtChart_Model_Monitor_Daemon_Abstract::setNfsDirectory('/var/tmp'); }
/** * * @static * @param string $nfsDirectory */ public static function setNfsDirectory($nfsDirectory) { self::$_nfsDirectory = $nfsDirectory; }