コード例 #1
0
 /**
  * Destroy everything
  */
 public static function destroy()
 {
     $__run_only_bootstrap = application::get(['flag', 'global', '__run_only_bootstrap']);
     // we need to set working directory again
     chdir(application::get(['application', 'path_full']));
     // error processing
     if (empty(error_base::$flag_error_already)) {
         $last_error = error_get_last();
         $flag_render = false;
         if (in_array($last_error['type'], [E_COMPILE_ERROR, E_PARSE, E_ERROR])) {
             error_base::error_handler($last_error['type'], $last_error['message'], $last_error['file'], $last_error['line']);
             error_base::$flag_error_already = true;
             $flag_render = true;
         }
         if ($flag_render || error_base::$flag_exception) {
             error_base::$flag_error_already = true;
             if ($__run_only_bootstrap) {
                 helper_ob::clean_all();
                 print_r(error_base::$errors);
             } else {
                 // set mvc + process
                 application::set_mvc('/error/_error/500');
                 application::process();
             }
         }
     }
     // write sessions
     session_write_close();
     // final benchmark
     if (debug::$debug) {
         debug::benchmark('application end');
     }
     // debugging toolbar last
     if (debug::$toolbar && !$__run_only_bootstrap) {
         echo str_replace('<!-- [numbers: debug toolbar] -->', debug::render(), helper_ob::clean());
     }
     // flush data to client
     flush();
     // closing caches before db
     $cache = factory::get(['cache']);
     if (!empty($cache)) {
         foreach ($cache as $k => $v) {
             $object = $v['object'];
             if (!empty(cache::$reset_caches[$k])) {
                 $object->gc(1, cache::$reset_caches[$k]);
             }
             $object->close();
         }
     }
     // destroy i18n
     if (i18n::$initialized) {
         i18n::destroy();
     }
     // close db connections
     $dbs = factory::get(['db']);
     if (!empty($dbs)) {
         foreach ($dbs as $k => $v) {
             $object = $v['object'];
             $object->close();
         }
     }
     // emails with erros
     if (debug::$debug && !empty(debug::$email)) {
         debug::send_errors_to_admin();
     }
 }
コード例 #2
0
ファイル: application.php プロジェクト: uvbs/MyProjects
<?php

require_once 'object_set.php';
class application extends object_set
{
    function table_name()
    {
        return "t_application";
    }
}
$application = new application();
$application->process();