From e9d042283c38f26dc44094aac3ea52a36c615e64 Mon Sep 17 00:00:00 2001 From: bsitu Date: Thu, 18 Apr 2013 20:12:29 -0700 Subject: [PATCH] Remove static object cache to avoid cross wiki related issue Some script like job runners are running against multiple wikis, caching the object would make later wikis use the incorrect object, it's global variable anyway, there is no need to cache it Change-Id: I427a5cefbd607aaf897dfa07087e381faffea495 --- includes/EchoBackend.php | 8 +------- includes/EmailBundler.php | 8 ++------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/includes/EchoBackend.php b/includes/EchoBackend.php index 2ee2ba113..d1d212349 100644 --- a/includes/EchoBackend.php +++ b/includes/EchoBackend.php @@ -7,8 +7,6 @@ */ abstract class MWEchoBackend { - private static $cache = array(); - /** * Factory to initialize a backend class * @param $backend string @@ -24,11 +22,7 @@ abstract class MWEchoBackend { throw new MWException( "$backend backend is not supported" ); } - if ( !isset( self::$cache[$backend] ) ) { - self::$cache[$backend] = new $className(); - } - - return self::$cache[$backend]; + return new $className(); } /** diff --git a/includes/EmailBundler.php b/includes/EmailBundler.php index 3fa5f0179..89d36dd65 100644 --- a/includes/EmailBundler.php +++ b/includes/EmailBundler.php @@ -68,7 +68,7 @@ abstract class MWEchoEmailBundler { $className = 'MW' . $wgEchoBackendName . 'EchoEmailBundler'; if ( !class_exists( $className ) ) { - throw new MWException( "$wgEchoBackendName email batch is not supported!" ); + throw new MWException( "$wgEchoBackendName email bundler is not supported!" ); } return $className; @@ -131,11 +131,7 @@ abstract class MWEchoEmailBundler { return $this->emailInterval + 600; } - static $now; - - if ( !$now ) { - $now = wfTimestamp( TS_UNIX ); - } + $now = wfTimestamp( TS_UNIX ); return $now - wfTimestamp( TS_UNIX, $this->timestamp ); }