Browse Source

Add more logging to DB update

causefx 7 years ago
parent
commit
57259e2ead
1 changed files with 2 additions and 2 deletions
  1. 2 2
      api/functions/api-functions.php

+ 2 - 2
api/functions/api-functions.php

@@ -279,8 +279,8 @@ function updateDB($oldVerNum = false)
 					writeLog('success', 'Update Function -  Grabbed Table data for Table: ' . $table['name'], 'Database');
 					writeLog('success', 'Update Function -  Grabbed Table data for Table: ' . $table['name'], 'Database');
 					foreach ($data as $row) {
 					foreach ($data as $row) {
 						$connectNewDB->query('INSERT into ' . $table['name'], $row);
 						$connectNewDB->query('INSERT into ' . $table['name'], $row);
-						writeLog('success', 'Update Function -  Wrote Table data for Table: ' . $table['name'], 'Database');
 					}
 					}
+					writeLog('success', 'Update Function -  Wrote Table data for Table: ' . $table['name'], 'Database');
 				}
 				}
 				writeLog('success', 'Update Function -  All Table data converted - Starting Movement', 'Database');
 				writeLog('success', 'Update Function -  All Table data converted - Starting Movement', 'Database');
 				$connectOldDB->disconnect();
 				$connectOldDB->disconnect();
@@ -289,7 +289,7 @@ function updateDB($oldVerNum = false)
 				if (file_exists($GLOBALS['dbLocation'] . $migrationDB)) {
 				if (file_exists($GLOBALS['dbLocation'] . $migrationDB)) {
 					$oldFileSize = filesize($GLOBALS['dbLocation'] . $GLOBALS['dbName']);
 					$oldFileSize = filesize($GLOBALS['dbLocation'] . $GLOBALS['dbName']);
 					$newFileSize = filesize($GLOBALS['dbLocation'] . $migrationDB);
 					$newFileSize = filesize($GLOBALS['dbLocation'] . $migrationDB);
-					if ($newFileSize >= $oldFileSize) {
+					if ($newFileSize > 0) {
 						writeLog('success', 'Update Function -  Table Size of new DB ok..', 'Database');
 						writeLog('success', 'Update Function -  Table Size of new DB ok..', 'Database');
 						@unlink($GLOBALS['dbLocation'] . $GLOBALS['dbName']);
 						@unlink($GLOBALS['dbLocation'] . $GLOBALS['dbName']);
 						copy($GLOBALS['dbLocation'] . $migrationDB, $GLOBALS['dbLocation'] . $GLOBALS['dbName']);
 						copy($GLOBALS['dbLocation'] . $migrationDB, $GLOBALS['dbLocation'] . $GLOBALS['dbName']);