From: Aaron Schulz Date: Tue, 31 Mar 2015 08:15:57 +0000 (-0700) Subject: Rely less on file stat cache in FileDependency X-Git-Tag: 1.31.0-rc.0~11922 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=061904a913db144b1d81835b37896cec6a7e5e6d;p=lhc%2Fweb%2Fwiklou.git Rely less on file stat cache in FileDependency Change-Id: Ica16ddb7db00a56a16332c4dbb9a04e7b40a1844 --- diff --git a/includes/cache/CacheDependency.php b/includes/cache/CacheDependency.php index 9b48ecb737..517f37984c 100644 --- a/includes/cache/CacheDependency.php +++ b/includes/cache/CacheDependency.php @@ -181,13 +181,11 @@ class FileDependency extends CacheDependency { function loadDependencyValues() { if ( is_null( $this->timestamp ) ) { - if ( !file_exists( $this->filename ) ) { - # Dependency on a non-existent file - # This is a valid concept! - $this->timestamp = false; - } else { - $this->timestamp = filemtime( $this->filename ); - } + wfSuppressWarnings(); + # Dependency on a non-existent file stores "false" + # This is a valid concept! + $this->timestamp = filemtime( $this->filename ); + wfRestoreWarnings(); } } @@ -195,7 +193,10 @@ class FileDependency extends CacheDependency { * @return bool */ function isExpired() { - if ( !file_exists( $this->filename ) ) { + wfSuppressWarnings(); + $lastmod = filemtime( $this->filename ); + wfRestoreWarnings(); + if ( $lastmod === false ) { if ( $this->timestamp === false ) { # Still nonexistent return false; @@ -206,7 +207,6 @@ class FileDependency extends CacheDependency { return true; } } else { - $lastmod = filemtime( $this->filename ); if ( $lastmod > $this->timestamp ) { # Modified or created wfDebug( "Dependency triggered: {$this->filename} changed.\n" );