Fix this broken crap some more
[lhc/web/wiklou.git] / maintenance / populateCategory.inc
index 905706e..3d04a30 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 /**
- * @addtogroup Maintenance
+ * @file
+ * @ingroup Maintenance
  * @author Simetrical
  */
 
@@ -18,7 +19,7 @@ function populateCategory( $begin, $maxlag, $throttle, $force ) {
                );
                if( $row ) {
                        echo "Category table already populated.  Use php ".
-                       "maintenace/populateCategory.php\n--force from the command line ".
+                       "maintenance/populateCategory.php\n--force from the command line ".
                        "to override.\n";
                        return true;
                }
@@ -55,10 +56,10 @@ function populateCategory( $begin, $maxlag, $throttle, $force ) {
                # Use the row to update the category count
                $cat = Category::newFromName( $name );
                if( !is_object( $cat ) ) {
-                       var_dump( $cat );
-                       throw new MWException( "The category named $name is not valid?!" );
+                       echo "The category named $name is not valid?!\n";
+               } else {
+                       $cat->refreshCounts();
                }
-               $cat->refreshCounts();
 
                ++$i;
                if( !($i % REPORTING_INTERVAL) ) {
@@ -82,19 +83,3 @@ function populateCategory( $begin, $maxlag, $throttle, $force ) {
                return false;
        }
 }
-
-function wfWaitForSlaves( $maxLag ) {
-       global $wgLoadBalancer;
-       if ( $maxLag ) {
-               list( $host, $lag ) = $wgLoadBalancer->getMaxLag();
-               while ( $lag > $maxLag ) {
-                       $name = @gethostbyaddr( $host );
-                       if ( $name !== false ) {
-                               $host = $name;
-                       }
-                       print "Waiting for $host (lagged $lag seconds)...\n";
-                       sleep($maxLag);
-                       list( $host, $lag ) = $wgLoadBalancer->getMaxLag();
-               }
-       }
-}