public static function updateTranslationPage(TranslatablePage $page, $code, $user, $flags, $summary)
 {
     $source = $page->getTitle();
     $target = Title::makeTitle($source->getNamespace(), $source->getDBkey() . "/{$code}");
     // We don't know and don't care
     $flags &= ~EDIT_NEW & ~EDIT_UPDATE;
     // Update the target page
     $job = RenderJob::newJob($target);
     $job->setUser($user);
     $job->setSummary($summary);
     $job->setFlags($flags);
     $job->run();
     // Regenerate translation caches
     $page->getTranslationPercentages('force');
     // Invalidate caches
     $pages = $page->getTranslationPages();
     foreach ($pages as $title) {
         $article = new Article($title, 0);
         $article->doPurge();
     }
     // And the source page itself too
     $article = new Article($page->getTitle(), 0);
     $article->doPurge();
 }
	/**
	 * If this page is marked for the first time, /en may not yet exists.
	 * If this is the case, add a RenderJob for it, but don't execute it
	 * immediately, since the message group doesn't exist during this request.
	 * @param $page Article
	 * @param $titles array
	 */
	protected function addInitialRenderJob( $page, $titles ) {
		global $wgContLang;
		$en = Title::newFromText( $page->getTitle()->getPrefixedText() . '/' . $wgContLang->getCode() );
		$hasen = false;
		foreach ( $titles as $t ) {
			if ( $t->equals( $en ) ) {
				$hasen = true;
				break;
			}
		}

		if ( !$hasen ) {
			RenderJob::newJob( $en )->insert();
		}
	}