public function __construct($logfile = NULL) { if (is_null($logfile)) { throw new coEx(__METHOD__); } $cobra = __k_cache_fetch(); $this->__logfile = $cobra['path.log'] . '/' . basename($logfile) . '.log'; }
function __k_die($str = '', $exit = 1, $obclean = true) { if (COBRA_CLI) { __k_print($str, $obclean); } else { $cobra = __k_cache_fetch(); $error_html = $cobra['path.error'] . '/' . __k_safe_str($str) . COBRA_ERROR_EXTENSION; if (is_readable($error_html)) { readfile($error_html); } else { __k_json($str, $obclean); } } exit($exit); }
<?php // begin header if (!($bootstrap = getenv('COBRA_BOOTSTRAP'))) { die('COBRA_BOOTSTRAP'); } require_once $bootstrap; // end header $cosys = __k_cache_fetch(); $codb = new coDB($cosys['sys.config']); __k_print('PHP Time'); __k_print('time: ' . $codb->time()); __k_print('microtime: ' . $codb->microtime()); __k_print('timestamp: ' . $codb->timestamp()); __k_print('DB Time'); $codb->Connect(); __k_print('time: ' . $codb->time()); __k_print('microtime: ' . $codb->microtime()); __k_print('timestamp: ' . $codb->timestamp()); $codb->Disconnect();
} } break; // end case } return $cache; } // end function __c_cache($root = NULL, $cache_file = NULL, $recursive = true, $verbose = true) { $cache = __c_cache_dir($root, $recursive); if (empty($cache)) { return false; } if ($verbose) { print_r($cache); } if (!($cache_handle = fopen($cache_file, 'w'))) { return false; } fwrite($cache_handle, serialize($cache)); fclose($cache_handle); } //// BEGIN MAIN if (!($cobra = __k_cache_fetch())) { die(__FILE__ . '(' . __LINE__ . ')'); } foreach ($cobra['sys.cache'] as $cache => $desc) { __c_cache($desc['path'], $cobra['path.cache'] . '/' . $cache . '.' . COBRA_CACHE_EXTENSION, $desc['recursive']); } //// END MAIN