Throw exception when nothing to clone in CloneDatabase
authorUmherirrender <umherirrender_de.wp@web.de>
Thu, 23 Aug 2018 19:02:41 +0000 (21:02 +0200)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 24 Aug 2018 21:28:01 +0000 (21:28 +0000)
Just in case something goes wrong, when calling.

Change-Id: I4490aee6edccf0b185188250948a47b5fd8ba766

includes/db/CloneDatabase.php

index 1564fab..5f09555 100644 (file)
@@ -52,6 +52,9 @@ class CloneDatabase {
        public function __construct( IMaintainableDatabase $db, array $tablesToClone,
                $newTablePrefix, $oldTablePrefix = null, $dropCurrentTables = true
        ) {
+               if ( !$tablesToClone ) {
+                       throw new InvalidArgumentException( 'Empty list of tables to clone' );
+               }
                $this->db = $db;
                $this->tablesToClone = $tablesToClone;
                $this->newTablePrefix = $newTablePrefix;