jenkins-bot has submitted this change and it was merged.

Change subject: ResourceLoaderStartUpModule: Improve comment about modifiedTime 
hack
......................................................................


ResourceLoaderStartUpModule: Improve comment about modifiedTime hack

* Re-ordering code to bring the modifiedTime hack and the
  loop it serves closer together.
* Separating the fact that it needs a value and the mtime of
  startup.js since that is just one of the three factors we use.
  This way it's clearer that the startup.js mtime is not just a
  bogus value, but not more or less important than wgCacheEpoch
  and modules mtime either.
* Remove duplicate '/* Methods */' comment, we already have this
  marker a few methods higher up.

Change-Id: Id3a07f02566c0f04b612b81f8353f70fa4ab3977
---
M includes/resourceloader/ResourceLoaderStartUpModule.php
1 file changed, 11 insertions(+), 5 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php 
b/includes/resourceloader/ResourceLoaderStartUpModule.php
index 3482bfa..a551c4a 100644
--- a/includes/resourceloader/ResourceLoaderStartUpModule.php
+++ b/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -276,20 +276,26 @@
                $loader = $context->getResourceLoader();
                $loader->preloadModuleInfo( $loader->getModuleNames(), $context 
);
 
-               $this->modifiedTime[$hash] = filemtime( 
"$IP/resources/startup.js" );
-               // ATTENTION!: Because of the line above, this is not going to 
cause
+               $time = max(
+                       wfTimestamp( TS_UNIX, $wgCacheEpoch ),
+                       filemtime( "$IP/resources/startup.js" )
+               );
+
+               // ATTENTION!: Because of the line below, this is not going to 
cause
                // infinite recursion - think carefully before making changes 
to this
                // code!
-               $time = wfTimestamp( TS_UNIX, $wgCacheEpoch );
+               // Pre-populate modifiedTime with something because the the 
loop over
+               // all modules below includes the the startup module (this 
module).
+               $this->modifiedTime[$hash] = 1;
+
                foreach ( $loader->getModuleNames() as $name ) {
                        $module = $loader->getModule( $name );
                        $time = max( $time, $module->getModifiedTime( $context 
) );
                }
+
                $this->modifiedTime[$hash] = $time;
                return $this->modifiedTime[$hash];
        }
-
-       /* Methods */
 
        /**
         * @return string

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id3a07f02566c0f04b612b81f8353f70fa4ab3977
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to