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 = TranslateRenderJob::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) { $wikiPage = WikiPage::factory($title); $wikiPage->doPurge(); } // And the source page itself too $wikiPage = WikiPage::factory($page->getTitle()); $wikiPage->doPurge(); }