View source
<?php
$xhprof_enabled = FALSE;
if (function_exists('xhprof_enable') && $xhprof_enabled) {
include_once '/Users/marco/PhpstormProjects/xhprof' . '/xhprof_lib/utils/xhprof_lib.php';
include_once '/Users/marco/PhpstormProjects/xhprof' . '/xhprof_lib/utils/xhprof_runs.php';
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
}
$is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
$http_protocol = $is_https ? 'https' : 'http';
$base_url = $http_protocol . '://' . $_SERVER['HTTP_HOST'];
define('DRUPAL_ROOT', substr($_SERVER['SCRIPT_FILENAME'], 0, strpos($_SERVER['SCRIPT_FILENAME'], $_SERVER['REQUEST_URI'])));
chdir(DRUPAL_ROOT);
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/includes/common.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
drupal_add_http_header('X-Ad-bootstrap-phase', 'configuration');
require_once DRUPAL_ROOT . '/includes/cache.inc';
foreach (variable_get('cache_backends', array()) as $include) {
require_once DRUPAL_ROOT . '/' . $include;
}
$cache_backend = _cache_get_object('ad');
if ($cache_backend instanceof DrupalDatabaseCache) {
drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
drupal_add_http_header('X-Ad-bootstrap-phase', 'database');
}
require_once DRUPAL_ROOT . '/' . variable_get('lock_inc', 'includes/lock.inc');
require_once DRUPAL_ROOT . '/modules/system/system.queue.inc';
foreach (variable_get('queue_backends', array()) as $include) {
require_once DRUPAL_ROOT . '/' . $include;
}
if (variable_get('ad_queue_info')) {
$queue = DrupalQueue::get('ad');
if ($queue instanceof SystemQueue) {
drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
drupal_add_http_header('X-Ad-bootstrap-phase', 'database');
}
}
require_once DRUPAL_ROOT . '/' . variable_get('ad_module_path') . '/ad.module';
ad_get_ads();
if (function_exists('xhprof_enable') && $xhprof_enabled) {
$namespace = 'Site-Install';
$xhprof_data = xhprof_disable();
$xhprof_runs = new XHProfRuns_Default();
$devel_run_id = $xhprof_runs
->save_run($xhprof_data, $namespace);
drupal_add_http_header('X-Ad-xhprof', $devel_run_id);
}