refresh-translatable-pages.php

Go to the documentation of this file.
00001 <?php
00010 // Standard boilerplate to define $IP
00011 if ( getenv( 'MW_INSTALL_PATH' ) !== false ) {
00012     $IP = getenv( 'MW_INSTALL_PATH' );
00013 } else {
00014     $dir = __DIR__;
00015     $IP = "$dir/../../..";
00016 }
00017 require_once "$IP/maintenance/Maintenance.php";
00018 
00023 class RefreshTranslatablePages extends Maintenance {
00024     public function __construct() {
00025         parent::__construct();
00026         $this->mDescription = 'Ensure all translation pages are up to date.';
00027     }
00028 
00029     public function execute() {
00030         $groups = MessageGroups::singleton()->getGroups();
00031 
00033         foreach ( $groups as $group ) {
00034             if ( !$group instanceof WikiPageMessageGroup ) {
00035                 continue;
00036             }
00037 
00038             // Get all translation subpages and refresh each one of them
00039             $page = TranslatablePage::newFromTitle( $group->getTitle() );
00040             $translationPages = $page->getTranslationPages();
00041 
00042             foreach ( $translationPages as $subpage ) {
00043                 $job = TranslateRenderJob::newJob( $subpage );
00044                 $job->run();
00045             }
00046         }
00047     }
00048 }
00049 
00050 $maintClass = 'RefreshTranslatablePages';
00051 require_once RUN_MAINTENANCE_IF_MAIN;
Generated on Tue Oct 29 00:00:24 2013 for MediaWiki Translate Extension by  doxygen 1.6.3