/**
  * @param AbstractRevision $revision Revision object
  * @param array $row Revision row
  * @param array $metadata;
  */
 public function onAfterInsert($revision, array $row, array $metadata)
 {
     global $wgRCFeeds;
     // No action on imported revisions
     if (isset($metadata['imported']) && $metadata['imported']) {
         return;
     }
     $action = $revision->getChangeType();
     $revisionId = $revision->getRevisionId()->getAlphadecimal();
     $timestamp = $revision->getRevisionId()->getTimestamp();
     /** @var Workflow $workflow */
     $workflow = $metadata['workflow'];
     $user = $revision->getUser();
     if (!$this->isAllowed($revision, $action)) {
         return;
     }
     $title = $this->getRcTitle($workflow, $revision->getChangeType());
     $attribs = array('rc_namespace' => $title->getNamespace(), 'rc_title' => $title->getDBkey(), 'rc_user' => $row['rev_user_id'], 'rc_user_text' => $this->usernames->get(wfWikiId(), $row['rev_user_id'], $row['rev_user_ip']), 'rc_type' => RC_FLOW, 'rc_source' => self::SRC_FLOW, 'rc_minor' => 0, 'rc_bot' => 0, 'rc_patrolled' => $user->isAllowed('autopatrol') ? 1 : 0, 'rc_old_len' => $revision->getPreviousContentLength(), 'rc_new_len' => $revision->getContentLength(), 'rc_this_oldid' => 0, 'rc_last_oldid' => 0, 'rc_log_type' => null, 'rc_params' => serialize(array('flow-workflow-change' => array('action' => $action, 'revision_type' => get_class($revision), 'revision' => $revisionId, 'workflow' => $workflow->getId()->getAlphadecimal()))), 'rc_cur_id' => 0, 'rc_comment' => '', 'rc_timestamp' => $timestamp, 'rc_deleted' => 0);
     $rc = $this->rcFactory->newFromRow((object) $attribs);
     $rc->save(true);
     // Insert into db
     $feeds = $wgRCFeeds;
     // Override the IRC formatter with our own formatter
     foreach (array_keys($feeds) as $name) {
         $feeds[$name]['original_formatter'] = $feeds[$name]['formatter'];
         $feeds[$name]['formatter'] = $this->ircFormatter;
     }
     // pre-load the irc formatter which will be triggered via hook
     $this->ircFormatter->associate($rc, array('revision' => $revision) + $metadata);
     // run the feeds/irc/etc external notifications
     $rc->notifyRCFeeds($feeds);
 }