Hoo man has uploaded a new change for review.

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


Change subject: Don't cache the gadget-defintion in case no gadgets were found
......................................................................

Don't cache the gadget-defintion in case no gadgets were found

After some investigation I could only find a few unlike
possibilities which eventually could lead to the issues
described in the bug. In the end I decided that it would
be the easiest and probably most robust solution to simply
don't cache in case no gadgets were found, even if the
MediaWiki page exists.
This shouldn't cause any performance issues as we already
don't cache in case no gadgets could be found in all paths
of this function except after trying to parse the gadget
definition.

Bug: 37228
Change-Id: I3092bcb162d032282fbe263c7f14f4d1ce9163ab
---
M Gadgets_body.php
1 file changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gadgets 
refs/changes/17/73617/1

diff --git a/Gadgets_body.php b/Gadgets_body.php
index e787062..c7e23bf 100644
--- a/Gadgets_body.php
+++ b/Gadgets_body.php
@@ -614,6 +614,13 @@
                        }
                }
 
+               if ( !count( $gadgets ) ) {
+                       // Don't cache in case we couldn't find any gadgets. 
Bug 37228
+                       $gadgets = false;
+                       wfProfileOut( __METHOD__ );
+                       return $gadgets;
+               }
+
                // cache for a while. gets purged automatically when 
MediaWiki:Gadgets-definition is edited
                $wgMemc->set( $key, $gadgets, 60 * 60 * 24 );
                $source = $forceNewText !== null ? 'input text' : 
'MediaWiki:Gadgets-definition';

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3092bcb162d032282fbe263c7f14f4d1ce9163ab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gadgets
Gerrit-Branch: master
Gerrit-Owner: Hoo man <h...@online.de>

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

Reply via email to