r108147 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108146‎ | r108147 | r108148 >
Date:16:14, 5 January 2012
Author:bawolff
Status:resolved (Comments)
Tags:
Comment:
(bug 33456) show $wgQueryCacheLimit on cached query pages, so users know that the results are artificially cut off, and its not just that there is only 1000 wanted files (or whatever else) on the wiki.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/QueryPage.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesQqq.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -116,6 +116,7 @@
117117 Enable by setting $wgEnableJavaScriptTest to true.
118118 * Extensions can use the RequestContextCreateSkin hook to override what skin is
119119 loaded in some contexts.
 120+* (bug 33456) Show $wgQueryCacheLimit on cached query pages.
120121
121122 === Bug fixes in 1.19 ===
122123 * $wgUploadNavigationUrl should be used for file redlinks if.
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -999,8 +999,8 @@
10001000 'badtitle' => 'Bad title',
10011001 'badtitletext' => 'The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title.
10021002 It may contain one or more characters which cannot be used in titles.',
1003 -'perfcached' => 'The following data is cached and may not be up to date.',
1004 -'perfcachedts' => 'The following data is cached, and was last updated $1.',
 1003+'perfcached' => 'The following data is cached and may not be up to date. A maximum of $1 results are available in the cache.',
 1004+'perfcachedts' => 'The following data is cached, and was last updated $1. A maximum of $4 results are available in the cache.',
10051005 'querypage-no-updates' => 'Updates for this page are currently disabled.
10061006 Data here will not presently be refreshed.',
10071007 'wrong_wfQuery_params' => 'Incorrect parameters to wfQuery()<br />
Index: trunk/phase3/languages/messages/MessagesQqq.php
@@ -655,10 +655,12 @@
656656 * $1 is the page name',
657657 'badtitle' => 'The page title when a user requested a page with invalid page name. The content will be {{msg-mw|badtitletext}}.',
658658 'badtitletext' => 'The message shown when a user requested a page with invalid page name. The page title will be {{msg-mw|badtitle}}.',
 659+'perfcached' => 'Like {{msg-mw|perfcachedts}} but used when we do not know how long ago page was cached (unlikely to happen). $1 is the max result cut off ($wgQueryCacheLimit)',
659660 'perfcachedts' => 'Used on pages that list page lists for which the displayed data is cached. Parameters:
660661 * $1 is a time stamp (date and time combined)
661662 * $2 is a date (optional)
662 -* $3 is a time (optional)',
 663+* $3 is a time (optional)
 664+* $4 is the cut off limit for cached results ($wgQueryCacheLimit). If there are more then this many results for the query, only the first $4 of those will be listed on the page. Usually $4 is about 1000.',
663665 'querypage-no-updates' => 'Text on some special pages, e.g. [[Special:FewestRevisions]].',
664666 'viewsource' => 'The text displayed in place of the "edit" tab when the user has no permission to edit the page.
665667
Index: trunk/phase3/includes/QueryPage.php
@@ -437,6 +437,7 @@
438438 * real, honest-to-gosh query page.
439439 */
440440 function execute( $par ) {
 441+ global $wgQueryCacheLimit;
441442 if ( !$this->userCanExecute( $this->getUser() ) ) {
442443 $this->displayRestrictionError();
443444 return;
@@ -468,17 +469,18 @@
469470
470471 # Fetch the timestamp of this update
471472 $ts = $this->getCachedTimestamp();
 473+ $lang = $this->getLanguage();
 474+ $maxResults = $lang->formatNum( $wgQueryCacheLimit );
472475
473476 if ( $ts ) {
474 - $lang = $this->getLanguage();
475477 $updated = $lang->timeanddate( $ts, true, true );
476478 $updateddate = $lang->date( $ts, true, true );
477479 $updatedtime = $lang->time( $ts, true, true );
478480 $out->addMeta( 'Data-Cache-Time', $ts );
479481 $out->addInlineScript( "var dataCacheTime = '$ts';" );
480 - $out->addWikiMsg( 'perfcachedts', $updated, $updateddate, $updatedtime );
 482+ $out->addWikiMsg( 'perfcachedts', $updated, $updateddate, $updatedtime, $maxResults );
481483 } else {
482 - $out->addWikiMsg( 'perfcached' );
 484+ $out->addWikiMsg( 'perfcached', $maxResults );
483485 }
484486
485487 # If updates on this page have been disabled, let the user know

Follow-up revisions

RevisionCommit summaryAuthorDate
r108154Follow-up r108147. PLURAL in message.bawolff17:56, 5 January 2012

Comments

#Comment by Siebrand (talk | contribs)   17:49, 5 January 2012
+'perfcached'           => 'The following data is cached and may not be up to date. A maximum of $1 results are available in the cache.',
+'perfcachedts'         => 'The following data is cached, and was last updated $1. A maximum of $4 results are available in the cache.',
  • Dates in sentences should be split in day and time
  • numbers should use {{plural}}
#Comment by Bawolff (talk | contribs)   17:57, 5 January 2012

The message already provides $2 and $3 for the day and time independently. I didn't really think about plural because it would be insane for that number to be 1 (yeah i know, other langs have different plural rules), but added in r108154

Status & tagging log