public function __construct($args) { parent::__construct($args); $this->cluster = ClusterModel::getInstance(); $this->clusterName = $this->cluster->clusterName; $this->instanceName = $this->cluster->instanceName; }
public function __construct($args) { parent::__construct($args); if (defined('CLUSTER_IRI')) { require_once APPS_ROOT . 'cluster/model.php'; $this->cluster = ClusterModel::getInstance(); } }
public function main($args) { echo "Eregansu Command-line Shell\n"; if (function_exists('readline')) { echo "- Readline is available\n"; $this->useReadline = true; } if (defined('CLUSTER_IRI')) { require_once APPS_ROOT . 'cluster/model.php'; $this->cluster = ClusterModel::getInstance(); } $this->stdin = fopen('php://stdin', 'r'); $router = new ShellRouter(); while (!$this->exit) { $cmdline = $this->getline(); $cmd = $this->parseline($cmdline); if (!count($cmd) || !strlen($cmd[0])) { continue; } if (!strcmp($cmd[0], 'exit')) { break; } Error::$throw = true; $req = Request::requestForSAPI('cli'); $req->params = $cmd; try { try { $router->process($req); } catch (TerminalErrorException $ex) { } } catch (Exception $e) { echo $e . "\n"; } $req = null; } }
public function __construct($args) { global $LOG_SYSLOG, $LOG_SYSLOG_FACILITY, $LOG_BACKTRACE, $LOG_STDERR; if (isset($args['db'])) { parent::__construct($args); } if (!self::$pid) { self::$pid = getmypid(); } if (!self::$ferr) { self::$ferr = fopen('php://stderr', 'w'); } if (defined('CLUSTER_IRI') && !self::$clusterName) { require_once APPS_ROOT . 'cluster/model.php'; $cluster = ClusterModel::getInstance(); self::$clusterName = $cluster->clusterName; self::$instanceName = $cluster->instanceName; self::$clusterSpec = ' ' . self::$clusterName . '/' . self::$instanceName; } if (!isset(self::$syslog)) { self::$syslog = $LOG_SYSLOG; } if (!isset(self::$syslogFacility)) { self::$syslogFacility = $LOG_SYSLOG_FACILITY; } if (!isset(self::$backtrace)) { self::$backtrace = $LOG_BACKTRACE; } if (!isset(self::$stderr)) { self::$stderr = $LOG_STDERR; } if ($this->db) { do { $this->db->begin(); if (self::$clusterName) { if ($this->db->row('SELECT * FROM {log_count} WHERE "log_cluster" = ? AND "log_instance" = ?', self::$clusterName, self::$instanceName)) { $this->db->rollback(); break; } } else { if ($this->db->row('SELECT * FROM {log_count} WHERE "log_cluster" IS NULL AND "log_instance" IS NULL')) { $this->db->rollback(); break; } } $this->db->insert('log_count', array('log_cluster' => self::$clusterName, 'log_instance' => self::$instanceName, 'log_count' => 0)); } while (!$this->db->commit()); } }