Krinkle has uploaded a new change for review.

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

Change subject: ResourceLoaderSchemaModule: Use definition hash instead of fake 
timestamp
......................................................................

ResourceLoaderSchemaModule: Use definition hash instead of fake timestamp

Bug: T94059
Change-Id: I26f9ab09fc7ee1e5330315f7b9e3d290eff5d79f
---
M includes/ResourceLoaderSchemaModule.php
1 file changed, 18 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EventLogging 
refs/changes/28/200028/1

diff --git a/includes/ResourceLoaderSchemaModule.php 
b/includes/ResourceLoaderSchemaModule.php
index 88fd46f..686e5ad 100644
--- a/includes/ResourceLoaderSchemaModule.php
+++ b/includes/ResourceLoaderSchemaModule.php
@@ -67,31 +67,30 @@
 
 
        /**
-        * Gets the last modified timestamp of this module.
+        * Get the last modified timestamp of this module.
+        *
         * The last modified timestamp controls caching. Because revisions are
-        * immutable, we don't need to get the revision's timestamp. We
-        * simply return a timestamp of 1 (one second past epoch) if we were
-        * unable to retrieve the schema, or the revision id if successful.
-        * This ensures that clients will retrieve the schema when it becomes
-        * available.
+        * immutable, we don't need to fetch the RemoteSchema, nor get the 
revision's
+        * timestamp. We simply hash our module definition.
+        *
         * @param ResourceLoaderContext $context
         * @return integer: Unix timestamp.
         */
        function getModifiedTime( ResourceLoaderContext $context ) {
-               global $wgCacheEpoch;
+               return $this->getDefinitionMtime( $context );
+       }
 
-               $unixTimeCacheEpoch = wfTimestamp( TS_UNIX, $wgCacheEpoch );
-               if ( $this->schema->get() ) {
-                       // ResourceLoader will set the module's modification 
time to be
-                       // either the value returned by this method, or the 
Unix time
-                       // number of $wgCacheEpoch, whichever is greater. To 
ensure that
-                       // the modification time is always updated whenever the 
schema
-                       // revision changes, we add the revision ID to the Unix 
time number
-                       // of $wgCacheEpoch.
-                       return $unixTimeCacheEpoch + $this->schema->revision;
-               } else {
-                       return 1;
-               }
+       /**
+        * Get the definition summary for this module.
+        *
+        * @param ResourceLoaderContext $context
+        * @return array
+        */
+       public function getDefinitionSummary( ResourceLoaderContext $context ) {
+               return array(
+                       'class' => get_class( $this ),
+                       'revision' => $this->schema->revision,
+               );
        }
 
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I26f9ab09fc7ee1e5330315f7b9e3d290eff5d79f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to