mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-28 01:30:15 +00:00
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
This commit is contained in:
parent
b34e30cefb
commit
e9d042283c
|
@ -7,8 +7,6 @@
|
||||||
*/
|
*/
|
||||||
abstract class MWEchoBackend {
|
abstract class MWEchoBackend {
|
||||||
|
|
||||||
private static $cache = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory to initialize a backend class
|
* Factory to initialize a backend class
|
||||||
* @param $backend string
|
* @param $backend string
|
||||||
|
@ -24,11 +22,7 @@ abstract class MWEchoBackend {
|
||||||
throw new MWException( "$backend backend is not supported" );
|
throw new MWException( "$backend backend is not supported" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isset( self::$cache[$backend] ) ) {
|
return new $className();
|
||||||
self::$cache[$backend] = new $className();
|
|
||||||
}
|
|
||||||
|
|
||||||
return self::$cache[$backend];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -68,7 +68,7 @@ abstract class MWEchoEmailBundler {
|
||||||
$className = 'MW' . $wgEchoBackendName . 'EchoEmailBundler';
|
$className = 'MW' . $wgEchoBackendName . 'EchoEmailBundler';
|
||||||
|
|
||||||
if ( !class_exists( $className ) ) {
|
if ( !class_exists( $className ) ) {
|
||||||
throw new MWException( "$wgEchoBackendName email batch is not supported!" );
|
throw new MWException( "$wgEchoBackendName email bundler is not supported!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $className;
|
return $className;
|
||||||
|
@ -131,11 +131,7 @@ abstract class MWEchoEmailBundler {
|
||||||
return $this->emailInterval + 600;
|
return $this->emailInterval + 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
static $now;
|
$now = wfTimestamp( TS_UNIX );
|
||||||
|
|
||||||
if ( !$now ) {
|
|
||||||
$now = wfTimestamp( TS_UNIX );
|
|
||||||
}
|
|
||||||
|
|
||||||
return $now - wfTimestamp( TS_UNIX, $this->timestamp );
|
return $now - wfTimestamp( TS_UNIX, $this->timestamp );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue