Commit of various live hacks
authorReedy <reedy@formey.wikimedia.org>
Tue, 10 Apr 2012 18:27:59 +0000 (18:27 +0000)
committerChad Horohoe <chadh@wikimedia.org>
Mon, 10 Dec 2012 18:33:12 +0000 (13:33 -0500)
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

Original revision Change-Id I42c4f859e55eb198f6c6841e582b3552aad7b31f
https://gerrit.wikimedia.org/r/#/c/7606

Change-Id: I5ec8dd53188e9e4128f99ceaff38ebf9dcf570bb

includes/DefaultSettings.php
includes/MessageBlobStore.php
includes/cache/SquidUpdate.php
includes/db/DatabaseMysql.php
includes/job/jobs/HTMLCacheUpdateJob.php
maintenance/tables.sql

index e12b3be..c2f7ea6 100644 (file)
@@ -184,7 +184,8 @@ $wgLoadScript = false;
  * Defaults to "{$wgScriptPath}/skins".
  */
 $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.
@@ -4089,10 +4090,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 ),
-       ),
+       ), */
 );
 
 /**
index 09561bd..5251643 100644 (file)
@@ -231,6 +231,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 );
index 6b48fa4..897397e 100644 (file)
@@ -202,10 +202,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,
index 36a1126..5e385aa 100644 (file)
@@ -152,11 +152,11 @@ class DatabaseMysql extends DatabaseBase {
 
                // Tell the server we're communicating with it in UTF-8.
                // This may engage various charset conversions.
-               if( $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
                if ( is_string( $wgSQLMode ) ) {
                        $mode = $this->addQuotes( $wgSQLMode );
index 20245b3..55c9f99 100644 (file)
@@ -236,13 +236,19 @@ class HTMLCacheUpdateJob extends Job {
                                array( 'page_id' => $batch ) + $touchedCond,
                                __METHOD__
                        );
+                       # WM patch: throttle to avoid apache CPU exhaustion -- TS
+                       if ( php_sapi_name() == 'cli' ) {
+                               sleep( 1 );
+                       }
                }
 
+               # Disable this as a temporary measure per private-l post -- TS
                # Update squid
+               /*
                if ( $wgUseSquid ) {
                        $u = SquidUpdate::newFromTitles( $titleArray );
                        $u->doUpdate();
-               }
+               } */
 
                # Update file cache
                if  ( $wgUseFileCache ) {
index c9a188b..ca301ae 100644 (file)
@@ -1141,9 +1141,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);
 
 
 --