Пример #1
0
 private function createHandler($options = array(), $notifyOnWarning = true)
 {
     EventHandler::reset();
     $this->connection = new TestConnection();
     $this->handler = EventHandler::start(1, $notifyOnWarning, $options);
     $this->handler->getClient()->setConnection($this->connection);
 }
Пример #2
0
 /**
  * @dataProvider testMethodsProvider
  */
 public function testMethods($expectedLevel, $methodName)
 {
     EventHandler::reset();
     $connection = new TestConnection();
     $options = array('errorReportingLevel' => $expectedLevel);
     $handler = EventHandler::start(1, true, $options);
     $handler->getClient()->setConnection($connection);
     $this->trigger->{$methodName}();
     $this->assertEquals(1, $connection->sendCalls);
 }
 /**
  *
  */
 public static function initialize()
 {
     $airbrake_ini = Configuration::getSection('phpframework-airbrake');
     if (!is_null($airbrake_ini) && Configuration::get('phpframework-airbrake', 'enable', FALSE)) {
         $apiKey = $airbrake_ini['api_key'];
         $airbrake_environment = isset($airbrake_ini['environment']) ? $airbrake_ini['environment'] : 'NO_ENVIRONMENT_SET';
         $options = ['secure' => TRUE, 'host' => $airbrake_ini['host'], 'resource' => $airbrake_ini['resource'], 'timeout' => 10, 'environmentName' => Configuration::get('application', 'application') . ' / ' . $airbrake_environment];
         \Airbrake\EventHandler::start($apiKey, FALSE, $options);
         $config = new \Airbrake\Configuration($apiKey, $options);
         self::$client = new \Airbrake\Client($config);
     }
 }
Пример #4
0
    if (!isset($_config['notifyOnWarning']) || empty($_config['notifyOnWarning'])) {
        $_config['notifyOnWarning'] = (bool) (E_NOTICE & error_reporting());
    }
    if (!isset($_config['options'])) {
        $_config['options'] = array();
    }
    if (!isset($_config['options']['environmentName']) || empty($_config['options']['environmentName'])) {
        $_config['options']['environmentName'] = Environment::get();
    }
    if (!isset($_config['options']['projectRoot']) || empty($_config['options']['projectRoot'])) {
        $_config['options']['projectRoot'] = LITHIUM_APP_PATH;
    }
    // Setup Airbrake
    $config = new Configuration($_config['apiKey'], $_config['options']);
    $client = new Client($config);
    $handler = new EventHandler($client, (bool) $_config['notifyOnWarning']);
    // Apply Error handler
    set_error_handler(function ($errno, $errstr, $errfile = null, $errline = 0, array $errcontext = array()) use($handler) {
        $handler->onError($errno, $errstr, $errfile, $errline, $errcontext);
    });
    // Apply Exception handler
    // $previousExceptionHandler = set_exception_handler();
    // set_exception_handler(function($exception) use ($handler, $previousExceptionHandler) {
    //     $handler->onException($exception);
    //     if ($previousExceptionHandler) {
    //         call_user_func($previousExceptionHandler, $exception);
    //     }
    // });
    register_shutdown_function(array($handler, 'onShutdown'));
}
unset($_config);
Пример #5
0
    } else {
        if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https") {
            $protocol = 'https';
        } elseif (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
            $protocol = 'https';
        }
        define('ABSOLUTE_URL', $protocol . '://' . $_SERVER['SERVER_NAME'] . '/');
    }
}
if (file_exists(BASE_PATH . 'bootstrap/serverconfig.php')) {
    include BASE_PATH . 'bootstrap/serverconfig.php';
} else {
    include BASE_PATH . 'bootstrap/serverconfig-default.php';
}
if (defined('AIRBRAKE_TOKEN')) {
    \Airbrake\EventHandler::start(AIRBRAKE_TOKEN);
}
if (!defined('SPEED_FACTOR')) {
    define('SPEED_FACTOR', 1);
}
if (!defined('STATIC_ABSOLUTE_URL')) {
    define('STATIC_ABSOLUTE_URL', ABSOLUTE_URL);
}
if (!defined('GAME_NAME')) {
    define('GAME_NAME', 'Dolumar');
}
// API
if (!defined('API_FULL_URL')) {
    define('API_FULL_URL', ABSOLUTE_URL . 'api/');
}
if (!defined('API_OPENID_URL')) {