コード例 #1
0
 function __construct($is_cli = null)
 {
     if ($is_cli === null) {
         $is_cli = \Radical\Core\Server::isCLI();
     }
     if ($is_cli) {
         $c = self::CLI_HANDLER;
     } else {
         $c = self::WEB_HANDLER;
     }
     $this->handler = new $c();
 }
 function __construct(\Bugsnag_Client $client, $is_cli = null)
 {
     if ($is_cli === null) {
         $is_cli = \Radical\Core\Server::isCLI();
     }
     if ($is_cli) {
         $c = self::CLI_HANDLER;
     } else {
         $c = self::WEB_HANDLER;
     }
     $this->client = $client;
     $this->handler = new $c($this);
 }
コード例 #3
0
 /**
  * @param string $sql
  * @return Table\CacheableTableSet|Table\TableSet|static[]
  */
 static function getAll($sql = '')
 {
     if (\Radical\Core\Server::isCLI()) {
         return parent::getAll($sql);
     }
     $obj = static::_getAll($sql);
     $cached = Table\TableCache::Get($obj);
     if ($cached) {
         return $cached;
     } else {
         return new Table\CacheableTableSet($obj, get_called_class());
     }
 }
コード例 #4
0
ファイル: Session.php プロジェクト: splitice/radical-web
 /**
  * Get the users IP
  * 
  * @return \Radical\Utility\Net\IP
  */
 static function IP()
 {
     if (\Radical\Core\Server::isCLI()) {
         return new IP(static::DEFAULT_IP);
     }
     if (isset($_SERVER['HTTP_X_REAL_IP'])) {
         return new IP($_SERVER['HTTP_X_REAL_IP']);
     }
     if (isset($_SERVER['REMOTE_ADDR'])) {
         return new IP($_SERVER['REMOTE_ADDR']);
     }
     return new IP(static::DEFAULT_IP);
 }
コード例 #5
0
 function __construct(\Exception $ex, $fatal = true)
 {
     $this->ex = $ex;
     //Build Error page
     if (!\Radical\Core\Server::isCLI() && \Radical\Core\Server::isProduction()) {
         $message = 'An exception has occurred in the script.';
         global $_ADMIN_EMAIL;
         if (isset($_ADMIN_EMAIL)) {
             $message .= ' Please report this to an administrator at ' . $_ADMIN_EMAIL . '.';
         }
     } else {
         $message = 'An exception occurred at ' . $ex->getFile() . '@' . $ex->getLine() . ': ' . $ex->getMessage();
     }
     $header = sprintf(static::HEADER, ltrim(get_class($ex), '\\'));
     parent::__construct($message, $header, $fatal, $ex);
 }
コード例 #6
0
 function __construct($errno, $msg_text, Structs\LocationReference $where)
 {
     $this->errno = $errno;
     $this->error_text = $msg_text;
     $this->error_location = $where;
     //Build Error page
     if (!\Radical\Core\Server::isProduction() || \Radical\Core\Server::isCLI()) {
         $message = 'A PHP error occurred at ' . $where->toShort() . ': ' . $msg_text;
     } else {
         $message = 'An error has occurred in the script.';
         global $_ADMIN_EMAIL;
         if (isset($_ADMIN_EMAIL)) {
             $message .= ' Please report this to an administrator at ' . $_ADMIN_EMAIL . '.';
         }
     }
     $fatal = false;
     if ($errno == E_CORE_ERROR || $errno == E_ERROR || $errno == E_RECOVERABLE_ERROR || $errno == E_USER_ERROR) {
         $fatal = true;
     }
     parent::__construct($message, static::HEADER, $fatal);
 }
コード例 #7
0
ファイル: Internal.php プロジェクト: splitice/radical-web
 function __construct()
 {
     $this->is_cli = Server::isCLI();
     parent::__construct();
 }