2012-06-06 07:04:28 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class EchoNotificationJob extends Job {
|
|
|
|
function __construct( $title, $params ) {
|
|
|
|
parent::__construct( 'EchoNotificationJob', $title, $params );
|
|
|
|
$this->event = $params['event'];
|
|
|
|
}
|
|
|
|
|
|
|
|
function run() {
|
2014-08-02 06:41:19 +00:00
|
|
|
// back compat for jobs still in queue, new jobs
|
|
|
|
// masterPos is always set. remove after deploy.
|
|
|
|
if ( isset( $this->params['masterPos'] ) ) {
|
|
|
|
$masterPos = $this->params['masterPos'];
|
|
|
|
} else {
|
|
|
|
$masterPos = $this->getMasterPosition();
|
|
|
|
}
|
|
|
|
|
|
|
|
MWEchoDbFactory::newFromDefault()->waitFor( $masterPos );
|
|
|
|
EchoNotificationController::notify( $this->event, false );
|
2015-10-01 13:48:52 +00:00
|
|
|
|
2014-08-02 06:41:19 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// back compat detects masterPos from prior job params
|
|
|
|
function getMasterPosition() {
|
|
|
|
$masterPos = array(
|
|
|
|
'wikiDb' => false,
|
|
|
|
'echoDb' => false,
|
|
|
|
);
|
2013-08-30 02:05:29 +00:00
|
|
|
if ( !empty( $this->params['mainDbMasterPos'] ) ) {
|
2014-08-02 06:41:19 +00:00
|
|
|
$masterPos['wikiDb'] = $this->params['mainDbMasterPos'];
|
2013-08-30 02:05:29 +00:00
|
|
|
}
|
|
|
|
if ( !empty( $this->params['echoDbMasterPos'] ) ) {
|
2014-08-02 06:41:19 +00:00
|
|
|
$masterPos['echoDb'] = $this->params['echoDbMasterPos'];
|
2013-08-30 02:05:29 +00:00
|
|
|
}
|
2015-10-01 13:48:52 +00:00
|
|
|
|
2014-08-02 06:41:19 +00:00
|
|
|
return $masterPos;
|
2012-06-06 07:04:28 +00:00
|
|
|
}
|
2012-07-18 19:39:33 +00:00
|
|
|
}
|