TranslateSandboxReminderJob.php
Go to the documentation of this file.00001 <?php
00002
00003
00004 class TranslateSandboxReminderJob extends Job {
00005 public static function newJob( array $params ) {
00006 return new self( Title::newMainPage(), $params );
00007 }
00008
00009 function __construct( $title, $params, $id = 0 ) {
00010 parent::__construct( __CLASS__, $title, $params, $id );
00011 }
00012
00013 function run() {
00014 $status = UserMailer::send(
00015 $this->params['to'],
00016 $this->params['from'],
00017 $this->params['subj'],
00018 $this->params['body'],
00019 $this->params['replyto']
00020 );
00021
00022 if ( $status->isOK() ) {
00023 $user = User::newFromId( 'user' );
00024 $reminders = $user->getOption( 'translate-sandbox-reminders' );
00025 if ( $reminders ) {
00026 $reminders = explode( '|', $reminders );
00027 } else {
00028 $reminders = array();
00029 }
00030 $reminders[] = wfTimestamp();
00031 $user->setOption( 'translate-sandbox-reminders', implode( '|', $reminders ) );
00032 $user->saveSettings();
00033 }
00034
00035 return $status->isOk();
00036 }
00037 }