diff --git a/src/Include/LoadConfigs.php b/src/Include/LoadConfigs.php index ab3cf426f8..001320fc22 100644 --- a/src/Include/LoadConfigs.php +++ b/src/Include/LoadConfigs.php @@ -72,22 +72,6 @@ function mysql_failure($message) mysql_select_db($sDATABASE) or mysql_failure("Could not connect to the MySQL database " . $sDATABASE . ". Please check the settings in Include/Config.php.
MySQL Error: " . mysql_error()); -$sql = "SHOW TABLES FROM `$sDATABASE`"; -$tablecheck = mysql_num_rows(mysql_query($sql)); - -if (!$tablecheck) { - $systemService = new SystemService(); - $setupQueries = dirname(__file__) . '/../mysql/install/Install.sql'; - $systemService->playbackSQLtoDatabase($setupQueries); - $configQueries = dirname(__file__) . '/../mysql/upgrade/update_config.sql'; - $systemService->playbackSQLtoDatabase($configQueries); - $version = new Version(); - $version->setVersion($systemService->getInstalledVersion()); - $version->setUpdateStart(new DateTime()); - $version->setUpdateEnd(new DateTime()); - $version->save(); -} - // Initialize the session session_name('CRM@' . $sRootPath); session_start(); @@ -131,6 +115,25 @@ function mysql_failure($message) $logger->pushHandler(new StreamHandler('/tmp/ChurchCRM.log')); $serviceContainer->setLogger('defaultLogger', $logger); +$connection = Propel::getConnection(); +$query = "SHOW TABLES FROM `$sDATABASE`"; +$statement = $connection->prepare($query); +$resultset = $statement->execute(); +$results = $statement->fetchAll(\PDO::FETCH_ASSOC); + +if (count($results) == 0) { + $systemService = new SystemService(); + $setupQueries = dirname(__file__) . '/../mysql/install/Install.sql'; + $systemService->playbackSQLtoDatabase($setupQueries); + $configQueries = dirname(__file__) . '/../mysql/upgrade/update_config.sql'; + $systemService->playbackSQLtoDatabase($configQueries); + $version = new Version(); + $version->setVersion($systemService->getInstalledVersion()); + $version->setUpdateStart(new DateTime()); + $version->setUpdateEnd(new DateTime()); + $version->save(); +} + // Read values from config table into local variables // ************************************************** diff --git a/src/IntegrityCheck.php b/src/IntegrityCheck.php index 0879fc3553..3ec2ade4b5 100644 --- a/src/IntegrityCheck.php +++ b/src/IntegrityCheck.php @@ -26,13 +26,13 @@ if(count($IntegrityCheckDetails->files) > 0 ) { ?> -

+

: