mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 16:04:35 +00:00
d44ed993a2
* This patch needs intensive testing on Redis delayed job queue * This patch is -2 mainly for redis/phpredis are not ready on test/test2/mediawiki To test this locally, you need to: * set up Redis and phpredis locally * add the following to localSettings.php $wgJobTypeConf['MWEchoNotificationEmailBundleJob'] = array( 'class' => 'JobQueueRedis', 'redisServer' => '127.0.0.1', 'redisConfig' => array( 'connectTimeout' => 1 ), 'claimTTL' => 3600, 'checkDelay' => true ); * set $wgMainCacheType to CACHE_DB or memcache * set $wgEchoBundleEmailInterval to smaller number for testing purpose, 0 to disable email bundling Change-Id: I9313e7f6ed3e13478cec294b5b8408fe8e941faf
25 lines
780 B
PHP
25 lines
780 B
PHP
<?php
|
|
|
|
class MWEchoNotificationEmailBundleJob extends Job {
|
|
function __construct( $title, $params ) {
|
|
parent::__construct( 'MWEchoNotificationEmailBundleJob', $title, $params );
|
|
// If there is already a job with the same params, this job will be ignored
|
|
// for example, if there is a page link bundle notification job for article A
|
|
// created by user B, any subsequent jobs with the same data will be ignored
|
|
$this->removeDuplicates = true;
|
|
}
|
|
|
|
function run() {
|
|
$user = User::newFromId( $this->params['user_id'] );
|
|
if ( $user ) {
|
|
$bundle = MWEchoEmailBundler::newFromUserHash( $user, $this->params['bundle_hash'] );
|
|
if ( $bundle ) {
|
|
$bundle->processBundleEmail();
|
|
}
|
|
} else {
|
|
//@Todo: delete notifications for this user_id
|
|
}
|
|
return true;
|
|
}
|
|
}
|