http://www.mediawiki.org/wiki/Special:Code/MediaWiki/56374

Revision: 56374
Author:   brion
Date:     2009-09-15 17:25:47 +0000 (Tue, 15 Sep 2009)

Log Message:
-----------
Merge post-branch trunk updates replacing old live hacks:
Core: r56213, r56215, r56216, r56218, r56334, r56335, r56336, r56338, r56340, 
r56343, r56345, r56347, r56350
Extensions: r56207, r56209, r56333

Modified Paths:
--------------
    branches/wmf-deployment-work/extensions/AbuseFilter/AbuseFilter.parser.php
    branches/wmf-deployment-work/extensions/TrustedXFF/TrustedXFF.php
    branches/wmf-deployment-work/extensions/TrustedXFF/generate.php
    branches/wmf-deployment-work/extensions/TrustedXFF/update
    branches/wmf-deployment-work/includes/DefaultSettings.php
    branches/wmf-deployment-work/includes/ImagePage.php
    branches/wmf-deployment-work/includes/Math.php
    branches/wmf-deployment-work/includes/Title.php
    branches/wmf-deployment-work/includes/User.php
    branches/wmf-deployment-work/includes/specials/SpecialRecentchanges.php
    branches/wmf-deployment-work/includes/specials/SpecialUndelete.php
    branches/wmf-deployment-work/languages/Language.php
    branches/wmf-deployment-work/maintenance/Maintenance.php
    branches/wmf-deployment-work/maintenance/backup.inc
    branches/wmf-deployment-work/maintenance/doMaintenance.php
    branches/wmf-deployment-work/maintenance/gearman/gearmanWorker.php
    branches/wmf-deployment-work/maintenance/rebuildLocalisationCache.php
    branches/wmf-deployment-work/maintenance/runJobs.php
    branches/wmf-deployment-work/maintenance/storage/make-blobs

Added Paths:
-----------
    branches/wmf-deployment-work/extensions/ContactPageFundraiser/
    branches/wmf-deployment-work/maintenance/deleteSelfExternals.php
    branches/wmf-deployment-work/maintenance/lag.php

Property Changed:
----------------
    branches/wmf-deployment-work/
    branches/wmf-deployment-work/extensions/
    branches/wmf-deployment-work/extensions/FundraiserPortal/
    
branches/wmf-deployment-work/extensions/HoneypotIntegration/HoneypotIntegration.class.php
    branches/wmf-deployment-work/extensions/LocalisationUpdate/
    branches/wmf-deployment-work/extensions/TrustedXFF/
    branches/wmf-deployment-work/extensions/TrustedXFF/trusted-hosts.txt
    branches/wmf-deployment-work/img_auth.php
    branches/wmf-deployment-work/includes/
    branches/wmf-deployment-work/includes/ConfEditor.php
    branches/wmf-deployment-work/includes/HistoryPage.php
    branches/wmf-deployment-work/includes/json/Services_JSON.php
    branches/wmf-deployment-work/js2/mwEmbed/jquery/jquery.ui/


Property changes on: branches/wmf-deployment-work
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3:51646
   + /branches/REL1_15/phase3:51646
/trunk/phase3:56213,56215-56216,56218,56334-56336,56338,56340,56343,56345,56347,56350


Property changes on: branches/wmf-deployment-work/extensions
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/REL1_15/phase3/extensions:51646
/trunk/extensions:56207,56209,56333
/trunk/phase3/extensions:56213,56215-56216,56218,56334-56336,56338,56340,56343,56345,56347,56350

