From 002fb024b0aecf4338357a1d95f0e2be95072f72 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Fri, 20 Nov 2009 15:37:28 +0000 Subject: [PATCH] * (bug 21403) memcached class renamed to MWMemecached to avoid conflict with PHP's memcached extension * Put MemCachedClientforWiki in memcached-client.php so that maintenance/mctest.php doesn't crash when $wgMainCacheType is not CACHE_MEMCACHED Based on a patch by Kim Hyun-Joon --- CREDITS | 1 + RELEASE-NOTES | 2 ++ includes/AutoLoader.php | 3 ++- includes/ObjectCache.php | 7 ------- includes/memcached-client.php | 12 +++++++++--- maintenance/mcc.php | 2 +- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/CREDITS b/CREDITS index b7e6fd6afc..0a25df2719 100644 --- a/CREDITS +++ b/CREDITS @@ -81,6 +81,7 @@ following names for their contribution to the product. * Jidanni * Jimmy Xu * Karun Dambietz +* Kim Hyun-Joon * liangent * Lucas Garczewski * Louperivois diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7b04ea007a..fc6ddab9b9 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -642,6 +642,8 @@ Hopefully we will remove this configuration var soon) instead of fsockopen() with fwrite(). * (bug 16884) Fixed feed links in sidebar not complying with URL parameters of the displayed page +* (bug 21403) memcached class renamed to MWMemecached to avoid conflict with + PHP's memcached extension == API changes in 1.16 == diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index a28ffd67f2..92c1f2a31c 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -162,10 +162,11 @@ $wgAutoloadLocalClasses = array( 'MediaWikiBagOStuff' => 'includes/BagOStuff.php', 'MediaWiki_I18N' => 'includes/SkinTemplate.php', 'MediaWiki' => 'includes/Wiki.php', - 'memcached' => 'includes/memcached-client.php', + 'MemCachedClientforWiki' => 'includes/memcached-client.php', 'MessageCache' => 'includes/MessageCache.php', 'MimeMagic' => 'includes/MimeMagic.php', 'MWException' => 'includes/Exception.php', + 'MWMemcached' => 'includes/memcached-client.php', 'MWNamespace' => 'includes/Namespace.php', 'Namespace' => 'includes/NamespaceCompat.php', // Compat 'OldChangesList' => 'includes/ChangesList.php', diff --git a/includes/ObjectCache.php b/includes/ObjectCache.php index d4f5084769..9b2835f17f 100644 --- a/includes/ObjectCache.php +++ b/includes/ObjectCache.php @@ -52,13 +52,6 @@ function &wfGetCache( $inputType ) { if ( $type == CACHE_MEMCACHED ) { if ( !array_key_exists( CACHE_MEMCACHED, $wgCaches ) ) { - if ( !class_exists( 'MemCachedClientforWiki' ) ) { - class MemCachedClientforWiki extends memcached { - function _debugprint( $text ) { - wfDebug( "memcached: $text" ); - } - } - } $wgCaches[CACHE_MEMCACHED] = new MemCachedClientforWiki( array('persistant' => $wgMemCachedPersistent, 'compress_threshold' => 1500 ) ); $wgCaches[CACHE_MEMCACHED]->set_servers( $wgMemCachedServers ); diff --git a/includes/memcached-client.php b/includes/memcached-client.php index 76bcb513e1..5e9d6cb962 100644 --- a/includes/memcached-client.php +++ b/includes/memcached-client.php @@ -44,7 +44,7 @@ * * require_once 'memcached.php'; * - * $mc = new memcached(array( + * $mc = new MWMemcached(array( * 'servers' => array('127.0.0.1:10000', * array('192.0.0.1:10010', 2), * '127.0.0.1:10020'), @@ -63,14 +63,14 @@ // {{{ requirements // }}} -// {{{ class memcached +// {{{ class MWMemcached /** * memcached client class implemented using (p)fsockopen() * * @author Ryan T. Dean * @ingroup Cache */ -class memcached +class MWMemcached { // {{{ properties // {{{ public @@ -1082,3 +1082,9 @@ class memcached // vim: sts=3 sw=3 et // }}} + +class MemCachedClientforWiki extends MWMemcached { + function _debugprint( $text ) { + wfDebug( "memcached: $text" ); + } +} diff --git a/maintenance/mcc.php b/maintenance/mcc.php index 3fa7d77ae7..909d7caa34 100644 --- a/maintenance/mcc.php +++ b/maintenance/mcc.php @@ -10,7 +10,7 @@ /** */ require_once( dirname(__FILE__) . '/commandLine.inc' ); -$mcc = new memcached( array('persistant' => true/*, 'debug' => true*/) ); +$mcc = new MWMemcached( array('persistant' => true/*, 'debug' => true*/) ); $mcc->set_servers( $wgMemCachedServers ); #$mcc->set_debug( true ); -- 2.20.1