From: Brad Jorsch Date: Wed, 11 Jul 2018 19:00:41 +0000 (-0400) Subject: Fix populateContentTables.php with no rows X-Git-Tag: 1.34.0-rc.0~4796^2 X-Git-Url: https://git.cyclocoop.org/admin/%7B%24admin_url%7Dmembres/import.php?a=commitdiff_plain;h=6255eb519f05321f6a149d52d41298d070aee1b0;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 ) {