Modified: 
branches/wmf-deployment-work/extensions/AbuseFilter/AbuseFilter.parser.php
===================================================================
--- branches/wmf-deployment-work/extensions/AbuseFilter/AbuseFilter.parser.php  
2009-09-15 17:21:45 UTC (rev 56373)
+++ branches/wmf-deployment-work/extensions/AbuseFilter/AbuseFilter.parser.php  
2009-09-15 17:25:47 UTC (rev 56374)
@@ -1590,6 +1590,7 @@
        
        public static function regexErrorHandler( $errno, $errstr, $errfile, 
$errline, $context ) {
                if ( error_reporting() == 0 ) { return true; }
+               wfLoadExtensionMessages( 'AbuseFilter' );
                throw new AFPUserVisibleException( 'regexfailure', 
$context['pos'],
                                        array( $errstr, $context['regex'] ) );
                return true;


Property changes on: 
branches/wmf-deployment-work/extensions/ContactPageFundraiser
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/REL1_15/phase3/extensions/ContactPageFundraiser:51646
/trunk/extensions/ContactPageFundraiser:52859,52871-52872,52876,53191,53205-53206,53272,54715,54758,54762,54778,54781,54786,54810-54811,55178,56209,56333
/trunk/phase3/ContactPageFundraiser:52859,53272
/trunk/phase3/extensions/ContactPageFundraiser:52290,52402,52404,52718,52737,52759,52776,52791,52800,52808,52812-52813,52815-52819,52822,52846,52850,52852-52853,52855-52857,52859,52924,52986,53128-53129,53190,53197,53199,53203-53204,53210-53211,53247,53249,53252,53267,53270,53293,53305,53344,53369,53427,53502-53504,53506,53777,54384,54494,54592,54599-54602,54604,54613,54764,54793,54806,55178,55626,56213,56215-56216,56218,56334-56336,56338,56340,56343,56345,56347,56350
Added: eol-style:native
   + properties


Property changes on: branches/wmf-deployment-work/extensions/FundraiserPortal
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/FundraiserPortal-multi:55038-55211
   + /branches/FundraiserPortal-multi:55038-55211
/trunk/extensions/FundraiserPortal:56207,56209,56333


Property changes on: 
branches/wmf-deployment-work/extensions/HoneypotIntegration/HoneypotIntegration.class.php
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/branches/wmf-deployment/extensions/HoneypotIntegration/HoneypotIntegration.class.php:55331
   + 
/branches/wmf-deployment/extensions/HoneypotIntegration/HoneypotIntegration.class.php:55331
/trunk/extensions/HoneypotIntegration/HoneypotIntegration.class.php:56207,56209,56333


Property changes on: branches/wmf-deployment-work/extensions/LocalisationUpdate
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/phase3/extensions/LocalisationUpdate:55198
   + /trunk/extensions/LocalisationUpdate:56207,56209,56333
/trunk/phase3/extensions/LocalisationUpdate:55198,56213,56215-56216,56218,56334-56336,56338,56340,56343,56345,56347,56350


Property changes on: branches/wmf-deployment-work/extensions/TrustedXFF
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/REL1_15/phase3/extensions/TrustedXFF:51646
/branches/wmf-deployment/extensions/TrustedXFF:53263
/trunk/extensions/TrustedXFF:56207,56209,56333

Modified: branches/wmf-deployment-work/extensions/TrustedXFF/TrustedXFF.php
===================================================================
--- branches/wmf-deployment-work/extensions/TrustedXFF/TrustedXFF.php   
2009-09-15 17:21:45 UTC (rev 56373)
+++ branches/wmf-deployment-work/extensions/TrustedXFF/TrustedXFF.php   
2009-09-15 17:25:47 UTC (rev 56374)
@@ -1,5 +1,9 @@
 <?php
 
+if (!defined('MEDIAWIKI')) {
+       die(1);
+}
+
 /**
  * Trusted hosts file in CDB format.
  * The file can be generated using generate.php
@@ -10,7 +14,7 @@
  *
  * For details, see http://meta.wikimedia.org/wiki/XFF_project
  */
-$wgTrustedXffFile = dirname(__FILE__).'/trusted-xff.cdb';
+$wgTrustedXffFile = $IP . '/cache/trusted-xff.cdb';
 
 
 /** Registration */

Modified: branches/wmf-deployment-work/extensions/TrustedXFF/generate.php
===================================================================
--- branches/wmf-deployment-work/extensions/TrustedXFF/generate.php     
2009-09-15 17:21:45 UTC (rev 56373)
+++ branches/wmf-deployment-work/extensions/TrustedXFF/generate.php     
2009-09-15 17:25:47 UTC (rev 56374)
@@ -12,7 +12,16 @@
        echo "Unable to open input file \"trusted-xff.txt\"\n";
        exit( 1 );
 }
