jenkins-bot has submitted this change and it was merged.
Change subject: Use enableModuleContentVersion() in
ResourceLoaderProjectIconsModule
......................................................................
Use enableModuleContentVersion() in ResourceLoaderProjectIconsModule
* Last year, getModifiedTime() was deprecated in favour of getModifiedHash().
ResourceLoader now uses hashes instead of timestamps.
Timestamps can easily be hashed, but the other way is around is much harder
and required hacks like here in ResourceLoaderProjectIconsModule where
we track in ObjectCache when we first saw a hash.
* Since then, getModifiedHash() was also deprecated in favour of the more
generic getDefinitionSummary(). We could use that here and simply append
the result of getData().
* Instead of that, make use of the new enableModuleContentVersion() method,
which hashes the result of getStyles() directly.
This also improves performance a little by not requiring getData() to be
computed twice (once for the module content, and again for the version header).
Instead, the in-object cache from getModuleContent() will provide both.
Change-Id: I97bdf373d94685c1b6e5e40a0f41a1cc0e7f030f
---
M ResourceLoaderProjectIconsModule.php
M resources/js/ext.translate.mainpage.js
2 files changed, 4 insertions(+), 20 deletions(-)
Approvals:
Nikerabbit: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ResourceLoaderProjectIconsModule.php
b/ResourceLoaderProjectIconsModule.php
index 926fcb2..9b80382 100644
--- a/ResourceLoaderProjectIconsModule.php
+++ b/ResourceLoaderProjectIconsModule.php
@@ -69,24 +69,8 @@
return [ 'all' => $out ];
}
- public function getModifiedTime( ResourceLoaderContext $context ) {
- $cache = wfGetCache( CACHE_ANYTHING );
- $key = wfMemcKey( 'resourceloader', 'twnmainpage', 'icons' );
-
- $data = $this->getData();
- $hash = md5( serialize( $data ) );
-
- $result = $cache->get( $key );
- if ( is_array( $result ) && $result['hash'] === $hash ) {
- return $result['timestamp'];
- }
- $timestamp = time();
- $cache->set( $key, [
- 'hash' => $hash,
- 'timestamp' => $timestamp,
- ] );
-
- return $timestamp;
+ public function enableModuleContentVersion() {
+ return true;
}
public function getType() {
diff --git a/resources/js/ext.translate.mainpage.js
b/resources/js/ext.translate.mainpage.js
index 78d68e3..ae3e7ac 100644
--- a/resources/js/ext.translate.mainpage.js
+++ b/resources/js/ext.translate.mainpage.js
@@ -189,6 +189,6 @@
$( '.tux-groupselector' ).addClass( 'removecallout' );
}
- $( document ).ready( setupStatsTiles );
- $( document ).ready( setupProjectTiles );
+ $( setupStatsTiles );
+ $( setupProjectTiles );
}( jQuery, mediaWiki ) );
--
To view, visit https://gerrit.wikimedia.org/r/306138
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I97bdf373d94685c1b6e5e40a0f41a1cc0e7f030f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TwnMainPage
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits