Example #1
0
 public function init()
 {
     Daemon::log(get_class($this) . ' up.');
     ini_set('display_errors', 'On');
     $this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance($this->config->redisname->value);
     $this->db = \PHPDaemon\Clients\Mongo\Pool::getInstance($this->config->mongoname->value);
     $this->dbname = $this->config->dbname->value;
     $this->ipcId = new MongoId();
     $this->JobManager = new JobManager($this);
     $this->Sendmail = new Sendmail($this);
     if (isset($this->config->BackendServer)) {
         $this->backendServer = BackendServer::getInstance($this->config->BackendServer, true, $this);
     }
     if (isset($this->config->BackendClient)) {
         $this->backendClient = BackendClient::getInstance($this->config->BackendClient, true, $this);
     }
     $this->discoverOrm($this->config->ormdir->value . '*.php');
     /*	$this->LockClient = \PHPDaemon\Clients\Lock\Pool::getInstance();
     		$this->LockClient->job(get_class($this) . '-' . $this->name, true, function ($jobname, $command, $client) {
     			foreach (glob($this->config->themesdir->value . '*'.'/blocks/*') as $file) {
     				Daemon::$process->fileWatcher->addWatch($file, array($this, 'onBlockFileChanged'));
     			}
     		});*/
     $this->locales = array_map('basename', glob($this->config->localedir->value . '*', GLOB_ONLYDIR));
     if (!in_array($this->config->defaultlocale->value, $this->locales, true)) {
         $this->locales[] = $this->config->defaultlocale->value;
     }
     if (!in_array('en', $this->locales, true)) {
         $this->locales[] = 'en';
     }
     $this->components = new Components($this->fakeRequest());
     foreach ($this->config as $k => $c) {
         if (isset($c->run->value) && $c->run->value) {
             if (substr($k, 0, 3) === 'Cmp') {
                 $appInstance->components->{substr($k, 3)};
             }
         }
     }
     $this->serializer = 'igbinary';
     $this->httpclient = \PHPDaemon\Clients\HTTP\Pool::getInstance();
 }
Example #2
0
<?php

if (php_sapi_name() != 'cli') {
    exit;
}
require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/lib/BackendServer.class.php';
date_default_timezone_set($timezone);
$server = new BackendServer(array('server_ip' => $server_ip, 'server_port' => $server_port));
$server->load_plugins($autoload_plugins, $plugin_settings);
$server->run();