summaryrefslogtreecommitdiff
path: root/inc/init.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2008-12-13 09:33:55 +0100
committerAndreas Gohr <andi@splitbrain.org>2008-12-13 09:33:55 +0100
commitb328697d6cc1b17e86d7f66267b2eda69be318a5 (patch)
treecc36d04e85c39c184094935f4836a33db85da041 /inc/init.php
parent58e3a7bfa7f0c76b0f4131110c36536ecd16c313 (diff)
downloadrpg-b328697d6cc1b17e86d7f66267b2eda69be318a5.tar.gz
rpg-b328697d6cc1b17e86d7f66267b2eda69be318a5.tar.bz2
don't check for file existance in fullpath() by default
In most (all) calls to fullpath() the existance of the resulting path is not important or is checked externally, so checking inside fullpath() is a waste of CPU cycles. darcs-hash:20081213083355-7ad00-4987a85950a13e5d3c527b3b17b1092e0fa1c567.gz
Diffstat (limited to 'inc/init.php')
-rw-r--r--inc/init.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/inc/init.php b/inc/init.php
index 8d094ef66..b70dbabe9 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -464,7 +464,7 @@ EOT;
* @author <richpageau at yahoo dot co dot uk>
* @link http://de3.php.net/manual/en/function.realpath.php#75992
*/
-function fullpath($path){
+function fullpath($path,$exists=false){
static $run = 0;
$root = '';
$iswin = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' || $GLOBALS['DOKU_UNITTEST_ASSUME_WINDOWS']);
@@ -490,7 +490,7 @@ function fullpath($path){
$path = $base.'/'.$path;
if($run == 0){ // avoid endless recursion when base isn't absolute for some reason
$run++;
- return fullpath($path,1);
+ return fullpath($path,$exists);
}
}
$run = 0;
@@ -508,8 +508,8 @@ function fullpath($path){
}
$finalpath = $root.implode('/', $newpath);
- // check for existance (except when unit testing)
- if(!defined('DOKU_UNITTEST') && !@file_exists($finalpath)) {
+ // check for existance when needed (except when unit testing)
+ if($exists && !defined('DOKU_UNITTEST') && !@file_exists($finalpath)) {
return false;
}
return $finalpath;