Example #1
0
 static function updateCacheFileAfterExecution($environment = null)
 {
     static $called = false, $_environment;
     if ($called == false && !AkDbSchemaCache::shouldRefresh()) {
         register_shutdown_function(array('AkDbSchemaCache', 'updateCacheFileAfterExecution'));
         $called = !empty($environment) ? $environment : AK_ENVIRONMENT;
     } elseif (empty($environment)) {
         $config = AkDbSchemaCache::config(null, null, $called);
         $file_name = AkDbSchemaCache::getCacheFileName($called);
         /**
          * @todo On PHP5 var_export requires objects that implement the __set_state magic method.
          *       As see on stangelanda at arrowquick dot benchmarks at comhttp://php.net/var_export
          *       serialize works faster without opcode caches. We should do our benchmarks with
          *       var_export VS serialize using APC once we fix the __set_state magic on phpAdoDB
          */
         if (AK_LOG_EVENTS) {
             $Logger = Ak::getLogger();
         }
         if (!AK_CLI) {
             if (AK_LOG_EVENTS) {
                 $Logger->message('Updating database settings on ' . $file_name);
             }
             AkFileSystem::file_put_contents($file_name, serialize($config), array('base_path' => AK_TMP_DIR));
             //file_put_contents($file_name, serialize($config));
         } else {
             if (AK_LOG_EVENTS) {
                 $Logger->message('Skipping writing of cache file: ' . $file_name);
             }
         }
     }
 }