mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
NEW Performance enhancement: Replace dirname(__FILE__) with __DIR__
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Convert a page content to have correct links (based on DOL_URL_ROOT) into an html content.
|
||||
* Used to ouput the page on the Preview from backoffice.
|
||||
@@ -661,7 +660,7 @@ function dolSavePageContent($filetpl, $object, $objectpage)
|
||||
|
||||
$tplcontent ='';
|
||||
$tplcontent.= "<?php // BEGIN PHP\n";
|
||||
$tplcontent.= '$websitekey=basename(dirname(__FILE__)); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
|
||||
$tplcontent.= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
|
||||
$tplcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
@@ -731,7 +730,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
|
||||
dol_delete_file($fileindex);
|
||||
$indexcontent = '<?php'."\n";
|
||||
$indexcontent.= "// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n";
|
||||
$indexcontent.= '$websitekey=basename(dirname(__FILE__)); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
|
||||
$indexcontent.= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
|
||||
$indexcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
|
||||
$indexcontent.= 'if (! empty($_GET[\'pageref\']) || ! empty($_GET[\'pagealiasalt\']) || ! empty($_GET[\'pageid\'])) {'."\n";
|
||||
$indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* \brief Common load of data
|
||||
*/
|
||||
|
||||
require_once realpath(dirname(__FILE__)).'/../main.inc.php';
|
||||
require_once realpath(__DIR__).'/../main.inc.php';
|
||||
if (! class_exists('Holiday')) {
|
||||
require_once DOL_DOCUMENT_ROOT. '/holiday/class/holiday.class.php';
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ if (! $versionfrom && ! $versionto)
|
||||
// Test if batch mode
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path=__DIR__.'/';
|
||||
if (substr($sapi_type, 0, 3) == 'cli')
|
||||
{
|
||||
print 'Syntax from command line: '.$script_file." x.y.z a.b.c\n";
|
||||
|
||||
@@ -96,7 +96,7 @@ if ((! $versionfrom || preg_match('/version/', $versionfrom)) && (! $versionto |
|
||||
// Test if batch mode
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path=__DIR__.'/';
|
||||
if (substr($sapi_type, 0, 3) == 'cli')
|
||||
{
|
||||
print 'Syntax from command line: '.$script_file." x.y.z a.b.c [MAIN_MODULE_NAME1_TO_ENABLE,MAIN_MODULE_NAME2_TO_ENABLE...]\n";
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path=__DIR__.'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
|
||||
@@ -920,7 +920,7 @@ if ($action == 'updatecss')
|
||||
|
||||
/* We disable php code since htmlheader is never executed as an include but only read by fgets_content.
|
||||
$htmlheadercontent.= "<?php // BEGIN PHP\n";
|
||||
$htmlheadercontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$htmlheadercontent.= '$websitekey=basename(__DIR__);'."\n";
|
||||
$htmlheadercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
@@ -943,8 +943,8 @@ if ($action == 'updatecss')
|
||||
$csscontent ='';
|
||||
|
||||
$csscontent.= "<?php // BEGIN PHP\n";
|
||||
$csscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$csscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
|
||||
$csscontent.= '$websitekey=basename(__DIR__);'."\n";
|
||||
$csscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once __DIR__.'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
|
||||
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$csscontent.= "ob_start();\n";
|
||||
@@ -976,8 +976,8 @@ if ($action == 'updatecss')
|
||||
$jscontent ='';
|
||||
|
||||
$jscontent.= "<?php // BEGIN PHP\n";
|
||||
$jscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$jscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
|
||||
$jscontent.= '$websitekey=basename(__DIR__);'."\n";
|
||||
$jscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once __DIR__.'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
|
||||
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$jscontent.= "ob_start();\n";
|
||||
@@ -1009,7 +1009,7 @@ if ($action == 'updatecss')
|
||||
$robotcontent ='';
|
||||
|
||||
/*$robotcontent.= "<?php // BEGIN PHP\n";
|
||||
$robotcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$robotcontent.= '$websitekey=basename(__DIR__);'."\n";
|
||||
$robotcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
@@ -1042,7 +1042,7 @@ if ($action == 'updatecss')
|
||||
$htaccesscontent ='';
|
||||
|
||||
/*$htaccesscontent.= "<?php // BEGIN PHP\n";
|
||||
$htaccesscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$htaccesscontent.= '$websitekey=basename(__DIR__);'."\n";
|
||||
$htaccesscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$htaccesscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$htaccesscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
// BEGIN PHP File wrapper.php - DO NOT MODIFY - It is just a copy of wrapper.html sample.
|
||||
$websitekey=basename(dirname(__FILE__));
|
||||
$websitekey=basename(__DIR__);
|
||||
if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user