示例#1
0
文件: Dog.php 项目: sinfocol/gwf3
 public static function mainloop()
 {
     Dog_Log::debug('Dog::mainloop() - start');
     while (!Dog_Launcher::shouldRestart()) {
         foreach (self::$SERVERS as $server) {
             $server instanceof Dog_Server;
             if ($server->isActive()) {
                 self::processServer($server);
             }
         }
         Dog_Timer::sleepAndTrigger();
         self::$WORKER->executeCallbacks();
     }
     Dog_Launcher::cleanup();
     Dog_Log::debug('Dog::mainloop() - exited');
 }
示例#2
0
文件: dog.php 项目: sinfocol/gwf3
chdir(dirname(__FILE__));
chdir('../');
# Require config
$config_file = $argv[1];
require_once '../../../www/protected/' . $config_file;
# and gwf
require_once '../../../gwf3.class.php';
$gwf = new GWF3(NULL, array('init' => true, 'bootstrap' => false, 'website_init' => false, 'autoload_modules' => false, 'load_module' => false, 'load_config' => false, 'start_debug' => true, 'get_user' => false, 'do_logging' => false, 'log_request' => false, 'blocking' => true, 'no_session' => true, 'store_last_url' => false, 'ignore_user_abort' => false, 'kick_banned_ip' => false, 'env' => isset($argv[5]) ? $argv[5] : 'prod', 'unix_user' => isset($argv[6]) ? $argv[6] : 'root'));
# That´s all of GWF3 we will share with the worker.
GWF_HTML::init();
GWF_Debug::setDieOnError(false);
GWF_Debug::setMailOnError(false);
$_GET['ajax'] = 1;
# And this is the worker process
require 'dog_include/Dog_WorkerThread.php';
$worker = new Dog_WorkerThread();
$worker->start();
# Parent resources
GWF_Log::init(false, GWF_Log::_DEFAULT - GWF_Log::BUFFERED, GWF_PATH . 'www/protected/logs/dog');
gdo_db();
# Dog please
require_once 'Dog.php';
Dog::setUnixUsername(GWF3::getConfig('unix_user'));
# Dog installer
if (isset($argv[2]) && $argv[2] === 'install') {
    require_once 'mini_install.php';
}
# Dog init
Dog_Init::init($worker);
# Dog l(a)unch
if (!defined('DOG_NO_LAUNCH') && Dog_Init::validate()) {
示例#3
0
 private function setupChild()
 {
     self::$CHILD_INSTANCE = $this;
     declare (ticks=1);
     if (false === pcntl_signal(SIGINT, array(__CLASS__, 'SIGINT'))) {
         die('Cannot install SIGINT handler in ' . __FILE__ . PHP_EOL);
     }
     // 		chdir('../../../');
     GWF_Log::init(false, GWF_Log::_DEFAULT - GWF_Log::BUFFERED, GWF_PATH . 'www/protected/logs/dog/worker');
     GWF_Log::logCron('--================--');
     GWF_Log::logCron('-= Worker started =-');
     GWF_Log::logCron('--================--');
 }