Fix bug when using Mediawiki Installer.
authorBertrand Grondin <grondin@users.mediawiki.org>
Tue, 18 Mar 2008 07:58:21 +0000 (07:58 +0000)
committerBertrand Grondin <grondin@users.mediawiki.org>
Tue, 18 Mar 2008 07:58:21 +0000 (07:58 +0000)
fix the following message error :
Fatal error:  Call to undefined function wfWaitForSlaves() in maintenance/populateCategory.inc on line 66

This wfWaitForSlaves() function exists only in commandLine.inc but updater can't call it when not using command line tool.
Adding this function in the end of populateCategory.inc.

maintenance/populateCategory.inc

index f17e5e8..905706e 100644 (file)
@@ -82,3 +82,19 @@ 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();
+               }
+       }
+}