r107366 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107365‎ | r107366 | r107367 >
Date:07:31, 27 December 2011
Author:bawolff
Status:deferred
Tags:
Comment:
follow-up r107363. Spelling mistake in messages and comments + add one wfProfileIn/wfProfileOut
Modified paths:
  • /trunk/extensions/PageInCat/PageInCat.i18n.php (modified) (history)
  • /trunk/extensions/PageInCat/PageInCat_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageInCat/PageInCat.i18n.php
@@ -11,18 +11,18 @@
1212 $messages['en'] = array(
1313 'pageincat-desc' => 'Adds a parser function <code><nowiki>{{#incat:...}}</nowiki></code> to determine if the current page is in a specified category',
1414 'pageincat-wrong-warn' => '\'\'\'Warning:\'\'\' The {{PLURAL:$2|category $1 was|categories $1 were}} detected incorrectly by <code><nowiki>{{#incat:...}}</nowiki></code>, and as a result this preview may be incorrect. The saved version of this page should be displayed in the correct manner.',
15 - 'pageincat-very-wrong-warn' => '\'\'\'Warning:\'\'\' The {{PLURAL:$2|category $1 was|categories $1 were}} detected incorrectly by <code><nowiki>{{#incat:...}}</nowiki></code>, and as a result this preview may be incorrect. This can be caused by including categories inside of <code><nowiki>{{#incat:...}}</nowiki></code> statements, and may result in inconsistant display.',
 15+ 'pageincat-very-wrong-warn' => '\'\'\'Warning:\'\'\' The {{PLURAL:$2|category $1 was|categories $1 were}} detected incorrectly by <code><nowiki>{{#incat:...}}</nowiki></code>, and as a result this preview may be incorrect. This can be caused by including categories inside of <code><nowiki>{{#incat:...}}</nowiki></code> statements, and may result in inconsistent display.',
1616 );
1717
1818 /** Message documentation (Message documentation) */
1919 $messages['qqq'] = array(
2020 'pageincat-wrong-warn' => 'Warning displayed during preview when editing a page if #incat parser function acted incorrectly (Acting incorrectly means acting as if page was not in category, but page actually is). This can happen during preview, since the categories from the last saved revision are used instead of the categories specified in the page text. Once page is saved, the correct categories should be used. This error can also be caused by conditional category inclusion (<code><nowiki>{{#ifpageincat:Foo||[[category:Foo]]}}</nowiki></code>. See also {{msg-mw|pageincat-very-wrong-warn}}.
2121
22 -*$1 is the list of categories (in a localized comma seperated list with the last two items separated by {{msg-mw|and}}. The individual category names will be italicized).
 22+*$1 is the list of categories (in a localized comma separated list with the last two items separated by {{msg-mw|and}}. The individual category names will be italicized).
2323 *$2 is how many categories',
2424 'pageincat-very-wrong-warn' => 'Warning displayed during preview when editing a page if #incat parser function acted incorrectly (Acting incorrectly means acting as if page was not in category, but page actually is) . This can happen if someone does something like \'\'put this page in category foo only if its not in category foo\'\' or more generally when people include category links inside <code>#incat</code> functions. Compare this to {{msg-mw|pageincat-wrong-warn}}. Generally this error message can happen when support for checking actual categories in the preview is enabled (but the category functions still behave incorrectly), the other error message will be triggered when such support is disabled.
2525
26 -*$1 is the list of categories (in a localized comma seperated list with the last two items separated by {{msg-mw|and}}. The individual category names will be italicized).
 26+*$1 is the list of categories (in a localized comma separated list with the last two items separated by {{msg-mw|and}}. The individual category names will be italicized).
2727 *$2 is how many categories',
2828 );
2929
Index: trunk/extensions/PageInCat/PageInCat_body.php
@@ -26,7 +26,7 @@
2727 public static function render( $parser, $frame, $args ) {
2828 $catText = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
2929
30 - // Must specify that content varries with what gets inserted in db on save.
 30+ // Must specify that content varies with what gets inserted in db on save.
3131 $parser->getOutput()->setFlag( 'vary-revision' );
3232
3333 if ( self::inCat( $parser->getTitle(), $catText, $parser ) ) {
@@ -93,7 +93,7 @@
9494 }
9595
9696 /**
97 - * Actually chech it in DB.
 97+ * Actually check it in DB.
9898 * @param $pageId int page_id of current page (Already verified to not be 0)
9999 * @param $catDBkey String the db key of category we're checking.
100100 * @return boolean if the current page belongs to the category.
@@ -154,6 +154,7 @@
155155 return true;
156156 }
157157
 158+ wfProfileIn( __METHOD__ . '-actual' );
158159 $actualCategories = $parser->getOutput()->getCategories();
159160 $wrongCategories = array();
160161
@@ -201,6 +202,7 @@
202203
203204 $parser->getOutput()->addWarning( $msg );
204205 }
 206+ wfProfileOut( __METHOD__ . '-actual' );
205207
206208 return true;
207209 }
@@ -284,7 +286,7 @@
285287
286288 if ( !isset( self::$categoriesForPreview[$hash] ) ) {
287289 # This probably shouldn't happen
288 - wfDebug( __METHOD__ . ' Could not find relavent cat list.' );
 290+ wfDebug( __METHOD__ . ' Could not find relevant cat list.' );
289291 return true;
290292 }
291293

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r107363Make this extension work correctly on preview...bawolff06:51, 27 December 2011

Status & tagging log