Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/200821

Change subject: Cut down on file stat time in resource module safeFilemtime()
......................................................................

Cut down on file stat time in resource module safeFilemtime()

* If stat cache is not enabled, this used to do two queries

Change-Id: Icfed675b27f952ec13b9d0af3e345b1486ea7c8f
---
M includes/resourceloader/ResourceLoaderModule.php
1 file changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/21/200821/1

diff --git a/includes/resourceloader/ResourceLoaderModule.php 
b/includes/resourceloader/ResourceLoaderModule.php
index d689044..572428e 100644
--- a/includes/resourceloader/ResourceLoaderModule.php
+++ b/includes/resourceloader/ResourceLoaderModule.php
@@ -636,9 +636,10 @@
         * @return int UNIX timestamp
         */
        protected static function safeFilemtime( $filename ) {
-               if ( !file_exists( $filename ) ) {
-                       return 1;
-               }
-               return filemtime( $filename );
+               wfSuppressWarnings();
+               $mtime = filemtime( $filename ) ?: 1;
+               wfRestoreWarnings();
+
+               return $mtime;
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/200821
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icfed675b27f952ec13b9d0af3e345b1486ea7c8f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to