https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113502

Revision: 113502
Author:   wikinaut
Date:     2012-03-09 19:23:28 +0000 (Fri, 09 Mar 2012)
Log Message:
-----------
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
    trunk/extensions/AJAXPoll/AJAXPoll.php
    trunk/extensions/AJAXPoll/AJAXPoll_body.php

Modified: trunk/extensions/AJAXPoll/AJAXPoll.i18n.php
===================================================================
--- trunk/extensions/AJAXPoll/AJAXPoll.i18n.php 2012-03-09 19:05:29 UTC (rev 
113501)
+++ trunk/extensions/AJAXPoll/AJAXPoll.i18n.php 2012-03-09 19:23:28 UTC (rev 
113502)
@@ -13,6 +13,7 @@
  */
 $messages['en'] = array(
        'ajaxpoll-desc' => 'Allows AJAX-based polls with <tt>&lt;poll&gt;</tt> 
tag',
+       'ajaxpoll-tracking-category' => 'Poll',
        'ajaxpoll-vote-update' => 'Your vote has been updated.',
        'ajaxpoll-vote-add' => 'Your vote has been added.',
        'ajaxpoll-vote-error' => 'There was a problem with processing your 
vote, please try again.',
@@ -25,6 +26,7 @@
 
 /** Message documentation (Message documentation) */
 $messages['qqq'] = array(
+       '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.',
        'ajaxpoll-percent-votes' => '$1 is the percentage number of the votes',
        'ajaxpoll-your-vote' => '$1 is the answer name, $2 is the date when the 
answer was casted',
        'ajaxpoll-info' => '$1 is the number of votes, $2 is when the poll was 
started',

Modified: trunk/extensions/AJAXPoll/AJAXPoll.php
===================================================================
--- trunk/extensions/AJAXPoll/AJAXPoll.php      2012-03-09 19:05:29 UTC (rev 
113501)
+++ trunk/extensions/AJAXPoll/AJAXPoll.php      2012-03-09 19:23:28 UTC (rev 
113502)
@@ -19,7 +19,7 @@
  * @author Jack Phoenix <[email protected]>
  * @author Thomas Gries
  * @maintainer Thomas Gries
- * @version 1.603
+ * @version 1.61
  * @link http://www.mediawiki.org/wiki/Extension:AJAX_Poll Documentation
  */
 
@@ -31,7 +31,7 @@
 $wgExtensionCredits['parserhook'][] = array(
        'path' => __FILE__,
        'name' => 'AJAX Poll',
-       'version' => '1.604 20120222',
+       'version' => '1.61 20120309',
        'author' => array( 'Dariusz Siedlecki', 'Jack Phoenix', 'Thomas Gries' 
),
        'descriptionmsg' => 'ajaxpoll-desc',
        'url' => 'https://www.mediawiki.org/wiki/Extension:AJAX_Poll',
@@ -43,3 +43,16 @@
 $wgAutoloadClasses['AJAXPoll'] = $dir . 'AJAXPoll_body.php';
 $wgAjaxExportList[] = 'AJAXPoll::submitVote';
 $wgHooks['ParserFirstCallInit'][] = 'AJAXPoll::AJAXPollParserInit';
+
+// Parameter to enable the automatic tracking category
+// for all pages using this parser extension
+//
+// Category name [[MediaWiki:Ajaxpoll-tracking-category]] (default)
+// $wgAJAXPollTrackingCategory = true;
+//
+// you can assign a specific category name [[MediaWiki:Ajaxpoll-mycategory]]
+// $wgAJAXPollTrackingCategory = 'ajaxpoll-mycategory';
+//
+// you can disable the use of a tracking category
+// $wgAJAXPollTrackingCategory = false;
+$wgAJAXPollTrackingCategory = true;

Modified: trunk/extensions/AJAXPoll/AJAXPoll_body.php
===================================================================
--- trunk/extensions/AJAXPoll/AJAXPoll_body.php 2012-03-09 19:05:29 UTC (rev 
113501)
+++ trunk/extensions/AJAXPoll/AJAXPoll_body.php 2012-03-09 19:23:28 UTC (rev 
113502)
@@ -10,7 +10,7 @@
  * @author Jack Phoenix <[email protected]>
  * @author Thomas Gries
  * @maintainer Thomas Gries
- * @version 1.603
+ * @version 1.61
  * @link http://www.mediawiki.org/wiki/Extension:AJAX_Poll Documentation
  */
 
@@ -29,10 +29,17 @@
 
        # The callback function for converting the input text to HTML output
        static function AJAXPollRender( $input ) {
-               global $wgParser, $wgUser, $wgOut, $wgTitle, $wgScriptPath;
+               global $wgParser, $wgUser, $wgOut, $wgTitle, $wgScriptPath,
+                       $wgAJAXPollTrackingCategory;
 
                $wgParser->disableCache();
 
+               if ( $wgAJAXPollTrackingCategory === true ) {
+                       $wgParser->addTrackingCategory( 
'ajaxpoll-tracking-category' );
+               } elseif ( is_string( $wgAJAXPollTrackingCategory ) ) {
+                       $wgParser->addTrackingCategory( 
$wgAJAXPollTrackingCategory );
+               }
+
                if ( $wgUser->getName() == '' ) {
                        $user = wfGetIP();
                } else {
@@ -53,7 +60,7 @@
                }*/
 
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
+               $dbw->begin();
                /**
                * Register poll in the database
                */
@@ -76,7 +83,7 @@
                                __METHOD__
                        );
                }
-               $dbw->commit( __METHOD__ );
+               $dbw->commit();
 
                // Add CSS
                $wgOut->addExtensionStyle( $wgScriptPath . 
'/extensions/AJAXPoll/AJAXPoll.css' );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to