/** * Hook to update source and destination translation pages on moving translation units * Hook: TitleMoveComplete * @since 2014.08 */ public static function onMoveTranslationUnits(Title &$ot, Title &$nt, User &$user, $oldid, $newid, $reason) { // Do the update only once. In case running by job queue, the update is not done here if (self::$jobQueueRunning) { return; } $groupLast = null; foreach (array($ot, $nt) as $title) { $handle = new MessageHandle($title); if (!$handle->isValid()) { continue; } // Documentation pages are never translation pages if ($handle->isDoc()) { continue; } $group = $handle->getGroup(); if (!$group instanceof WikiPageMessageGroup) { continue; } $language = $handle->getCode(); // Ignore pages such as Translations:Page/unit without language code if (strval($code) === '') { continue; } // Update the page only once if source and destination units // belong to the same page if ($group !== $groupLast) { $groupLast = $group; $page = TranslatablePage::newFromTitle($group->getTitle()); self::updateTranslationPage($page, $language, $user, 0, $reason); } } }
/** * Hook: ArticlePrepareTextForEdit * @param WikiPage $wikiPage * @param ParserOptions $popts * @return bool */ public static function disablePreSaveTransform($wikiPage, ParserOptions $popts) { global $wgTranslateUsePreSaveTransform; if (!$wgTranslateUsePreSaveTransform) { $handle = new MessageHandle($wikiPage->getTitle()); if ($handle->isMessageNamespace() && !$handle->isDoc()) { $popts->setPreSaveTransform(false); } } return true; }
public static function preventCategorization($updater) { $handle = new MessageHandle($updater->getTitle()); if ($handle->isPageTranslation() && !$handle->isDoc()) { $updater->mCategories = array(); } return true; }
/** * Hook: ArticlePrepareTextForEdit */ public static function disablePreSaveTransform( $article, ParserOptions $popts ) { $handle = new MessageHandle( $article->getTitle() ); if ( $handle->isMessageNamespace() && !$handle->isDoc() ) { $popts->setPreSaveTransform( false ); } return true; }
public static function preventCategorization(LinksUpdate $updater) { $handle = new MessageHandle($updater->getTitle()); if ($handle->isMessageNamespace() && !$handle->isDoc()) { $updater->mCategories = array(); } return true; }