(bug 27302) Avoid unnecessary requests for user and site modules if the relevant...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sat, 19 Feb 2011 17:07:05 +0000 (17:07 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sat, 19 Feb 2011 17:07:05 +0000 (17:07 +0000)
commit880f09b10c0fe7016117aadae6926af2e3062f60
treed41591cf2754291bca39477f96f4e15caa171544
parentb99862f3f5f4ba03ade952d94ddeaa9bb60a4dc0
(bug 27302) Avoid unnecessary requests for user and site modules if the relevant wiki pages don't exist.

Done by adding isKnownEmpty() to ResourceLoaderModule and overriding it to check for page existence in ResourceLoaderWikiModule. Needed to rearrange some code in OutputPage::makeResourceLoaderLink() to have the emptiness check and dropping of modules work properly. Also factored the page_touched check in ResourceLoaderWikiModule::getModifiedTime() out to a separate method (getTitleMtimes()) and moved in-object caching there as well, so getModifiedTime() and isKnownEmpty() share code and caching for their timestamp/existence checks.

This does not account for the case where e.g. a user has user CSS but no user JS: I had implemented this by checking for $context->getOnly() in getTitleMtimes(), but then realized it's not safe to do this in a function called by getModifiedTime(): it causes the timestamp list in the startup module to only take scripts in account for wiki modules, because the startup module has &only=scripts set
includes/OutputPage.php
includes/resourceloader/ResourceLoaderModule.php
includes/resourceloader/ResourceLoaderWikiModule.php