--CRM-16617, stop further processing if DB name is invalid
authorPradeep Nayak <pradpnayak@gmail.com>
Fri, 11 Sep 2015 18:49:12 +0000 (00:19 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Mon, 8 Feb 2016 15:02:27 +0000 (20:32 +0530)
install/index.php

index 99e6fc270063282be05d2c35df95640a7473e034..292879c52cfb6950ce9879a1ba0aaf9b9c3caddb 100644 (file)
@@ -394,6 +394,16 @@ class InstallRequirements {
             ts("An auto_increment_increment value greater than 1 is not currently supported. Please see issue CRM-7923 for further details and potential workaround."),
           )
         );
+        if (!$this->requireValidDBName(
+          $databaseConfig['database'],
+          array(
+            ts("MySQL %1 Configuration", array(1 => $dbName)),
+            ts("Is the provided database name valid?"),
+            ts("The database name provided is not valid. Please use only 0-9, a-z, A-Z and _ as characters in the name."),
+          ))
+        ) {
+          return FALSE;
+        }
         $this->requireMySQLThreadStack($databaseConfig['server'],
           $databaseConfig['username'],
           $databaseConfig['password'],
@@ -408,14 +418,6 @@ class InstallRequirements {
         );
       }
       $onlyRequire = ($dbName == 'Drupal') ? TRUE : FALSE;
-      $this->requireValidDBName(
-        $databaseConfig['database'],
-        array(
-          ts("MySQL %1 Configuration", array(1 => $dbName)),
-          ts("Is the provided database name valid?"),
-          ts("The database name provided is not valid. Please use only 0-9, a-z, A-Z and _ as characters in the name."),
-        )
-      );
       $this->requireDatabaseOrCreatePermissions(
         $databaseConfig['server'],
         $databaseConfig['username'],
@@ -1296,8 +1298,10 @@ class InstallRequirements {
     );
     if (empty($matches)) {
       $this->error($testDetails);
-      return;
+      return FALSE;
     }
+    $this->testing($testDetails);
+    return TRUE;
   }
 
 }