-$outFile = dba_open( 'trusted-xff.cdb', 'n', 'cdb' );
+
+if( isset( $args[0] ) ) {
+       $target = realpath( $args[0] );
+} elseif( isset( $wgTrustedXffFile ) ) {
+       $target = $wgTrustedXffFile;
+} else {
+       echo "TrustedXffFile extension is not enabled. Specify target output 
file on command line!\n";
+       exit( 1 );
+}
+$outFile = dba_open( $target, 'n', 'cdb' );
 if ( !$outFile ) {
        echo "Unable open output file \"trusted-xff.cdb\"\n";
        exit( 1 );


Property changes on: 
branches/wmf-deployment-work/extensions/TrustedXFF/trusted-hosts.txt
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/wmf-deployment/extensions/TrustedXFF/trusted-hosts.txt:55331
   + 
/branches/wmf-deployment/extensions/TrustedXFF/trusted-hosts.txt:53263,55331
/trunk/extensions/TrustedXFF/trusted-hosts.txt:56207,56209,56333

Modified: branches/wmf-deployment-work/extensions/TrustedXFF/update
===================================================================
--- branches/wmf-deployment-work/extensions/TrustedXFF/update   2009-09-15 
17:21:45 UTC (rev 56373)
+++ branches/wmf-deployment-work/extensions/TrustedXFF/update   2009-09-15 
17:25:47 UTC (rev 56374)
@@ -1,8 +1,8 @@
 #!/bin/bash
 
 cd `dirname $0`
-php generate.php
-bzip2 -kf trusted-xff.cdb
+php generate.php aawiki ../../cache/trusted-xff.cdb
+bzip2 -kf ../../cache/trusted-xff.cdb
 if [ -x /home/wikipedia/bin/sync-common-file ]; then
-       sync-common-file php-1.5/extensions/TrustedXFF/trusted-xff.cdb
+       sync-common-file wmf-deployment/cache/trusted-xff.cdb
 fi


Property changes on: branches/wmf-deployment-work/img_auth.php
___________________________________________________________________
Deleted: svn:mergeinfo
   - /branches/REL1_15/phase3/img_auth.php:51646


Property changes on: branches/wmf-deployment-work/includes
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes:51646
/branches/wmf-deployment/includes:53381
   + /branches/REL1_15/phase3/includes:51646
/branches/wmf-deployment/includes:53381
/trunk/phase3/includes:56213,56215-56216,56218,56334-56336,56338,56340,56343,56345,56347,56350


Property changes on: branches/wmf-deployment-work/includes/ConfEditor.php
___________________________________________________________________
Modified: svn:mergeinfo
   - 
   + 
/trunk/phase3/includes/ConfEditor.php:56213,56215-56216,56218,56334-56336,56338,56340,56343,56345,56347,56350

Modified: branches/wmf-deployment-work/includes/DefaultSettings.php
===================================================================
--- branches/wmf-deployment-work/includes/DefaultSettings.php   2009-09-15 
17:21:45 UTC (rev 56373)
+++ branches/wmf-deployment-work/includes/DefaultSettings.php   2009-09-15 
17:25:47 UTC (rev 56374)
@@ -1861,6 +1861,19 @@
 /** Location of the texvc binary */
 $wgTexvc = './math/texvc';
 
+/**
+ * Normally when generating math images, we double-check that the
+ * directories we want to write to exist, and that files that have
+ * been generated still exist when we need to bring them up again.
+ *
+ * This lets us give useful error messages in case of permission
+ * problems, and automatically rebuild images that have been lost.
+ *
+ * On a big site with heavy NFS traffic this can be slow and flaky,
+ * so sometimes we want to short-circuit it by setting this to false.
+ */
+$wgMathCheckFiles = true;
+
 #
 # Profiling / debugging
 #
@@ -4219,3 +4232,6 @@
  * Note that this requires JS2 and the script loader.
  */
 $wgUseAJAXCategories = false;
+
+// to disable image delete/restore temporarily
+$wgUploadMaintenance = false;


Property changes on: branches/wmf-deployment-work/includes/HistoryPage.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/PageHistory.php:51646
   + /branches/REL1_15/phase3/includes/PageHistory.php:51646
/trunk/phase3/includes/HistoryPage.php:56213,56215-56216,56218,56334-56336,56338,56340,56343,56345,56347,56350

Modified: branches/wmf-deployment-work/includes/ImagePage.php
===================================================================
--- branches/wmf-deployment-work/includes/ImagePage.php 2009-09-15 17:21:45 UTC 
(rev 56373)
+++ branches/wmf-deployment-work/includes/ImagePage.php 2009-09-15 17:25:47 UTC 
(rev 56374)
@@ -720,6 +720,13 @@
         * Delete the file, or an earlier version of it
         */
        public function delete() {
+               global $wgUploadMaintenance;
+               if( $wgUploadMaintenance && $this->mTitle && 
$this->mTitle->getNamespace() == NS_FILE ) {
+                       global $wgOut;
+                       $wgOut->addWikiText('Deletion and restoration of images 
temporarily disabled during maintenance.' );
+                       return;
+               }
+
                $this->loadFile();
                if( !$this->img->exists() || !$this->img->isLocal() || 
$this->img->getRedirected() ) {
                        // Standard article deletion

Modified: branches/wmf-deployment-work/includes/Math.php
===================================================================
--- branches/wmf-deployment-work/includes/Math.php      2009-09-15 17:21:45 UTC 
(rev 56373)
+++ branches/wmf-deployment-work/includes/Math.php      2009-09-15 17:25:47 UTC 
(rev 56374)
@@ -33,7 +33,7 @@
 
        function render() {
                global $wgTmpDirectory, $wgInputEncoding;
-               global $wgTexvc;
+               global $wgTexvc, $wgMathCheckFiles;
                $fname = 'MathRenderer::render';
 
                if( $this->mode == MW_MATH_SOURCE ) {
@@ -45,13 +45,15 @@
                }
 
                if( !$this->_recall() ) {
-                       # Ensure that the temp and output directories are 
available before continuing...
-                       if( !file_exists( $wgTmpDirectory ) ) {
-                               if( !wfMkdirParents( $wgTmpDirectory ) ) {
+                       if( $wgMathCheckFiles ) {
+                               # Ensure that the temp and output directories 
are available before continuing...
+                               if( !file_exists( $wgTmpDirectory ) ) {
+                                       if( !wfMkdirParents( $wgTmpDirectory ) 
) {
+                                               return $this->_error( 
'math_bad_tmpdir' );
+                                       }
+                               } elseif( !is_dir( $wgTmpDirectory ) || 
!is_writable( $wgTmpDirectory ) ) {
                                        return $this->_error( 'math_bad_tmpdir' 
);
                                }
-                       } elseif( !is_dir( $wgTmpDirectory ) || !is_writable( 
$wgTmpDirectory ) ) {
-                               return $this->_error( 'math_bad_tmpdir' );
                        }
 
                        if( function_exists( 'is_executable' ) && 
!is_executable( $wgTexvc ) ) {
@@ -200,7 +202,7 @@
        }
 
        function _recall() {
-               global $wgMathDirectory;
+               global $wgMathDirectory, $wgMathCheckFiles;
                $fname = 'MathRenderer::_recall';
 
                $this->md5 = md5( $this->tex );
@@ -221,6 +223,12 @@
                        $this->mathml = $rpage->math_mathml;
 
                        $filename = $this->_getHashPath() . 
"/{$this->hash}.png";
+                       
+                       if( !$wgMathCheckFiles ) {
+                               // Short-circuit the file existence & migration 
checks
+                               return true;
+                       }
+                       
                        if( file_exists( $filename ) ) {
                                if( filesize( $filename ) == 0 ) {
                                        // Some horrible error corrupted stuff 
:(

Modified: branches/wmf-deployment-work/includes/Title.php
===================================================================
--- branches/wmf-deployment-work/includes/Title.php     2009-09-15 17:21:45 UTC 
(rev 56373)
+++ branches/wmf-deployment-work/includes/Title.php     2009-09-15 17:25:47 UTC 
(rev 56374)
@@ -1009,7 +1009,8 @@
 
        /**
         * Can $wgUser perform $action on this page?
-        * This skips potentially expensive cascading permission checks.
+        * This skips potentially expensive cascading permission checks
+        * as well as avoids expensive error formatting
         *
         * Suitable for use for nonessential UI controls in common cases, but
         * _not_ for functional access control.
@@ -1208,8 +1209,14 @@
                        }
                } elseif( !$user->isAllowed( $action ) ) {
                        $return = null;
-                       $groups = array_map( array( 'User', 'makeGroupLinkWiki' 
),
-                               User::getGroupsWithPermission( $action ) );
+                       
+                       // We avoid expensive display logic for quickUserCan's 
and such
+                       $groups = false; 
+                       if (!$short) {
+                               $groups = array_map( array( 'User', 
'makeGroupLinkWiki' ),
+                                       User::getGroupsWithPermission( $action 
) );
+                       } 
+                       
                        if( $groups ) {
                                $return = array( 'badaccess-groups',
                                        array( implode( ', ', $groups ), count( 
$groups ) ) );

Modified: branches/wmf-deployment-work/includes/User.php
===================================================================
--- branches/wmf-deployment-work/includes/User.php      2009-09-15 17:21:45 UTC 
(rev 56373)
+++ branches/wmf-deployment-work/includes/User.php      2009-09-15 17:25:47 UTC 
(rev 56374)
@@ -1663,6 +1663,9 @@
         * for reload on the next hit.
         */
        function invalidateCache() {
+               if( wfReadOnly() ) {
+                       return;
+               }
                $this->load();
                if( $this->mId ) {
                        $this->mTouched = self::newTouchedTimestamp();


Property changes on: 
branches/wmf-deployment-work/includes/json/Services_JSON.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/api/ApiFormatJson_json.php:51646
/branches/wmf-deployment/includes/api/ApiFormatJson_json.php:53381
   + /branches/REL1_15/phase3/includes/api/ApiFormatJson_json.php:51646
/branches/wmf-deployment/includes/api/ApiFormatJson_json.php:53381
/trunk/phase3/includes/json/Services_JSON.php:56213,56215-56216,56218,56334-56336,56338,56340,56343,56345,56347,56350

Modified: 
branches/wmf-deployment-work/includes/specials/SpecialRecentchanges.php
===================================================================
--- branches/wmf-deployment-work/includes/specials/SpecialRecentchanges.php     
2009-09-15 17:21:45 UTC (rev 56373)
+++ branches/wmf-deployment-work/includes/specials/SpecialRecentchanges.php     
2009-09-15 17:25:47 UTC (rev 56374)
@@ -55,7 +55,7 @@
                        $this->parseParameters( $parameters, $opts );
                }
 
-               $opts->validateIntBounds( 'limit', 0, 500 );
+               $opts->validateIntBounds( 'limit', 0, 5000 );
                return $opts;
        }
 

Modified: branches/wmf-deployment-work/includes/specials/SpecialUndelete.php
===================================================================
--- branches/wmf-deployment-work/includes/specials/SpecialUndelete.php  
2009-09-15 17:21:45 UTC (rev 56373)
+++ branches/wmf-deployment-work/includes/specials/SpecialUndelete.php  
2009-09-15 17:25:47 UTC (rev 56374)
@@ -646,6 +646,11 @@
                        }
                }
                if( $this->mRestore && $this->mAction == "submit" ) {
+                       global $wgUploadMaintenance;
+                       if( $wgUploadMaintenance && $this->mTargetObj && 
$this->mTargetObj->getNamespace() == NS_FILE ) {
+                               $wgOut->addWikiText('Deletion and restoration 
of images temporarily disabled during maintenance.' );
+                               return;
+                       }
                        return $this->undelete();
                }
                if( $this->mInvert && $this->mAction == "submit" ) {


Property changes on: branches/wmf-deployment-work/js2/mwEmbed/jquery/jquery.ui
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/js2/mwEmbed/jquery/jquery.ui-1.7.1:51646
   + /branches/REL1_15/phase3/js2/mwEmbed/jquery/jquery.ui-1.7.1:51646
/trunk/phase3/js2/mwEmbed/jquery/jquery.ui:56213,56215-56216,56218,56334-56336,56338,56340,56343,56345,56347,56350

Modified: branches/wmf-deployment-work/languages/Language.php
===================================================================
--- branches/wmf-deployment-work/languages/Language.php 2009-09-15 17:21:45 UTC 
(rev 56373)
+++ branches/wmf-deployment-work/languages/Language.php 2009-09-15 17:25:47 UTC 
(rev 56374)
@@ -1945,7 +1945,9 @@
        function getMagic( $mw ) {
                if ( !$this->mMagicHookDone ) {
                        $this->mMagicHookDone = true;
+                       wfProfileIn( 'LanguageGetMagic' );
                        wfRunHooks( 'LanguageGetMagic', array( 
&$this->mMagicExtensions, $this->getCode() ) );
+                       wfProfileOut( 'LanguageGetMagic' );
                }
                if ( isset( $this->mMagicExtensions[$mw->mId] ) ) {
                        $rawEntry = $this->mMagicExtensions[$mw->mId];

Modified: branches/wmf-deployment-work/maintenance/Maintenance.php
===================================================================
--- branches/wmf-deployment-work/maintenance/Maintenance.php    2009-09-15 
17:21:45 UTC (rev 56373)
+++ branches/wmf-deployment-work/maintenance/Maintenance.php    2009-09-15 
17:25:47 UTC (rev 56374)
@@ -333,7 +333,7 @@
                }
 
                # Set the memory limit
-               ini_set( 'memory_limit', -1 );
+               ini_set( 'memory_limit', $this->memoryLimit() );
 
                # Set max execution time to 0 (no limit). PHP.net says that
                # "When running PHP from the command line the default setting 
is 0."
@@ -362,6 +362,15 @@
                $this->maybeHelp();
                $this->validateParamsAndArgs();
        }
+       
+       /**
+        * Normally we disable the memory_limit when running admin scripts.
+        * Some scripts may wish to actually set a limit, however, to avoid
+        * blowing up unexpectedly.
+        */
+       public function memoryLimit() {
+               return -1;
+       }
 
        /**
         * Clear all params and arguments.

Modified: branches/wmf-deployment-work/maintenance/backup.inc
===================================================================
--- branches/wmf-deployment-work/maintenance/backup.inc 2009-09-15 17:21:45 UTC 
(rev 56373)
+++ branches/wmf-deployment-work/maintenance/backup.inc 2009-09-15 17:25:47 UTC 
(rev 56374)
@@ -232,28 +232,26 @@
                $this->startTime = wfTime();
        }
 
+       /**
+        * @fixme the --server parameter is currently not respected, as it 
doesn't seem
+        * terribly easy to ask the load balancer for a particular connection 
by name.
+        */
        function backupDb() {
-               global $wgDBadminuser, $wgDBadminpassword;
-               global $wgDBuser, $wgDBpassword;
-               global $wgDBname, $wgDebugDumpSql, $wgDBtype;
-               $flags = ($wgDebugDumpSql ? DBO_DEBUG : 0) | DBO_DEFAULT; // 
god-damn hack
+               $this->lb = wfGetLBFactory()->newMainLB();
+               $db = $this->lb->getConnection( DB_SLAVE, 'backup' );
                
-               if ( !$wgDBadminuser ) {
-                       $wgDBadminuser = $wgDBuser;
-               }
-               if ( !$wgDBadminpassword ) {
-                       $wgDBadminpassword = $wgDBpassword;
-               }
-
-               $class = 'Database' . ucfirst($wgDBtype);
-               $db = new $class( $this->backupServer(), $wgDBadminuser, 
$wgDBadminpassword, $wgDBname, false, $flags );
-               
                // Discourage the server from disconnecting us if it takes a 
long time
                // to read out the big ol' batch query.
                $db->setTimeout( 3600 * 24 );
                
                return $db;
        }
+       
+       function __destruct() {
+               if( isset( $this->lb ) ) {
+                       $this->lb->closeAll();
+               }
+       }
 
        function backupServer() {
                global $wgDBserver;

Copied: branches/wmf-deployment-work/maintenance/deleteSelfExternals.php (from 
rev 56216, trunk/phase3/maintenance/deleteSelfExternals.php)
===================================================================
--- branches/wmf-deployment-work/maintenance/deleteSelfExternals.php            
                (rev 0)
+++ branches/wmf-deployment-work/maintenance/deleteSelfExternals.php    
2009-09-15 17:25:47 UTC (rev 56374)
@@ -0,0 +1,15 @@
+<?php
+
+require_once("commandLine.inc");
+
+print "Deleting self externals from $wgServer\n";
+$db = wfGetDB(DB_MASTER);
+while (1) {
+       wfWaitForSlaves( 2 );
+       $db->commit();
+       $encServer = $db->escapeLike( $wgServer );
+       $q="DELETE /* deleteSelfExternals */ FROM externallinks WHERE el_to 
LIKE '$encServer/%' LIMIT 1000\n";
+       print "Deleting a batch\n";
+       $db->query($q);
+       if (!$db->affectedRows()) exit(0);
+}


Property changes on: 
branches/wmf-deployment-work/maintenance/deleteSelfExternals.php
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/REL1_15/phase3/maintenance/deleteSelfExternals.php:51646
/trunk/phase3/maintenance/deleteSelfExternals.php:52290,52402,52404,52718,52737,52759,52776,52791,52800,52808,52812-52813,52815-52819,52822,52846,52850,52852-52853,52855-52857,52859,52924,52986,53128-53129,53190,53197,53199,53203-53204,53210-53211,53247,53249,53252,53267,53270,53293,53305,53344,53369,53427,53502-53504,53506,53777,54384,54494,54592,54599-54602,54604,54613,54764,54793,54806,55178,55626,56218,56334-56336,56338,56340,56343,56345,56347,56350
Added: svn:eol-style
   + native

Modified: branches/wmf-deployment-work/maintenance/doMaintenance.php
===================================================================
--- branches/wmf-deployment-work/maintenance/doMaintenance.php  2009-09-15 
17:21:45 UTC (rev 56373)
+++ branches/wmf-deployment-work/maintenance/doMaintenance.php  2009-09-15 
17:25:47 UTC (rev 56374)
@@ -58,7 +58,8 @@
 }
 
 // Load settings, using wikimedia-mode if needed
-if( file_exists( dirname(__FILE__).'/wikimedia-mode' ) ) {
+// Fixme: replace this hack with general farm-friendly code
+if( file_exists( "$IP/wmf-config/wikimedia-mode" ) ) {
        # TODO FIXME! Wikimedia-specific stuff needs to go away to an ext
        # Maybe a hook?
        global $cluster;
@@ -66,10 +67,10 @@
        $cluster = 'pmtpa';
        require_once( "$IP/includes/AutoLoader.php" );
        require_once( "$IP/includes/SiteConfiguration.php" );
-       require( "$IP/wgConf.php" );
+       require( "$IP/wmf-config/wgConf.php" );
        $maintenance->loadWikimediaSettings();
        require( $IP.'/includes/Defines.php' );
-       require( $IP.'/CommonSettings.php' );
+       require( $IP.'/wmf-config/CommonSettings.php' );
 } else {
        require_once( "$IP/includes/AutoLoader.php" );
        require_once( "$IP/includes/Defines.php" );

Modified: branches/wmf-deployment-work/maintenance/gearman/gearmanWorker.php
===================================================================
--- branches/wmf-deployment-work/maintenance/gearman/gearmanWorker.php  
2009-09-15 17:21:45 UTC (rev 56373)
+++ branches/wmf-deployment-work/maintenance/gearman/gearmanWorker.php  
2009-09-15 17:25:47 UTC (rev 56374)
@@ -4,6 +4,8 @@
 require( dirname(__FILE__).'/../commandLine.inc' );
 require( dirname(__FILE__).'/gearman.inc' );
 
+ini_set('memory_limit', '150M' );
+
 if ( isset( $options['procs'] ) ) {
        $procs = $options['procs'];
        if ( $procs < 1 || $procs > 1000 ) {

Copied: branches/wmf-deployment-work/maintenance/lag.php (from rev 56350, 
trunk/phase3/maintenance/lag.php)
===================================================================
--- branches/wmf-deployment-work/maintenance/lag.php                            
(rev 0)
+++ branches/wmf-deployment-work/maintenance/lag.php    2009-09-15 17:25:47 UTC 
(rev 56374)
@@ -0,0 +1,33 @@
+<?php
+
+$wgUseNormalUser = true;
+require_once('commandLine.inc');
+
+if ( isset( $options['r'] ) ) {
+       $lb = wfGetLB();
+       print 'time     ';
+       for( $i = 0; $i < $lb->getServerCount(); $i++ ) {
+               $hostname = $lb->getServerName( $i );
+               printf("%-12s ", $hostname );
+       }
+       print("\n");
+       
+       while( 1 ) {
+               $lags = $lb->getLagTimes();
+               unset( $lags[0] );
+               print( gmdate( 'H:i:s' ) . ' ' );
+               foreach( $lags as $i => $lag ) {
+                       printf("%-12s " , $lag === false ? 'false' : $lag );
+               }
+               print("\n");
+               sleep(5);
+       }
+} else {
+       $lb = wfGetLB();
+       $lags = $lb->getLagTimes();
+       foreach( $lags as $i => $lag ) {
+               $name = $lb->getServerName( $i );
+               printf("%-20s %s\n" , $name, $lag === false ? 'false' : $lag );
+       }
+}
+?>

Modified: branches/wmf-deployment-work/maintenance/rebuildLocalisationCache.php
===================================================================
--- branches/wmf-deployment-work/maintenance/rebuildLocalisationCache.php       
2009-09-15 17:21:45 UTC (rev 56373)
+++ branches/wmf-deployment-work/maintenance/rebuildLocalisationCache.php       
2009-09-15 17:25:47 UTC (rev 56374)
@@ -37,12 +37,14 @@
                $this->addOption( 'force', 'Rebuild all files, even ones not 
out of date' );
                $this->addOption( 'threads', 'Fork more than one thread', 
false, true );
        }
+       
+       public function memoryLimit() {
+               return '200M';
+       }
 
        public function execute() {
                global $wgLocalisationCacheConf;
 
-               ini_set( 'memory_limit', '200M' );
-
                $force = $this->hasOption('force');
                $threads = $this->getOption( 'threads', 1 );
                if( $threads < 1 || $threads != intval( $threads ) ) {

Modified: branches/wmf-deployment-work/maintenance/runJobs.php
===================================================================
--- branches/wmf-deployment-work/maintenance/runJobs.php        2009-09-15 
17:21:45 UTC (rev 56373)
+++ branches/wmf-deployment-work/maintenance/runJobs.php        2009-09-15 
17:25:47 UTC (rev 56374)
@@ -36,6 +36,11 @@
                $this->addOption( 'procs', 'Number of processes to use', false, 
true );
                $wgUseNormalUser = true;
        }
+       
+       public function memoryLimit() {
+               // Don't eat all memory on the machine if we get a bad job.
+               return "150M";
+       }
 
        public function execute() {
                global $wgTitle;

Modified: branches/wmf-deployment-work/maintenance/storage/make-blobs
===================================================================
--- branches/wmf-deployment-work/maintenance/storage/make-blobs 2009-09-15 
17:21:45 UTC (rev 56373)
+++ branches/wmf-deployment-work/maintenance/storage/make-blobs 2009-09-15 
17:25:47 UTC (rev 56374)
@@ -1,11 +1,16 @@
 #!/bin/bash
 
-if [ X$2 == X ];then
-       echo 'Usage: make-blobs <server> <db>'
+if [ -z $2 ];then
+       echo 'Usage: make-blobs <server> <db> [<table name>]'
        exit 1
 fi
+if [ -z $3 ]; then
+       table=blobs
+else 
+       table=$3
+fi
 
 echo "CREATE DATABASE $2" | mysql -u wikiadmin -p`wikiadmin_pass` -h $1 && \
-mysql -u wikiadmin -p`wikiadmin_pass` -h $1 $2 < blobs.sql
+sed "s/blobs\>/$table/" blobs.sql | mysql -u wikiadmin -p`wikiadmin_pass` -h 
$1 $2
        
        



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

Reply via email to