/**
  * When a page is taken over by Flow, add a revision.
  *
  * First, it provides a clearer history should Flow be disabled again later,
  * and a descriptive message when people attempt to use regular API to fetch
  * data for this "Page", which will no longer contain any useful content,
  * since Flow has taken over.
  *
  * Also: Parsoid performs an API call to fetch page information, so we need
  * to make sure a page actually exists ;)
  *
  * This method does not do any security checks regarding content model changes
  * or the like.  Those happen much earlier in the request and should be checked
  * before even attempting to create revisions which, when written to the database,
  * trigger this method through the OccupationListener.
  *
  * @param \Article $article
  * @param Workflow $workflow
  * @return Status Status for revision creation; On success (including if it already
  *  had a top-most Flow revision), it will return a good status with an associative
  *  array value.  $status->getValue()['revision'] will be a Revision
  *  $status->getValue()['already-existed'] will be set to true if no revision needed
  *  to be created
  * @throws InvalidInputException
  */
 public function ensureFlowRevision(Article $article, Workflow $workflow)
 {
     // Comment to add to the Revision to indicate Flow taking over
     $comment = '/* Taken over by Flow */';
     $page = $article->getPage();
     $revision = $page->getRevision();
     if ($revision !== null) {
         $content = $revision->getContent();
         if ($content instanceof BoardContent && $content->getWorkflowId()) {
             // Revision is already a valid BoardContent
             return Status::newGood(array('revision' => $revision, 'already-existed' => true));
         }
     }
     $status = $page->doEditContent(new BoardContent(CONTENT_MODEL_FLOW_BOARD, $workflow->isNew() ? null : $workflow->getId()), $comment, EDIT_FORCE_BOT | EDIT_SUPPRESS_RC, false, $this->getTalkpageManager());
     $value = $status->getValue();
     $value['already-existed'] = false;
     $status->setResult($status->isOK(), $value);
     return $status;
 }