diff options
author | Andreas Gohr <gohr@cosmocode.de> | 2015-01-07 10:47:45 +0100 |
---|---|---|
committer | Andreas Gohr <gohr@cosmocode.de> | 2015-01-07 10:47:45 +0100 |
commit | 79e79377626799a77c11aa7849cb9c64305590c8 (patch) | |
tree | 0d359f6b0985fd29f2c854d232578881e636b8c1 /lib | |
parent | cb339ea7ee2b684b0fd0fb948681c66b76a0b4e1 (diff) | |
download | rpg-79e79377626799a77c11aa7849cb9c64305590c8.tar.gz rpg-79e79377626799a77c11aa7849cb9c64305590c8.tar.bz2 |
Remove error supression for file_exists()
In an older version of PHP a file_exists() call would issue a warning
when the file did not exist. This was fixed in later PHP releases. Since
we require PHP 5.3 now, there's no need to supress any error here
anymore. This might even give a minor performance boost.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/exe/css.php | 6 | ||||
-rw-r--r-- | lib/exe/detail.php | 2 | ||||
-rw-r--r-- | lib/exe/indexer.php | 4 | ||||
-rw-r--r-- | lib/exe/js.php | 12 | ||||
-rw-r--r-- | lib/plugins/authplain/auth.php | 2 | ||||
-rw-r--r-- | lib/plugins/config/admin.php | 4 | ||||
-rw-r--r-- | lib/plugins/config/settings/config.class.php | 16 | ||||
-rw-r--r-- | lib/plugins/config/settings/extra.class.php | 2 | ||||
-rw-r--r-- | lib/plugins/extension/helper/extension.php | 8 | ||||
-rw-r--r-- | lib/plugins/popularity/admin.php | 2 | ||||
-rw-r--r-- | lib/plugins/popularity/helper.php | 2 |
11 files changed, 30 insertions, 30 deletions
diff --git a/lib/exe/css.php b/lib/exe/css.php index b1065f518..e0bc68312 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -365,11 +365,11 @@ function css_interwiki(){ $iwlinks = getInterwiki(); foreach(array_keys($iwlinks) as $iw){ $class = preg_replace('/[^_\-a-z0-9]+/i','_',$iw); - if(@file_exists(DOKU_INC.'lib/images/interwiki/'.$iw.'.png')){ + if(file_exists(DOKU_INC.'lib/images/interwiki/'.$iw.'.png')){ echo "a.iw_$class {"; echo ' background-image: url('.DOKU_BASE.'lib/images/interwiki/'.$iw.'.png)'; echo '}'; - }elseif(@file_exists(DOKU_INC.'lib/images/interwiki/'.$iw.'.gif')){ + }elseif(file_exists(DOKU_INC.'lib/images/interwiki/'.$iw.'.gif')){ echo "a.iw_$class {"; echo ' background-image: url('.DOKU_BASE.'lib/images/interwiki/'.$iw.'.gif)'; echo '}'; @@ -451,7 +451,7 @@ class DokuCssFile { * @return string the CSS/Less contents of the file */ public function load($location='') { - if (!@file_exists($this->filepath)) return ''; + if (!file_exists($this->filepath)) return ''; $css = io_readFile($this->filepath); if (!$location) return $css; diff --git a/lib/exe/detail.php b/lib/exe/detail.php index cc29d5b87..ec1a9b874 100644 --- a/lib/exe/detail.php +++ b/lib/exe/detail.php @@ -37,7 +37,7 @@ $AUTH = auth_quickaclcheck($IMG); if($AUTH >= AUTH_READ){ // check if image exists $SRC = mediaFN($IMG,$REV); - if(!@file_exists($SRC)){ + if(!file_exists($SRC)){ //doesn't exist! http_status(404); $ERROR = 'File not found'; diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index 89c4b7cd0..330b8498d 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -68,9 +68,9 @@ function runTrimRecentChanges($media_changes = false) { // Trims the recent changes cache to the last $conf['changes_days'] recent // changes or $conf['recent'] items, which ever is larger. // The trimming is only done once a day. - if (@file_exists($fn) && + if (file_exists($fn) && (@filemtime($fn.'.trimmed')+86400)<time() && - !@file_exists($fn.'_tmp')) { + !file_exists($fn.'_tmp')) { @touch($fn.'.trimmed'); io_lock($fn); $lines = file($fn); diff --git a/lib/exe/js.php b/lib/exe/js.php index 793104e81..3f9781e34 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -160,7 +160,7 @@ function js_out(){ * @param string $file filename path to file */ function js_load($file){ - if(!@file_exists($file)) return; + if(!file_exists($file)) return; static $loaded = array(); $data = io_readFile($file); @@ -179,7 +179,7 @@ function js_load($file){ if($ifile{0} != '/') $ifile = dirname($file).'/'.$ifile; - if(@file_exists($ifile)){ + if(file_exists($ifile)){ $idata = io_readFile($ifile); }else{ $idata = ''; @@ -221,10 +221,10 @@ function js_pluginstrings() { $plugins = plugin_list(); foreach ($plugins as $p){ if (isset($lang)) unset($lang); - if (@file_exists(DOKU_PLUGIN."$p/lang/en/lang.php")) { + if (file_exists(DOKU_PLUGIN."$p/lang/en/lang.php")) { include DOKU_PLUGIN."$p/lang/en/lang.php"; } - if (isset($conf['lang']) && $conf['lang']!='en' && @file_exists(DOKU_PLUGIN."$p/lang/".$conf['lang']."/lang.php")) { + if (isset($conf['lang']) && $conf['lang']!='en' && file_exists(DOKU_PLUGIN."$p/lang/".$conf['lang']."/lang.php")) { include DOKU_PLUGIN."$p/lang/".$conf['lang']."/lang.php"; } if (isset($lang['js'])) { @@ -245,10 +245,10 @@ function js_pluginstrings() { function js_templatestrings() { global $conf; $templatestrings = array(); - if (@file_exists(tpl_incdir()."lang/en/lang.php")) { + if (file_exists(tpl_incdir()."lang/en/lang.php")) { include tpl_incdir()."lang/en/lang.php"; } - if (isset($conf['lang']) && $conf['lang']!='en' && @file_exists(tpl_incdir()."lang/".$conf['lang']."/lang.php")) { + if (isset($conf['lang']) && $conf['lang']!='en' && file_exists(tpl_incdir()."lang/".$conf['lang']."/lang.php")) { include tpl_incdir()."lang/".$conf['lang']."/lang.php"; } if (isset($lang['js'])) { diff --git a/lib/plugins/authplain/auth.php b/lib/plugins/authplain/auth.php index fd2d0b249..b31c02fc8 100644 --- a/lib/plugins/authplain/auth.php +++ b/lib/plugins/authplain/auth.php @@ -325,7 +325,7 @@ class auth_plugin_authplain extends DokuWiki_Auth_Plugin { $this->users = array(); - if(!@file_exists($config_cascade['plainauth.users']['default'])) return; + if(!file_exists($config_cascade['plainauth.users']['default'])) return; $lines = file($config_cascade['plainauth.users']['default']); foreach($lines as $line) { diff --git a/lib/plugins/config/admin.php b/lib/plugins/config/admin.php index 9202a221b..2ef570b68 100644 --- a/lib/plugins/config/admin.php +++ b/lib/plugins/config/admin.php @@ -282,7 +282,7 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { if ($plugin == '.' || $plugin == '..' || $plugin == 'tmp' || $plugin == 'config') continue; if (is_file(DOKU_PLUGIN.$plugin)) continue; - if (@file_exists(DOKU_PLUGIN.$plugin.$enlangfile)){ + if (file_exists(DOKU_PLUGIN.$plugin.$enlangfile)){ $lang = array(); @include(DOKU_PLUGIN.$plugin.$enlangfile); if ($conf['lang'] != 'en') @include(DOKU_PLUGIN.$plugin.$langfile); @@ -303,7 +303,7 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { // the same for the active template $tpl = $conf['template']; - if (@file_exists(tpl_incdir().$enlangfile)){ + if (file_exists(tpl_incdir().$enlangfile)){ $lang = array(); @include(tpl_incdir().$enlangfile); if ($conf['lang'] != 'en') @include(tpl_incdir().$langfile); diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php index 590631dae..56b9a918d 100644 --- a/lib/plugins/config/settings/config.class.php +++ b/lib/plugins/config/settings/config.class.php @@ -40,7 +40,7 @@ if (!class_exists('configuration')) { public function configuration($datafile) { global $conf, $config_cascade; - if (!@file_exists($datafile)) { + if (!file_exists($datafile)) { msg('No configuration metadata found at - '.htmlspecialchars($datafile),-1); return; } @@ -125,8 +125,8 @@ if (!class_exists('configuration')) { $file = end($this->_local_files); // backup current file (remove any existing backup) - if (@file_exists($file) && $backup) { - if (@file_exists($file.'.bak')) @unlink($file.'.bak'); + if (@file_exists$file) && $backup) { + if (@ffile_existsfile.'.bak')) @unlink($file.'.bak'); if (!io_rename($file, $file.'.bak')) return false; } @@ -191,7 +191,7 @@ if (!class_exists('configuration')) { if ($this->_format == 'php') { - if(@file_exists($file)){ + if(@fifile_existsile)){ $contents = @php_strip_whitespace($file); }else{ $contents = ''; @@ -281,7 +281,7 @@ if (!class_exists('configuration')) { $local = $this->_local_files[0]; if (!is_writable(dirname($local))) return true; - if (@file_exists($local) && !is_writable($local)) return true; + if (@filfile_existscal) && !is_writable($local)) return true; return false; } @@ -345,7 +345,7 @@ if (!class_exists('configuration')) { foreach ($this->get_plugin_list() as $plugin) { $plugin_dir = plugin_directory($plugin); - if (@file_exists(DOKU_PLUGIN.$plugin_dir.$file)){ + if (@filefile_exists_PLUGIN.$plugin_dir.$file)){ $meta = array(); @include(DOKU_PLUGIN.$plugin_dir.$file); @include(DOKU_PLUGIN.$plugin_dir.$class); @@ -360,7 +360,7 @@ if (!class_exists('configuration')) { } // the same for the active template - if (@file_exists(tpl_incdir().$file)){ + if (@file_file_existsncdir().$file)){ $meta = array(); @include(tpl_incdir().$file); @include(tpl_incdir().$class); @@ -388,7 +388,7 @@ if (!class_exists('configuration')) { foreach ($this->get_plugin_list() as $plugin) { $plugin_dir = plugin_directory($plugin); - if (@file_exists(DOKU_PLUGIN.$plugin_dir.$file)){ + if (@file_efile_existsLUGIN.$plugin_dir.$file)){ $conf = $this->_read_config(DOKU_PLUGIN.$plugin_dir.$file); foreach ($conf as $key => $value){ $default['plugin'.CM_KEYMARKER.$plugin.CM_KEYMARKER.$key] = $value; diff --git a/lib/plugins/config/settings/extra.class.php b/lib/plugins/config/settings/extra.class.php index 232a8177f..fd3a90e28 100644 --- a/lib/plugins/config/settings/extra.class.php +++ b/lib/plugins/config/settings/extra.class.php @@ -151,7 +151,7 @@ if (!class_exists('setting_im_convert')) { $value = is_null($this->_local) ? $this->_default : $this->_local; if ($value == $input) return false; - if ($input && !@file_exists($input)) { + if ($input && !file_exists($input)) { $this->_error = true; $this->_input = $input; return false; diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php index dfa624907..6c0946b09 100644 --- a/lib/plugins/extension/helper/extension.php +++ b/lib/plugins/extension/helper/extension.php @@ -707,7 +707,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { $plugin = null; foreach($plugin_types as $type) { - if(@file_exists($path.$type.'.php')) { + if(file_exists($path.$type.'.php')) { $plugin = plugin_load($type, $this->base); if ($plugin) break; } @@ -907,12 +907,12 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { // check to make sure we aren't overwriting anything $target = $target_base_dir.$item['base']; - if(!$overwrite && @file_exists($target)) { + if(!$overwrite && file_exists($target)) { // TODO remember our settings, ask the user to confirm overwrite continue; } - $action = @file_exists($target) ? 'update' : 'install'; + $action = file_exists($target) ? 'update' : 'install'; // copy action if($this->dircopy($item['tmp'], $target)) { @@ -1117,7 +1117,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { return $ok; } else { - $exists = @file_exists($dst); + $exists = file_exists($dst); if(!@copy($src, $dst)) return false; if(!$exists && !empty($conf['fperm'])) chmod($dst, $conf['fperm']); diff --git a/lib/plugins/popularity/admin.php b/lib/plugins/popularity/admin.php index bd2d090e1..ab569b8b4 100644 --- a/lib/plugins/popularity/admin.php +++ b/lib/plugins/popularity/admin.php @@ -87,7 +87,7 @@ class admin_plugin_popularity extends DokuWiki_Admin_Plugin { //If there was an error the last time we tried to autosubmit, warn the user if ( $this->helper->isAutoSubmitEnabled() ){ - if ( @file_exists($this->helper->autosubmitErrorFile) ){ + if ( file_exists($this->helper->autosubmitErrorFile) ){ echo $this->getLang('autosubmitError'); echo io_readFile( $this->helper->autosubmitErrorFile ); } diff --git a/lib/plugins/popularity/helper.php b/lib/plugins/popularity/helper.php index b4fb33b90..8673fb5af 100644 --- a/lib/plugins/popularity/helper.php +++ b/lib/plugins/popularity/helper.php @@ -78,7 +78,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { * @return boolean TRUE if we should send data once a month, FALSE otherwise */ function isAutoSubmitEnabled(){ - return @file_exists($this->autosubmitFile); + return file_exists($this->autosubmitFile); } /** |