r113502 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113501‎ | r113502 | r113503 >
Date:19:23, 9 March 2012
Author:wikinaut
Status:new (Comments)
Tags:
Comment:
add tracking category feature (enabled by default). Each page using this extensions get automatically the tracking category with MediaWiki:Ajaxpoll-tracking-category name (= Poll). Tracking-Cat-Feature can be disabled, or a different MediaWiki message text can be assigned. Documentation of the switch is inline and follows on MediaWiki.
Modified paths:
  • /trunk/extensions/AJAXPoll/AJAXPoll.i18n.php (modified) (history)
  • /trunk/extensions/AJAXPoll/AJAXPoll.php (modified) (history)
  • /trunk/extensions/AJAXPoll/AJAXPoll_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AJAXPoll/AJAXPoll.php
@@ -19,7 +19,7 @@
2020 * @author Jack Phoenix <jack@countervandalism.net>
2121 * @author Thomas Gries
2222 * @maintainer Thomas Gries
23 - * @version 1.603
 23+ * @version 1.61
2424 * @link http://www.mediawiki.org/wiki/Extension:AJAX_Poll Documentation
2525 */
2626
@@ -31,7 +31,7 @@
3232 $wgExtensionCredits['parserhook'][] = array(
3333 'path' => __FILE__,
3434 'name' => 'AJAX Poll',
35 - 'version' => '1.604 20120222',
 35+ 'version' => '1.61 20120309',
3636 'author' => array( 'Dariusz Siedlecki', 'Jack Phoenix', 'Thomas Gries' ),
3737 'descriptionmsg' => 'ajaxpoll-desc',
3838 'url' => 'https://www.mediawiki.org/wiki/Extension:AJAX_Poll',
@@ -43,3 +43,16 @@
4444 $wgAutoloadClasses['AJAXPoll'] = $dir . 'AJAXPoll_body.php';
4545 $wgAjaxExportList[] = 'AJAXPoll::submitVote';
4646 $wgHooks['ParserFirstCallInit'][] = 'AJAXPoll::AJAXPollParserInit';
 47+
 48+// Parameter to enable the automatic tracking category
 49+// for all pages using this parser extension
 50+//
 51+// Category name [[MediaWiki:Ajaxpoll-tracking-category]] (default)
 52+// $wgAJAXPollTrackingCategory = true;
 53+//
 54+// you can assign a specific category name [[MediaWiki:Ajaxpoll-mycategory]]
 55+// $wgAJAXPollTrackingCategory = 'ajaxpoll-mycategory';
 56+//
 57+// you can disable the use of a tracking category
 58+// $wgAJAXPollTrackingCategory = false;
 59+$wgAJAXPollTrackingCategory = true;
Index: trunk/extensions/AJAXPoll/AJAXPoll_body.php
@@ -10,7 +10,7 @@
1111 * @author Jack Phoenix <jack@countervandalism.net>
1212 * @author Thomas Gries
1313 * @maintainer Thomas Gries
14 - * @version 1.603
 14+ * @version 1.61
1515 * @link http://www.mediawiki.org/wiki/Extension:AJAX_Poll Documentation
1616 */
1717
@@ -29,10 +29,17 @@
3030
3131 # The callback function for converting the input text to HTML output
3232 static function AJAXPollRender( $input ) {
33 - global $wgParser, $wgUser, $wgOut, $wgTitle, $wgScriptPath;
 33+ global $wgParser, $wgUser, $wgOut, $wgTitle, $wgScriptPath,
 34+ $wgAJAXPollTrackingCategory;
3435
3536 $wgParser->disableCache();
3637
 38+ if ( $wgAJAXPollTrackingCategory === true ) {
 39+ $wgParser->addTrackingCategory( 'ajaxpoll-tracking-category' );
 40+ } elseif ( is_string( $wgAJAXPollTrackingCategory ) ) {
 41+ $wgParser->addTrackingCategory( $wgAJAXPollTrackingCategory );
 42+ }
 43+
3744 if ( $wgUser->getName() == '' ) {
3845 $user = wfGetIP();
3946 } else {
@@ -53,7 +60,7 @@
5461 }*/
5562
5663 $dbw = wfGetDB( DB_MASTER );
57 - $dbw->begin( __METHOD__ );
 64+ $dbw->begin();
5865 /**
5966 * Register poll in the database
6067 */
@@ -76,7 +83,7 @@
7784 __METHOD__
7885 );
7986 }
80 - $dbw->commit( __METHOD__ );
 87+ $dbw->commit();
8188
8289 // Add CSS
8390 $wgOut->addExtensionStyle( $wgScriptPath . '/extensions/AJAXPoll/AJAXPoll.css' );
Index: trunk/extensions/AJAXPoll/AJAXPoll.i18n.php
@@ -13,6 +13,7 @@
1414 */
1515 $messages['en'] = array(
1616 'ajaxpoll-desc' => 'Allows AJAX-based polls with <tt>&lt;poll&gt;</tt> tag',
 17+ 'ajaxpoll-tracking-category' => 'Poll',
1718 'ajaxpoll-vote-update' => 'Your vote has been updated.',
1819 'ajaxpoll-vote-add' => 'Your vote has been added.',
1920 'ajaxpoll-vote-error' => 'There was a problem with processing your vote, please try again.',
@@ -25,6 +26,7 @@
2627
2728 /** Message documentation (Message documentation) */
2829 $messages['qqq'] = array(
 30+ 'ajaxpoll-tracking-category' => 'The name of a category for all pages which use the <poll> parser extension tag. The category is automatically added unless the feature is disabled.',
2931 'ajaxpoll-percent-votes' => '$1 is the percentage number of the votes',
3032 'ajaxpoll-your-vote' => '$1 is the answer name, $2 is the date when the answer was casted',
3133 'ajaxpoll-info' => '$1 is the number of votes, $2 is when the poll was started',

Follow-up revisions

RevisionCommit summaryAuthorDate
r113503follow up r113502 - readded method by reedy. Lost despite of using svn up, ho...wikinaut19:26, 9 March 2012
r113511follow up r113502 : escaped html tag brackets to make translaters happywikinaut19:51, 9 March 2012
r113544follow up r113502 . Using also here the correct parser as passed as parameter...wikinaut23:24, 9 March 2012
r114166removed the redundant code for handling tracking categories. By using '-' for...wikinaut18:45, 19 March 2012

Comments

#Comment by Wikinaut (talk | contribs)   06:53, 21 March 2012

Info: tracking category _parameter_ removed in r114166.

Status & tagging log