Jump to content

User:Brion/Live-fixes

From Wikitech

Remaining live hacks I haven't yet committed...

Index: maintenance/addwiki.php
===================================================================
--- maintenance/addwiki.php	(revision 13406)
+++ maintenance/addwiki.php	(working copy)
@@ -204,6 +204,15 @@
 	print "Sourcing interwiki SQL\n";
 	dbsource( $tempname, $dbw );
 	unlink( $tempname );
+	
+	# Create the upload dir
+	global $wgUploadDirectory;
+	if( file_exists( $wgUploadDirectory ) ) {
+		echo "$wgUploadDirectory already exists.\n";
+	} else {
+		echo "Creating $wgUploadDirectory...\n";
+		mkdir( $wgUploadDirectory, 0777 );
+	}
 
 	print "Script ended. You now want to run sync-common-all to publish *dblist files (check them for duplicates first)\n";
 }
Index: extensions/SpamBlacklist/SpamBlacklist_body.php
===================================================================
--- extensions/SpamBlacklist/SpamBlacklist_body.php	(revision 13406)
+++ extensions/SpamBlacklist/SpamBlacklist_body.php	(working copy)
@@ -119,6 +119,13 @@
 			wfDebug( "Corrupt regex\n" );
 			$this->regex = false;
 		}
+		// Live hack
+		$length = strlen( $this->regex );
+		if ( $length < 15000 || $length > 25000 ) {
+			error_log( "Error, corrupt regex, length: $length, DB: $wgDBname\n", 3, 
+				"/home/wikipedia/logs/spam_blacklist/sb.log" );
+			$this->regex = false;
+		}
 		wfProfileOut( $fname );
 		return $this->regex;
 	}
Index: includes/SiteStatsUpdate.php
===================================================================
--- includes/SiteStatsUpdate.php	(revision 13406)
+++ includes/SiteStatsUpdate.php	(working copy)
@@ -77,6 +77,14 @@
 			$sql = $dbw->limitResultForUpdate("UPDATE $site_stats SET $updates", 1);
 			$dbw->query( $sql, $fname );
 		}
+
+		/*
+		global $wgDBname, $wgTitle;
+		if ( $this->mGood && $wgDBname == 'enwiki' ) {
+			$good = $dbw->selectField( 'site_stats', 'ss_good_articles', '', $fname );
+			error_log( $good . ' ' . $wgTitle->getPrefixedDBkey() . "\n", 3, '/home/wikipedia/logs/million.log' );
+		}
+		*/
 	}
 }
 ?>
Index: includes/PersistentObject.php
===================================================================
--- includes/PersistentObject.php	(revision 13406)
+++ includes/PersistentObject.php	(working copy)
@@ -44,6 +44,8 @@
 
 class PersistentObject {
 	function PersistentObject( &$obj ) {
+		//global $wgPersistentObjects;
+
 		$wgPersistentObjects[] = $obj;
 	}
 }
Index: includes/SpecialUndelete.php
===================================================================
--- includes/SpecialUndelete.php	(revision 13406)
+++ includes/SpecialUndelete.php	(working copy)
@@ -345,9 +345,11 @@
 	}
 
 	function execute() {
-
+		global $wgOut;
 		if( is_null( $this->mTargetObj ) ) {
-			return $this->showList();
+			$wgOut->addWikiText( "See [[Special:Log/delete|the deletion log]] for recently deleted pages." );
+			return;
+			//return $this->showList();
 		}
 		if( $this->mTimestamp !== '' ) {
 			return $this->showRevision( $this->mTimestamp );
Index: index.php
===================================================================
--- index.php	(revision 13406)
+++ index.php	(working copy)
@@ -26,6 +26,16 @@
 # its purpose.
 define( 'MEDIAWIKI', true );
 
+if ( (0 == mt_rand(0, 500) && $_SERVER['HTTP_HOST'] == 'en.wikipedia.org' ) || 
+     (0 == mt_rand(0, 50) && $_SERVER['HTTP_HOST'] == 'commons.wikimedia.org') ) {
+	require_once( './includes/Profiling.php' );
+	$wgProfiler = new Profiler;
+} else {
+	require_once( './includes/ProfilerStub.php' );
+}
+wfProfileIn( 'configuration' );
+
+
 # Load up some global defines.
 require_once( './includes/Defines.php' );
 
@@ -76,6 +86,7 @@
 
 # Include this site setttings
 require_once( './LocalSettings.php' );
+wfProfileOut( 'configuration' );
 # Prepare MediaWiki
 require_once( 'includes/Setup.php' );