Merge "Remove unused static methods in LanguageConverter subclasses"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 3 Jan 2017 15:21:50 +0000 (15:21 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 3 Jan 2017 15:21:50 +0000 (15:21 +0000)
includes/import/WikiImporter.php
languages/messages/MessagesNb.php
languages/messages/MessagesNn.php
maintenance/importDump.php
tests/phan/bin/phan

index 328cdad..1769924 100644 (file)
@@ -45,6 +45,8 @@ class WikiImporter {
        private $importTitleFactory;
        /** @var array */
        private $countableCache = [];
+       /** @var bool */
+       private $disableStatisticsUpdate = false;
 
        /**
         * Creates an ImportXMLReader drawing from the source provided
@@ -303,6 +305,14 @@ class WikiImporter {
                $this->mImportUploads = $import;
        }
 
+       /**
+        * Statistics update can cause a lot of time
+        * @since 1.29
+        */
+       public function disableStatisticsUpdate() {
+               $this->disableStatisticsUpdate = true;
+       }
+
        /**
         * Default per-page callback. Sets up some things related to site statistics
         * @param array $titleAndForeignTitle Two-element array, with Title object at
@@ -381,21 +391,23 @@ class WikiImporter {
                // suffers from issues of replica DB lag. We let WikiPage handle the total page
                // and revision count, and we implement our own custom logic for the
                // article (content page) count.
-               $page = WikiPage::factory( $title );
-               $page->loadPageData( 'fromdbmaster' );
-               $content = $page->getContent();
-               if ( $content === null ) {
-                       wfDebug( __METHOD__ . ': Skipping article count adjustment for ' . $title .
-                               ' because WikiPage::getContent() returned null' );
-               } else {
-                       $editInfo = $page->prepareContentForEdit( $content );
-                       $countKey = 'title_' . $title->getPrefixedText();
-                       $countable = $page->isCountable( $editInfo );
-                       if ( array_key_exists( $countKey, $this->countableCache ) &&
-                               $countable != $this->countableCache[$countKey] ) {
-                               DeferredUpdates::addUpdate( SiteStatsUpdate::factory( [
-                                       'articles' => ( (int)$countable - (int)$this->countableCache[$countKey] )
-                               ] ) );
+               if ( !$this->disableStatisticsUpdate ) {
+                       $page = WikiPage::factory( $title );
+                       $page->loadPageData( 'fromdbmaster' );
+                       $content = $page->getContent();
+                       if ( $content === null ) {
+                               wfDebug( __METHOD__ . ': Skipping article count adjustment for ' . $title .
+                                       ' because WikiPage::getContent() returned null' );
+                       } else {
+                               $editInfo = $page->prepareContentForEdit( $content );
+                               $countKey = 'title_' . $title->getPrefixedText();
+                               $countable = $page->isCountable( $editInfo );
+                               if ( array_key_exists( $countKey, $this->countableCache ) &&
+                                       $countable != $this->countableCache[$countKey] ) {
+                                       DeferredUpdates::addUpdate( SiteStatsUpdate::factory( [
+                                               'articles' => ( (int)$countable - (int)$this->countableCache[$countKey] )
+                                       ] ) );
+                               }
                        }
                }
 
index c378f23..548b3db 100644 (file)
@@ -47,6 +47,8 @@
  * @author לערי ריינהארט
  */
 
+$fallback = 'nn';
+
 $bookstoreList = [
        'Antikvariat.net' => 'http://www.antikvariat.net/',
        'Frida' => 'http://wo.uio.no/as/WebObjects/frida.woa/wa/fres?action=sok&isbn=$1&visParametre=1&sort=alfabetisk&bs=50',
@@ -83,6 +85,14 @@ $namespaceAliases = [
 $separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
 $linkTrail = '/^([æøåa-z]+)(.*)$/sDu';
 
+$datePreferenceMigrationMap = [
+       'default',
+       'mdy',
+       'dmy',
+       'ymd'
+];
+$defaultDateFormat = 'dmy';
+
 $dateFormats = [
        'mdy time' => 'H:i',
        'mdy date' => 'M j., Y',
index 5ceafd1..5b599a9 100644 (file)
@@ -42,6 +42,8 @@
  * @see https://nn.wikipedia.org/w/index.php?title=Brukar:Dittaeva/LanguageNn.php&action=history
  */
 
+$fallback = 'nb';
+
 $datePreferences = [
        'default',
        'dmyt',
index f0e0555..6717a8e 100644 (file)
@@ -109,7 +109,8 @@ TEXT
                }
 
                $this->output( "Done!\n" );
-               $this->output( "You might want to run rebuildrecentchanges.php to regenerate RecentChanges\n" );
+               $this->output( "You might want to run rebuildrecentchanges.php to regenerate RecentChanges,\n" );
+               $this->output( "and initSiteStats.php to update page and revision counts\n" );
        }
 
        function setNsfilter( array $namespaces ) {
@@ -283,6 +284,9 @@ TEXT
                $source = new ImportStreamSource( $handle );
                $importer = new WikiImporter( $source, $this->getConfig() );
 
+               // Updating statistics require a lot of time so disable it
+               $importer->disableStatisticsUpdate();
+
                if ( $this->hasOption( 'debug' ) ) {
                        $importer->setDebug( true );
                }
index 6ce1e84..61ad7da 100755 (executable)
@@ -31,7 +31,7 @@ fi
 
 # If the first argument doesn't start with a -, then it's a path
 # to another project (extension, skin, etc.) to analyze
-if [[ "$1" != "-"* ]]; then
+if [[ -n "$1" && "$1" != "-"* ]]; then
        cd $1
        shift
 else