예제 #1
0
 public function indexAction()
 {
     Cosmos_Profiler::start('calc.multiply');
     // This is not typical because a core action would not be using add-on methods.
     $this->view->result = Cosmos_Api::get()->calc->divide(10, 2);
     $this->view->service_plugin_result = Cosmos_Api::get()->sample->add(5, 5);
     Cosmos_Profiler::stop('calc.multiply');
 }
예제 #2
0
 public function indexAction()
 {
     Cosmos_Profiler::start('sampleIndex');
     $this->view->result = Cosmos_Addon::getInstance()->listEnabledAddons();
     Cosmos_Profiler::stop('sampleIndex');
 }
예제 #3
0
 public static function disable()
 {
     self::$_enabled = false;
 }
예제 #4
0
파일: init.php 프로젝트: EvanDotPro/cosmos
Cosmos_Profiler::enable();
Cosmos_Profiler::start('app');
// Bootsrap
Cosmos_Profiler::start('bootstrap');
try {
    require_once 'ZendC/Application.php';
    $application = new ZendC_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/config.php');
    $application->bootstrap();
} catch (Zend_Config_Exception $e) {
    // This is a bit sloppy, but the front controller won't catch these otherwise
    $exceptionMessage = strtolower($e->getMessage());
    if (strpos($exceptionMessage, 'syntax error') !== false) {
        $message = 'Configuration Error - Invalid Syntax';
    } elseif (strpos($exceptionMessage, 'no such file') !== false) {
        $message = 'Configuration Error - Invalid Host';
    } else {
        $message = 'Configuration Error - Unknown Error';
    }
    die($message);
}
Cosmos_Profiler::stop('bootstrap');
// Run
Cosmos_Profiler::start('run');
$response = $application->run();
Cosmos_Profiler::stop('run');
// Stop the profiler and send output to browser
Cosmos_Profiler::stop('app');
if (APPLICATION_MODE != 'server') {
    Cosmos_Profiler::_toFirebug();
    $response->sendResponse();
}