Previous
-
+
@@ -364,3 +385,7 @@
+
diff --git a/step2a.php b/step2a.php
index 5a4428f..338217d 100644
--- a/step2a.php
+++ b/step2a.php
@@ -1,3 +1,17 @@
+
@@ -19,19 +33,19 @@
- ";
// echo $database_name."
";
@@ -40,29 +54,29 @@
// echo $database_username."
";
// echo $database_password."
";
- class TestResult
- {
- public $message;
- public $status;
-
- public function TestResult($message, $status = STATUS_OK)
- {
- $this->message = $message;
- $this->status = $status;
- }
- } // TestResult
- function check_have_inno($link)
- {
- // if($result = mysqli_query('SHOW ENGINES', $link)) {
- if ($result = $link('SHOW ENGINES')) {
- while ($engine = mysqli_fetch_assoc($result)) {
- if (strtolower($engine['Engine']) == 'innodb' && in_array(strtolower($engine['Support']), ['yes', 'default'])) {
- return true;
- } // if
- } // while
- } // if
- return true;
- } // check_have_inno
+ class TestResult
+ {
+ public $message;
+ public $status;
+
+ public function testResult($message, $status = STATUS_OK)
+ {
+ $this->message = $message;
+ $this->status = $status;
+ }
+ } // TestResult
+ function check_have_inno($link)
+ {
+ // if($result = mysqli_query('SHOW ENGINES', $link)) {
+ if ($result = $link('SHOW ENGINES')) {
+ while ($engine = mysqli_fetch_assoc($result)) {
+ if (strtolower($engine['Engine']) == 'innodb' && in_array(strtolower($engine['Support']), ['yes', 'default'])) {
+ return true;
+ } // if
+ } // while
+ } // if
+ return true;
+ } // check_have_inno
?>
@@ -89,25 +103,33 @@ function check_have_inno($link)
select_db($database_name)) {
- // $results[] = new TestResult('Database "' . $database_username . '" selected', STATUS_OK);
+ $sql = "SELECT COUNT(DISTINCT `table_name`) FROM `information_schema`.`columns` WHERE `table_schema` = '$database_name'";
+ $res = mysqli_query($connection, $sql);
+ $value = mysqli_fetch_assoc($res);
+ foreach ($value as $val) {
+ if ($val == 0) {
+ $mysqli_version = $connection->server_version;
+ $results[] = new TestResult("Database '$database_name' looks fine.", STATUS_OK);
+ $mysql_ok = true;
+ if ($connection->select_db($database_name)) {
+ // $results[] = new TestResult('Database "' . $database_username . '" selected', STATUS_OK);
//$mysql_version = mysql_get_server_info($connection);
- $mysqli_version = $connection->server_version;
- $results[] = new TestResult('Connected to database as '.$database_username.'@'.$database_host, STATUS_OK);
+ $mysqli_version = $connection->server_version;
+ $results[] = new TestResult('Connected to database as '.$database_username.'@'.$database_host, STATUS_OK);
- if (version_compare($mysqli_version, '5.0') >= 0) {
- $results[] = new TestResult('MySQL version is '.$mysqli_version, STATUS_OK);
+ if (version_compare($mysqli_version, '5.0') >= 0) {
+ $results[] = new TestResult('MySQL version is '.$mysqli_version, STATUS_OK);
+ $mysql_ok = true;
//$have_inno = check_have_inno($connection);
@@ -117,55 +139,67 @@ function check_have_inno($link)
// $results[] = new TestResult('No InnoDB support. Although activeCollab can use MyISAM storage engine InnoDB is HIGHLY recommended!', STATUS_WARNING);
// }
// } else {
- $results[] = new TestResult('Your MySQL version is '.$mysqli_version.'. We recommend upgrading to at least MySQL5!', STATUS_ERROR);
- $mysql_ok = false;
- } // if
+ } else {
+ $results[] = new TestResult('Your MySQL version is '.$mysqli_version.'. We recommend upgrading to at least MySQL5!', STATUS_ERROR);
+ $mysql_ok = false;
+ }
+ // if
+ } else {
+ $results[] = new TestResult('Failed to select database. MySQL said: '.mysqli_error($connection), STATUS_ERROR);
+ $mysql_ok = false;
+ } // if
+ } else {
+ $results[] = new TestResult('Faveo installation needs an empty database.', STATUS_ERROR);
+ $mysql_ok = false;
+ }
+ // code...
+ }
} else {
- $results[] = new TestResult('Failed to select database. MySQL said: '.mysqli_error(), STATUS_ERROR);
+ $results[] = new TestResult('Failed to connect to database. MySQL said: '.mysqli_error($connection), STATUS_ERROR);
$mysql_ok = false;
} // if
- } else {
- $results[] = new TestResult('Failed to connect to database. MySQL said: '.mysqli_error(), STATUS_ERROR);
- $mysql_ok = false;
- } // if
// ---------------------------------------------------
// Validators
// ---------------------------------------------------
- foreach ($results as $result) {
- echo '
'.$result->status.' — '.$result->message.'';
- } // foreach
+foreach ($results as $result) {
+ echo '
'.$result->status.' — '.$result->message.'';
+} // foreach
?>
-
+
-
Database connection successful. This system can run Faveo
-
Database connection unsuccessful. This system does not meet Faveo system requirements
-
-
@@ -185,4 +219,11 @@ function check_have_inno($link)
-
\ No newline at end of file
+