Fix for bug 12705. Fixed refreshLinks.php documentation.
authorTim Starling <tstarling@users.mediawiki.org>
Tue, 22 Jan 2008 10:10:21 +0000 (10:10 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Tue, 22 Jan 2008 10:10:21 +0000 (10:10 +0000)
includes/Parser.php
maintenance/refreshLinks.inc
maintenance/refreshLinks.php

index becda14..c3b398d 100644 (file)
@@ -82,8 +82,9 @@ class Parser
        # Persistent:
        var $mTagHooks, $mTransparentTagHooks, $mFunctionHooks, $mFunctionSynonyms, $mVariables,
                $mImageParams, $mImageParamsMagicArray, $mStripList, $mMarkerSuffix,
-               $mExtLinkBracketedRegex, $mPreprocessor;
-       
+               $mExtLinkBracketedRegex, $mPreprocessor, $mDefaultStripList;
+
+
        # Cleared with clearState():
        var $mOutput, $mAutonumber, $mDTopen, $mStripState;
        var $mIncludeCount, $mArgStack, $mLastSection, $mInPre;
@@ -114,7 +115,7 @@ class Parser
                $this->mTransparentTagHooks = array();
                $this->mFunctionHooks = array();
                $this->mFunctionSynonyms = array( 0 => array(), 1 => array() );
-               $this->mStripList = array( 'nowiki', 'gallery' );
+               $this->mDefaultStripList = $this->mStripList = array( 'nowiki', 'gallery' );
                $this->mMarkerSuffix = "-QINU\x7f";
                $this->mExtLinkBracketedRegex = '/\[(\b(' . wfUrlProtocols() . ')'.
                        '[^][<>"\\x00-\\x20\\x7F]+) *([^\]\\x0a\\x0d]*?)\]/S';
@@ -3854,6 +3855,14 @@ class Parser
                return $oldVal;
        }
 
+       /**
+        * Remove all tag hooks
+        */
+       function clearTagHooks() {
+               $this->mTagHooks = array();
+               $this->mStripList = $this->mDefaultStripList;
+       }
+
        /**
         * Create a function, e.g. {{sum:1|2|3}}
         * The callback function should have the form:
index 9e4eea8..e89db8a 100644 (file)
@@ -19,7 +19,7 @@ function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0, $red
        $wgUser->setOption('math', MW_MATH_SOURCE);
 
        # Don't generate extension images (e.g. Timeline)
-       $wgParser->mTagHooks = array();
+       $wgParser->clearTagHooks();
 
        # Don't generate thumbnail images
        $wgUseImageResize = false;
index 923379e..67fb77a 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 /**
- * @todo document
  * @addtogroup Maintenance
  */
 
@@ -12,21 +11,13 @@ require_once( "refreshLinks.inc" );
 
 if( isset( $options['help'] ) ) {
        echo <<<TEXT
-usage: php refreshLinks.php start [-e end] [-m maxlag] [--help] [possibly other
-    stuff]
+Usage: php refreshLinks.php [<start>] [-e <end>] [-m <maxlag>] [--help] 
 
     --help      : This help message
-    --dfn-only  : ???
-    -m <number> : Specifies max replication lag?  Does it abort or wait if this
-        is exceeded?
-    start       : First page id to refresh?  Doesn't work with --dfn-only set?
-    -e <number> : Last page id to refresh?
-
-This uses wfGetDB() to get the database, it seems not to accept a database ar-
-gument on the command line.  So I don't know if you can use it for non-default
-configuration.
-
-Todo: Real documentation.
+    --dfn-only  : Delete links from nonexistent articles only
+    -m <number> : Maximum replication lag
+    <start>     : First page id to refresh
+    -e <number> : Last page id to refresh
 
 TEXT;
        exit(0);
@@ -35,7 +26,7 @@ TEXT;
 error_reporting( E_ALL & (~E_NOTICE) );
 
 if ( !$options['dfn-only'] ) {
-       if ($args[0]) {
+       if ( isset( $args[0] ) ) {
                $start = (int)$args[0];
        } else {
                $start = 1;