/** * Cache data. * * @return void */ public static function cache() { if (!Profiler::show('cache')) { return; } $queries = Cache::$queries; $table = new Profiler_Table(); $table->add_column(); $table->add_column('kp-column kp-data'); $table->add_column('kp-column kp-data'); $table->add_column('kp-column kp-data'); $table->add_row(array('Cache', 'Gets', 'Sets', 'Deletes'), 'kp-title', 'background-color: #E0FFE0'); text::alternate(); $total_gets = $total_sets = $total_deletes = 0; $total_requests = array(); foreach ($queries as $type => $requests) { foreach ($requests as $query) { if (!isset($total_requests[$query])) { $total_requests[$query] = array('gets' => 0, 'sets' => 0, 'deletes' => 0); } $total_requests[$query][$type]++; } } foreach ($total_requests as $query => $types) { $data = array($query, $types['gets'], $types['sets'], $types['deletes']); $class = text::alternate('', 'kp-altrow'); $table->add_row($data, $class); $total_gets += $types['gets']; $total_sets += $types['sets']; $total_deletes += $types['deletes']; } $data = array('Total: ' . count($total_requests), $total_gets, $total_sets, $total_deletes); $table->add_row($data, 'kp-totalrow'); Profiler::add($table); }
} // Connect to database require_once "core/model/DB.php"; // Redirect to the installer if no database is selected if (!isset($databaseConfig) || !isset($databaseConfig['database']) || !$databaseConfig['database']) { $s = isset($_SERVER['SSL']) || isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 's' : ''; $installURL = "http{$s}://" . $_SERVER['HTTP_HOST'] . BASE_URL . '/install.php'; // The above dirname() will equate to "\" on Windows when installing directly from http://localhost (not using // a sub-directory), this really messes things up in some browsers. Let's get rid of the backslashes $installURL = str_replace('\\', '', $installURL); header("Location: {$installURL}"); die; } if (isset($_GET['debug_profile'])) { Profiler::mark('DB::connect'); } DB::connect($databaseConfig); if (isset($_GET['debug_profile'])) { Profiler::unmark('DB::connect'); } if (isset($_GET['debug_profile'])) { Profiler::unmark('main.php init'); } // Direct away - this is the "main" function, that hands control to the appropriate controller Director::direct($url); if (isset($_GET['debug_profile'])) { Profiler::unmark('all_execution'); if (!Director::isLive()) { Profiler::show(isset($_GET['profile_trace'])); } }
/** * Cookie data. * * @return void */ public static function cookies() { if (empty($_COOKIE)) { return; } if (!Profiler::show('cookies')) { return; } $table = new Profiler_Table(); $table->add_column('kp-name'); $table->add_column(); $table->add_row(array(__('Cookies'), __('Value')), 'kp-title', 'background-color: #FFF4D7'); text::alternate(); foreach ($_COOKIE as $name => $value) { $data = array($name, $value); $class = text::alternate('', 'kp-altrow'); $table->add_row($data, $class); } Profiler::add($table); }