Exit populateIpChanges maintenance script if there are no revisions
authorMusikAnimal <musikanimal@gmail.com>
Mon, 26 Feb 2018 17:38:46 +0000 (12:38 -0500)
committerMusikAnimal <musikanimal@gmail.com>
Mon, 26 Feb 2018 18:35:46 +0000 (13:35 -0500)
Bug: T188225
Change-Id: Ice1bdae3d16cf365da14c6df0e8d91d2b914f064

maintenance/populateIpChanges.php

index 5174758..7bb1605 100644 (file)
@@ -76,6 +76,12 @@ TEXT
                $end = $maxRevId > 0
                        ? $maxRevId
                        : $dbw->selectField( 'revision', 'MAX(rev_id)', false, __METHOD__ );
                $end = $maxRevId > 0
                        ? $maxRevId
                        : $dbw->selectField( 'revision', 'MAX(rev_id)', false, __METHOD__ );
+
+               if ( empty( $end ) ) {
+                       $this->output( "No revisions found, aborting.\n" );
+                       return true;
+               }
+
                $blockStart = $start;
                $attempted = 0;
                $inserted = 0;
                $blockStart = $start;
                $attempted = 0;
                $inserted = 0;