From 062773733d6c97a5b05098712ffc64fc7fc491f7 Mon Sep 17 00:00:00 2001 From: Reedy Date: Tue, 10 Apr 2012 18:27:59 +0000 Subject: [PATCH] Commit of various live hacks Disable of MessageBlobStore clear Reset $wgAutopromote (should be moved to a config change!!) Disable setting of wgStyleSheetPath Disable squid updates in HTMLCacaheUpdate invalidateTitles Throttle page_touched Add apc htcp packet numbers to SquidUpdate Disable set names binary/utf8 Commment out searchindex table indexes Was c532e81d583d3d0439fe76eea4d105d675461b56 Change-Id: I42c4f859e55eb198f6c6841e582b3552aad7b31f --- includes/DefaultSettings.php | 6 ++++-- includes/MessageBlobStore.php | 3 +++ includes/cache/HTMLCacheUpdate.php | 8 +++++++- includes/cache/SquidUpdate.php | 17 ++++++++++++++++- includes/db/DatabaseMysql.php | 4 ++-- maintenance/tables.sql | 6 +++--- 6 files changed, 35 insertions(+), 9 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 9801e04ed1..bfac3897a2 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -157,7 +157,8 @@ $wgLoadScript = false; * The URL path of the skins directory. Will default to "{$wgScriptPath}/skins" in Setup.php */ $wgStylePath = false; -$wgStyleSheetPath = &$wgStylePath; +# Broken PHP, canary mismatch -- TS +#$wgStyleSheetPath = &$wgStylePath; /** * The URL path of the skins directory. Should not point to an external domain. @@ -3733,10 +3734,11 @@ $wgAutoConfirmCount = 0; * user who has provided an e-mail address. */ $wgAutopromote = array( + /* test patch -- TS 'autoconfirmed' => array( '&', array( APCOND_EDITCOUNT, &$wgAutoConfirmCount ), array( APCOND_AGE, &$wgAutoConfirmAge ), - ), + ), */ ); /** diff --git a/includes/MessageBlobStore.php b/includes/MessageBlobStore.php index be6b27c9ef..255e9a79e9 100644 --- a/includes/MessageBlobStore.php +++ b/includes/MessageBlobStore.php @@ -228,6 +228,9 @@ class MessageBlobStore { } public static function clear() { + // HACK: disable clear() on WMF servers + return; + // TODO: Give this some more thought // TODO: Is TRUNCATE better? $dbw = wfGetDB( DB_MASTER ); diff --git a/includes/cache/HTMLCacheUpdate.php b/includes/cache/HTMLCacheUpdate.php index 11e2ae740b..029f67af91 100644 --- a/includes/cache/HTMLCacheUpdate.php +++ b/includes/cache/HTMLCacheUpdate.php @@ -191,13 +191,19 @@ class HTMLCacheUpdate implements DeferrableUpdate { array( 'page_id' => $batch ), __METHOD__ ); + # WM patch: throttle to avoid apache CPU exhaustion -- TS + if ( php_sapi_name() == 'cli' ) { + sleep( 1 ); + } } # Update squid + # Disable this as a temporary measure per private-l post -- TS + /* if ( $wgUseSquid ) { $u = SquidUpdate::newFromTitles( $titleArray ); $u->doUpdate(); - } + } */ # Update file cache if ( $wgUseFileCache ) { diff --git a/includes/cache/SquidUpdate.php b/includes/cache/SquidUpdate.php index e560e0e7db..b343b0a681 100644 --- a/includes/cache/SquidUpdate.php +++ b/includes/cache/SquidUpdate.php @@ -185,10 +185,25 @@ class SquidUpdate { throw new MWException( "Invalid HTCP rule for URL $url\n" ); } + // Try and incremement value in APC cache + $id = apc_inc( 'squidhtcppurge' ); + if ( $id === false ) { + // If false, means it didn't work + // Chances are that means it isn't in the cache + // Start saving a cached value + $add = apc_add( 'squidhtcppurge', 1 ); + if ( $add === false ) { + wfDebugLog( 'htcp', 'Unable to set value to APC cache' ); + $id = 0; + } else { + $id = $add; + } + } + // Construct a minimal HTCP request diagram // as per RFC 2756 // Opcode 'CLR', no response desired, no auth - $htcpTransID = rand(); + $htcpTransID = $id; $htcpSpecifier = pack( 'na4na*na8n', 4, 'HEAD', strlen( $url ), $url, diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index c334c388d8..e7c73684d7 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -143,12 +143,12 @@ class DatabaseMysql extends DatabaseBase { if ( $success ) { // Tell the server we're communicating with it in UTF-8. // This may engage various charset conversions. - global $wgDBmysql5; + /*global $wgDBmysql5; if( $wgDBmysql5 ) { $this->query( 'SET NAMES utf8', __METHOD__ ); } else { $this->query( 'SET NAMES binary', __METHOD__ ); - } + }*/ // Set SQL mode, default is turning them all off, can be overridden or skipped with null global $wgSQLMode; if ( is_string( $wgSQLMode ) ) { diff --git a/maintenance/tables.sql b/maintenance/tables.sql index a848bf5eb4..34eba56e24 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -1121,9 +1121,9 @@ CREATE TABLE /*_*/searchindex ( si_text mediumtext NOT NULL ) ENGINE=MyISAM; -CREATE UNIQUE INDEX /*i*/si_page ON /*_*/searchindex (si_page); -CREATE FULLTEXT INDEX /*i*/si_title ON /*_*/searchindex (si_title); -CREATE FULLTEXT INDEX /*i*/si_text ON /*_*/searchindex (si_text); +-- CREATE UNIQUE INDEX /*i*/si_page ON /*_*/searchindex (si_page); +-- CREATE FULLTEXT INDEX /*i*/si_title ON /*_*/searchindex (si_title); +-- CREATE FULLTEXT INDEX /*i*/si_text ON /*_*/searchindex (si_text); -- -- 2.20.1