From 4351f7cd661391aa46c17c1107b6bddf31f25c5b Mon Sep 17 00:00:00 2001 From: alecpl Date: Wed, 20 Apr 2011 13:58:21 +0000 Subject: - Improve performance by including files with absolute path (#1487849) --- program/include/clisetup.php | 2 +- program/include/iniset.php | 9 ++++----- program/include/main.inc | 23 ++++++++++------------- program/include/rcmail.php | 2 +- program/include/rcube_mdb2.php | 2 +- 5 files changed, 17 insertions(+), 21 deletions(-) (limited to 'program/include') diff --git a/program/include/clisetup.php b/program/include/clisetup.php index d92c544c5..7a818110e 100644 --- a/program/include/clisetup.php +++ b/program/include/clisetup.php @@ -23,7 +23,7 @@ if (php_sapi_name() != 'cli') { die('Not on the "shell" (php-cli).'); } -require_once 'iniset.php'; +require_once INSTALL_PATH . 'program/include/iniset.php'; /** diff --git a/program/include/iniset.php b/program/include/iniset.php index a6c4666d7..11e6d54b5 100755 --- a/program/include/iniset.php +++ b/program/include/iniset.php @@ -57,10 +57,9 @@ if (!defined('PATH_SEPARATOR')) { // RC include folders MUST be included FIRST to avoid other // possible not compatible libraries (i.e PEAR) to be included // instead the ones provided by RC -$include_path = INSTALL_PATH . PATH_SEPARATOR; -$include_path.= INSTALL_PATH . 'program' . PATH_SEPARATOR; -$include_path.= INSTALL_PATH . 'program/lib' . PATH_SEPARATOR; +$include_path = INSTALL_PATH . 'program' . PATH_SEPARATOR; $include_path.= INSTALL_PATH . 'program/include' . PATH_SEPARATOR; +$include_path.= INSTALL_PATH . 'program/lib' . PATH_SEPARATOR; $include_path.= ini_get('include_path'); if (set_include_path($include_path) === false) { @@ -133,5 +132,5 @@ function rcube_pear_error($err) PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error'); // include global functions -require_once 'include/main.inc'; -require_once 'include/rcube_shared.inc'; +require_once INSTALL_PATH . 'program/include/main.inc'; +require_once INSTALL_PATH . 'program/include/rcube_shared.inc'; diff --git a/program/include/main.inc b/program/include/main.inc index 54ce67d00..c13d91ffa 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -26,11 +26,8 @@ * @author Thomas Bruederli */ -require_once('lib/utf7.inc'); -require_once('include/rcube_shared.inc'); - -// fallback if not PHP modules are available -@include_once('lib/utf8.class.php'); +require_once 'lib/utf7.inc'; +require_once INSTALL_PATH . 'program/include/rcube_shared.inc'; // define constannts for input reading define('RCUBE_INPUT_GET', 0x0101); @@ -290,7 +287,7 @@ function rcube_charset_convert($str, $from, $to=NULL) } $error = true; } - + // encode string for output if ($from == 'UTF-8') { // @TODO: we need a function for UTF-7 (RFC2152) conversion @@ -312,7 +309,7 @@ function rcube_charset_convert($str, $from, $to=NULL) } $error = true; } - + // report error if ($error && !$convert_warning) { raise_error(array( @@ -322,10 +319,10 @@ function rcube_charset_convert($str, $from, $to=NULL) 'line' => __LINE__, 'message' => "Could not convert string from $from to $to. Make sure iconv/mbstring is installed or lib/utf8.class is available." ), true, false); - + $convert_warning = true; } - + // return UTF-8 or original string return $str; } @@ -1975,14 +1972,14 @@ function rcube_timer() function rcube_print_time($timer, $label='Timer', $dest='console') { static $print_count = 0; - + $print_count++; $now = rcube_timer(); $diff = $now-$timer; - + if (empty($label)) $label = 'Timer '.$print_count; - + write_log($dest, sprintf("%s: %0.4f sec", $label, $diff)); } @@ -2013,7 +2010,7 @@ function raise_error($arg=array(), $log=false, $terminate=false) if ($terminate) { $ERROR_CODE = $arg['code']; $ERROR_MESSAGE = $arg['message']; - include('program/steps/utils/error.inc'); + include INSTALL_PATH . 'program/steps/utils/error.inc'; exit; } } diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 17b82198c..122dbefdd 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1343,7 +1343,7 @@ class rcmail $rcmail = rcmail::get_instance(); $convert = $rcmail->config->get('im_convert_path', false); $identify = $rcmail->config->get('im_identify_path', false); - + // imagemagick is required for this if (!$convert) return false; diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php index 707bce027..f58c32b17 100644 --- a/program/include/rcube_mdb2.php +++ b/program/include/rcube_mdb2.php @@ -724,7 +724,7 @@ class rcube_mdb2 */ private function _sqlite_prepare() { - include_once('include/rcube_sqlite.inc'); + include_once(INSTALL_PATH . 'program/include/rcube_sqlite.inc'); // we emulate via callback some missing MySQL function sqlite_create_function($this->db_handle->connection, -- cgit v1.2.3