Skip to content

Commit

Permalink
#259623 by dopry and Damien Tournoud: Convert includes/requires to us…
Browse files Browse the repository at this point in the history
…e absolute paths.
  • Loading branch information
webchick committed Sep 20, 2008
1 parent 0bc0e8b commit 50c5e90
Show file tree
Hide file tree
Showing 33 changed files with 220 additions and 196 deletions.
9 changes: 7 additions & 2 deletions cron.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<?php
// $Id: cron.php,v 1.39 2008-05-26 17:24:42 dries Exp $
// $Id: cron.php,v 1.40 2008-09-20 20:22:23 webchick Exp $

/**
* @file
* Handles incoming requests to fire off regularly-scheduled tasks (cron jobs).
*/

include_once './includes/bootstrap.inc';
/**
* Root directory of Drupal installation.
*/
define('DRUPAL_ROOT', dirname(realpath(__FILE__)));

include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
if (isset($_GET['cron_key']) && variable_get('cron_key', 'drupal') == $_GET['cron_key']) {
drupal_cron_run();
Expand Down
6 changes: 3 additions & 3 deletions includes/batch.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// $Id: batch.inc,v 1.20 2008-06-24 21:51:02 dries Exp $
// $Id: batch.inc,v 1.21 2008-09-20 20:22:23 webchick Exp $

/**
* @file Batch processing API for processes to run in multiple HTTP requests.
Expand Down Expand Up @@ -183,7 +183,7 @@ function _batch_process() {
// request, we check if it requires an additional file for functions
// definitions.
if ($set_changed && isset($current_set['file']) && is_file($current_set['file'])) {
include_once($current_set['file']);
include_once DRUPAL_ROOT . '/' . $current_set['file'];
}

$task_message = '';
Expand Down Expand Up @@ -304,7 +304,7 @@ function _batch_finished() {
if (isset($batch_set['finished'])) {
// Check if the set requires an additional file for functions definitions.
if (isset($batch_set['file']) && is_file($batch_set['file'])) {
include_once($batch_set['file']);
include_once DRUPAL_ROOT . '/' . $batch_set['file'];
}
if (function_exists($batch_set['finished'])) {
$batch_set['finished']($batch_set['success'], $batch_set['results'], $batch_set['operations']);
Expand Down
34 changes: 17 additions & 17 deletions includes/bootstrap.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// $Id: bootstrap.inc,v 1.227 2008-09-19 07:53:59 dries Exp $
// $Id: bootstrap.inc,v 1.228 2008-09-20 20:22:23 webchick Exp $

/**
* @file
Expand Down Expand Up @@ -329,8 +329,8 @@ function conf_init() {
global $databases, $db_prefix, $cookie_domain, $conf, $installed_profile, $update_free_access;
$conf = array();

if (file_exists('./' . conf_path() . '/settings.php')) {
include_once './' . conf_path() . '/settings.php';
if (file_exists(DRUPAL_ROOT . '/' . conf_path() . '/settings.php')) {
include_once DRUPAL_ROOT . '/' . conf_path() . '/settings.php';
}

if (isset($base_url)) {
Expand Down Expand Up @@ -602,7 +602,7 @@ function drupal_load($type, $name) {
$filename = drupal_get_filename($type, $name);

if ($filename) {
include_once "./$filename";
include_once DRUPAL_ROOT . '/' . $filename;
$files[$type][$name] = TRUE;

return TRUE;
Expand Down Expand Up @@ -1006,7 +1006,7 @@ function _drupal_bootstrap($phase) {
case DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE:
// Allow specifying special cache handlers in settings.php, like
// using memcached or files for storing cache information.
require_once variable_get('cache_inc', './includes/cache.inc');
require_once DRUPAL_ROOT . '/' . variable_get('cache_inc', 'includes/cache.inc');
// If the page_cache_fastpath is set to TRUE in settings.php and
// page_cache_fastpath (implemented in the special implementation of
// cache.inc) printed the page and indicated this with a returned TRUE
Expand All @@ -1019,7 +1019,7 @@ function _drupal_bootstrap($phase) {
case DRUPAL_BOOTSTRAP_DATABASE:
// Initialize the database system. Note that the connection
// won't be initialized until it is actually requested.
require_once './includes/database/database.inc';
require_once DRUPAL_ROOT . '/includes/database/database.inc';
// Register autoload functions so that we can access classes and interfaces.
spl_autoload_register('drupal_autoload_class');
spl_autoload_register('drupal_autoload_interface');
Expand All @@ -1035,7 +1035,7 @@ function _drupal_bootstrap($phase) {
break;

case DRUPAL_BOOTSTRAP_SESSION:
require_once variable_get('session_inc', './includes/session.inc');
require_once DRUPAL_ROOT . '/' . variable_get('session_inc', 'includes/session.inc');
session_set_save_handler('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy_sid', '_sess_gc');
session_start();
break;
Expand All @@ -1044,7 +1044,7 @@ function _drupal_bootstrap($phase) {
// Initialize configuration variables, using values from settings.php if available.
$conf = variable_init(isset($conf) ? $conf : array());
// Load module handling.
require_once './includes/module.inc';
require_once DRUPAL_ROOT . '/includes/module.inc';
$cache_mode = variable_get('cache', CACHE_DISABLED);
// Get the page from the cache.
$cache = $cache_mode == CACHE_DISABLED ? '' : page_get_cache();
Expand All @@ -1071,13 +1071,13 @@ function _drupal_bootstrap($phase) {
break;

case DRUPAL_BOOTSTRAP_PATH:
require_once './includes/path.inc';
require_once DRUPAL_ROOT . '/includes/path.inc';
// Initialize $_GET['q'] prior to loading modules and invoking hook_init().
drupal_init_path();
break;

case DRUPAL_BOOTSTRAP_FULL:
require_once './includes/common.inc';
require_once DRUPAL_ROOT . '/includes/common.inc';
_drupal_bootstrap_full();
break;
}
Expand All @@ -1092,7 +1092,7 @@ function _drupal_bootstrap($phase) {
* @see _drupal_maintenance_theme()
*/
function drupal_maintenance_theme() {
require_once './includes/theme.maintenance.inc';
require_once DRUPAL_ROOT . '/includes/theme.maintenance.inc';
_drupal_maintenance_theme();
}

Expand Down Expand Up @@ -1120,7 +1120,7 @@ function drupal_init_language() {
$language = language_default();
}
else {
include_once './includes/language.inc';
include_once DRUPAL_ROOT . '/includes/language.inc';
$language = language_initialize();
}
}
Expand Down Expand Up @@ -1270,7 +1270,7 @@ function drupal_get_schema($table = NULL, $rebuild = FALSE) {
// Invoke hook_schema for all modules.
foreach (module_implements('schema') as $module) {
$current = module_invoke($module, 'schema');
require_once('./includes/common.inc');
require_once DRUPAL_ROOT . '/includes/common.inc';
if (drupal_function_exists('_drupal_initialize_schema')) {
_drupal_initialize_schema($module, $current);
}
Expand Down Expand Up @@ -1342,7 +1342,7 @@ function drupal_function_exists($function) {

$file = db_result(db_query("SELECT filename FROM {registry} WHERE name = :name AND type = :type", array(':name' => $function, ':type' => 'function')));
if ($file) {
require_once($file);
require_once DRUPAL_ROOT . '/' . $file;
$checked[$function] = function_exists($function);
if ($checked[$function]) {
registry_mark_code('function', $function);
Expand Down Expand Up @@ -1390,7 +1390,7 @@ function drupal_autoload_class($class) {
function _registry_check_code($type, $name) {
$file = db_result(db_query("SELECT filename FROM {registry} WHERE name = :name AND type = :type", array(':name' => $name, ':type' => $type)));
if ($file) {
require_once($file);
require_once DRUPAL_ROOT . '/' . $file;
registry_mark_code($type, $name);
return TRUE;
}
Expand Down Expand Up @@ -1430,7 +1430,7 @@ function registry_mark_code($type, $name, $return = FALSE) {
* each function, file, and hook implementation in the database.
*/
function registry_rebuild() {
require_once './includes/registry.inc';
require_once DRUPAL_ROOT . '/includes/registry.inc';
_registry_rebuild();
}

Expand Down Expand Up @@ -1501,7 +1501,7 @@ function registry_load_path_files($return = FALSE) {
$cache = cache_get('registry:' . $menu['path'], 'cache_registry');
if (!empty($cache->data)) {
foreach(explode(';', $cache->data) as $file) {
require_once($file);
require_once DRUPAL_ROOT . '/' . $file;
$file_cache_data[] = $file;
}
}
Expand Down
24 changes: 12 additions & 12 deletions includes/common.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// $Id: common.inc,v 1.798 2008-09-20 03:49:23 webchick Exp $
// $Id: common.inc,v 1.799 2008-09-20 20:22:23 webchick Exp $

/**
* @file
Expand Down Expand Up @@ -2491,7 +2491,7 @@ function drupal_valid_token($token, $value = '', $skip_anonymous = FALSE) {
* failed. See xmlrpc_error().
*/
function xmlrpc($url) {
require_once './includes/xmlrpc.inc';
require_once DRUPAL_ROOT . '/includes/xmlrpc.inc';
$args = func_get_args();
return call_user_func_array('_xmlrpc', $args);
}
Expand All @@ -2503,16 +2503,16 @@ function _drupal_bootstrap_full() {
return;
}
$called = 1;
require_once './includes/theme.inc';
require_once './includes/pager.inc';
require_once './includes/menu.inc';
require_once './includes/tablesort.inc';
require_once './includes/file.inc';
require_once './includes/unicode.inc';
require_once './includes/image.inc';
require_once './includes/form.inc';
require_once './includes/mail.inc';
require_once './includes/actions.inc';
require_once DRUPAL_ROOT . '/includes/theme.inc';
require_once DRUPAL_ROOT . '/includes/pager.inc';
require_once DRUPAL_ROOT . '/includes/menu.inc';
require_once DRUPAL_ROOT . '/includes/tablesort.inc';
require_once DRUPAL_ROOT . '/includes/file.inc';
require_once DRUPAL_ROOT . '/includes/unicode.inc';
require_once DRUPAL_ROOT . '/includes/image.inc';
require_once DRUPAL_ROOT . '/includes/form.inc';
require_once DRUPAL_ROOT . '/includes/mail.inc';
require_once DRUPAL_ROOT . '/includes/actions.inc';
// Set the Drupal custom error handler.
set_error_handler('drupal_error_handler');
// Emit the correct charset HTTP header.
Expand Down
7 changes: 3 additions & 4 deletions includes/database/database.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// $Id: database.inc,v 1.5 2008-09-19 08:18:35 dries Exp $
// $Id: database.inc,v 1.6 2008-09-20 20:22:24 webchick Exp $

/**
* @file
Expand Down Expand Up @@ -825,8 +825,7 @@ abstract class Database {
// We cannot rely on the registry yet, because the registry requires
// an open database connection.
$driver_class = 'DatabaseConnection_' . $driver;
$driver_file = './includes/database/' . $driver . '/database.inc';
require_once($driver_file);
require_once DRUPAL_ROOT . '/includes/database/' . $driver . '/database.inc';
self::$connections[$key][$target] = new $driver_class(self::$databaseInfo[$key][$target]);

// We need to pass around the simpletest database prefix in the request
Expand Down Expand Up @@ -1809,7 +1808,7 @@ function db_result(DatabaseStatement $statement) {

function _db_need_install() {
if (!function_exists('install_goto')) {
include_once 'includes/install.inc';
include_once DRUPAL_ROOT . '/includes/install.inc';
install_goto('install.php');
}
}
Expand Down
4 changes: 2 additions & 2 deletions includes/form.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// $Id: form.inc,v 1.285 2008-09-20 16:10:29 webchick Exp $
// $Id: form.inc,v 1.286 2008-09-20 20:22:23 webchick Exp $

/**
* @defgroup forms Form builder functions
Expand Down Expand Up @@ -2504,7 +2504,7 @@ function batch_process($redirect = NULL, $url = NULL) {
else {
// Non-progressive execution: bypass the whole progressbar workflow
// and execute the batch in one pass.
require_once './includes/batch.inc';
require_once DRUPAL_ROOT . '/includes/batch.inc';
_batch_process();
}
}
Expand Down
Loading

0 comments on commit 50c5e90

Please sign in to comment.