From 6255eb519f05321f6a149d52d41298d070aee1b0 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Wed, 11 Jul 2018 15:00:41 -0400 Subject: [PATCH] Fix populateContentTables.php with no rows MIN() and MAX() return null if there are no rows. Fill in a dummy row in that case. Change-Id: I7caba98a5ec30e15e19d49effa22a70c78a71c28 --- maintenance/populateContentTables.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/maintenance/populateContentTables.php b/maintenance/populateContentTables.php index 5322b5beec..20d6b8b740 100644 --- a/maintenance/populateContentTables.php +++ b/maintenance/populateContentTables.php @@ -188,6 +188,11 @@ class PopulateContentTables extends Maintenance { '', __METHOD__ ); + if ( !$minmax || !is_numeric( $minmax->min ) || !is_numeric( $minmax->max ) ) { + // No rows? + $minmax = (object)[ 'min' => 1, 'max' => 0 ]; + } + $batchSize = $this->getBatchSize(); for ( $startId = $minmax->min; $startId <= $minmax->max; $startId += $batchSize ) { -- 2.20.1