Last modified: 2014-08-30 00:37:40 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T70488, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 68488 - ResourceLoaderWikiModule::isKnownEmpty does not check whether the page is empty
ResourceLoaderWikiModule::isKnownEmpty does not check whether the page is empty
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.24rc
All All
: Low enhancement (vote)
: 1.24.0 release
Assigned To: Kunal Mehta (Legoktm)
: performance
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-23 23:18 UTC by Kunal Mehta (Legoktm)
Modified: 2014-08-30 00:37 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2014-07-23 23:18:55 UTC
I noticed that even if I blank my common.js, a <script> tag is still added for it. 

ResourceLoaderWikiModule::isKnownEmpty() is just checking for page existence, not rev_len > 0.
Comment 1 Krinkle 2014-07-23 23:25:41 UTC
This is by design.

The main use (and currently only use) of this method is to determine whether to actually load a module that is specified to be hardcoded in the page without a version number / cache buster in the url. E.g. the 'site' module which is hardcoded in the html (dedicated request, not mw.loader.load).

If those modules are not configured (e.g. the wiki has these disabled via wg config), or not yet initialised (the wiki or user has no such page), then we exclude it from the html to save a useless http request.

Emptying the page means the structure is still there but (temporarily?) unused or disabled by users. In those cases we don't want to generate html with no <script src=".. modules=site"> in it as that would be be cached for 30 days (e.g. 'site' module in html for anonymous users). When the page is no longer empty, it would be missing from all cached pages.
Comment 2 Kunal Mehta (Legoktm) 2014-07-23 23:48:57 UTC
That seems reasonable for the site module and other modules in the MediaWiki: namespace, but I don't think it applies to the user module where we don't need to really worry about the 30 day cache. The use-case I'm imagining is where a user creates a common.js page, decides they don't need the JS anymore and then blanks it since they aren't a sysop and can't delete it. (There are about 6850 such pages on enwp).

Maybe the user module (and the ext.globalCssJs.user module) should override isKnownEmpty?
Comment 3 MZMcBride 2014-07-31 18:40:48 UTC
(In reply to Kunal Mehta (Legoktm) from comment #2)
> That seems reasonable for the site module and other modules in the
> MediaWiki: namespace, but I don't think it applies to the user module where
> we don't need to really worry about the 30 day cache. The use-case I'm
> imagining is where a user creates a common.js page, decides they don't need
> the JS anymore and then blanks it since they aren't a sysop and can't delete
> it. (There are about 6850 such pages on enwp).
> 
> Maybe the user module (and the ext.globalCssJs.user module) should override
> isKnownEmpty?

For purposes of clarity, does empty mean page.page_len == 0 or does empty mean there's no functional JavaScript/CSS (it's all comments or commented out code)?
Comment 4 Kunal Mehta (Legoktm) 2014-07-31 18:41:58 UTC
(In reply to MZMcBride from comment #3)
> For purposes of clarity, does empty mean page.page_len == 0 or does empty
> mean there's no functional JavaScript/CSS (it's all comments or commented
> out code)?

page.page_len == 0
Comment 5 Krinkle 2014-08-29 01:44:16 UTC
(In reply to Kunal Mehta (Legoktm) from comment #2)
> That seems reasonable for the site module and other modules in the
> MediaWiki: namespace, but I don't think it applies to the user module where
> we don't need to really worry about the 30 day cache. The use-case I'm
> imagining is where a user creates a common.js page, decides they don't need
> the JS anymore and then blanks it since they aren't a sysop and can't delete
> it. (There are about 6850 such pages on enwp).
> 
> Maybe the user module (and the ext.globalCssJs.user module) should override
> isKnownEmpty?

Yes. In that case we could do that. Plus, in that change, document in the main WikiModule class why that one only checks page existence.
Comment 6 Krinkle 2014-08-29 01:45:04 UTC
+performance; this'll save one or two http requests for logged-in users who created user scripts but blanked them.
Comment 7 Gerrit Notification Bot 2014-08-29 06:45:11 UTC
Change 157043 had a related patch set uploaded by Legoktm:
Check page_len in ResourceLoaderWikiModule::isKnownEmpty() for 'user' modules

https://gerrit.wikimedia.org/r/157043
Comment 8 Gerrit Notification Bot 2014-08-30 00:31:06 UTC
Change 157043 merged by jenkins-bot:
Check page_len in ResourceLoaderWikiModule::isKnownEmpty() for 'user' modules

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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links