mDescription = "Process email digest"; } protected function init() { $this->dbr = wfGetDB( DB_SLAVE ); } public function execute() { $this->init(); $this->output( "Started processing... \n" ); $startUserId = 0; $count = $this->batchSize; while ( $count === $this->batchSize ) { $count = 0; $res = $this->dbr->select( array( 'echo_email_batch' ), array( 'eeb_user_id' ), array( 'eeb_user_id > ' . $startUserId ), __METHOD__, array( 'ORDER BY' => 'eeb_user_id', 'LIMIT' => $this->batchSize ) ); $updated = false; foreach ( $res as $row ) { $userId = intval( $row->eeb_user_id ); if ( $userId && $userId > $startUserId ) { $emailBatch = MWEchoEmailBatch::newFromUserId( $userId ); if ( $emailBatch ) { $this->output( "processing user_Id " . $userId . " \n" ); $emailBatch->process(); } $startUserId = $userId; $updated = true; } $count++; } wfWaitForSlaves(); // double check to make sure that the id is updated if ( !$updated ) { break; } } $this->output( "Completed \n" ); } } $maintClass = "processEchoEmailBatch"; require_once( DO_MAINTENANCE );