|
|
@@ -276,10 +276,13 @@ function updateDB($oldVerNum = false)
|
|
|
$tables = $connectOldDB->fetchAll('SELECT name FROM sqlite_master WHERE type="table"');
|
|
|
foreach ($tables as $table) {
|
|
|
$data = $connectOldDB->fetchAll('SELECT * FROM ' . $table['name']);
|
|
|
+ writeLog('success', 'Update Function - Grabbed Table data for Table: ' . $table['name'], 'Database');
|
|
|
foreach ($data as $row) {
|
|
|
$connectNewDB->query('INSERT into ' . $table['name'], $row);
|
|
|
+ writeLog('success', 'Update Function - Wrote Table data for Table: ' . $table['name'], 'Database');
|
|
|
}
|
|
|
}
|
|
|
+ writeLog('success', 'Update Function - All Table data converted - Starting Movement', 'Database');
|
|
|
$connectOldDB->disconnect();
|
|
|
$connectNewDB->disconnect();
|
|
|
// Remove Current Database
|
|
|
@@ -287,6 +290,7 @@ function updateDB($oldVerNum = false)
|
|
|
$oldFileSize = filesize($GLOBALS['dbLocation'] . $GLOBALS['dbName']);
|
|
|
$newFileSize = filesize($GLOBALS['dbLocation'] . $migrationDB);
|
|
|
if ($newFileSize >= $oldFileSize) {
|
|
|
+ writeLog('success', 'Update Function - Table Size of new DB ok..', 'Database');
|
|
|
@unlink($GLOBALS['dbLocation'] . $GLOBALS['dbName']);
|
|
|
copy($GLOBALS['dbLocation'] . $migrationDB, $GLOBALS['dbLocation'] . $GLOBALS['dbName']);
|
|
|
@unlink($GLOBALS['dbLocation'] . $migrationDB);
|