kopia lustrzana https://github.com/jprochazka/adsb-receiver
Made ready for v2.0.2 release.
rodzic
17250fc3b4
commit
de2b15a814
|
@ -32,11 +32,17 @@
|
|||
$common = new common();
|
||||
|
||||
// The most current stable release.
|
||||
$thisVersion = "2.0.1";
|
||||
$thisVersion = "2.0.2";
|
||||
|
||||
// Begin the upgrade process if this release is newer than what is installed.
|
||||
if (file_exists("../classes/settings.class.php")) {
|
||||
header ("Location: /install/upgrade.php");
|
||||
if ($common-> getSetting("version" < $thisVersion) {
|
||||
// THis is an older version so forward the user to upgrade.php
|
||||
header ("Location: /install/upgrade.php");
|
||||
} else {
|
||||
// It would appear the this is a current version so forward the user to the index page.
|
||||
header ("Location: /");
|
||||
}
|
||||
}
|
||||
|
||||
// BEGIN FRESH INSTALLATION
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
$settings = new settings();
|
||||
|
||||
// The most current stable release.
|
||||
$thisVersion = "2.0.1";
|
||||
$thisVersion = "2.0.2";
|
||||
|
||||
// Begin the upgrade process if this release is newer than what is installed.
|
||||
if ($common->getSetting("version") == $thisVersion) {
|
||||
|
@ -45,146 +45,166 @@
|
|||
$error = FALSE;
|
||||
#errorMessage = "No error message returned.";
|
||||
|
||||
try {
|
||||
// Change tables containing datetime data to datetime.
|
||||
if ($settings::db_driver != "xml") {
|
||||
///////////////////////
|
||||
// UPGRADE TO V2.0.1
|
||||
///////////////////////
|
||||
|
||||
// ALter MySQL tables.
|
||||
if ($settings::db_driver != "mysql") {
|
||||
if ($common->getSetting("version") == "2.0.0") {
|
||||
try {
|
||||
// Change tables containing datetime data to datetime.
|
||||
if ($settings::db_driver != "xml") {
|
||||
|
||||
// ALter MySQL tables.
|
||||
if ($settings::db_driver != "mysql") {
|
||||
$dbh = $common->pdoOpen();
|
||||
|
||||
$sql = "ALTER TABLE ".$settings::db_prefix."aircraft MODIFY firstSeen DATETIME NOT NULL";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
|
||||
$sql = "ALTER TABLE adsb_aircraft MODIFY lastSeen DATETIME NOT NULL";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
|
||||
$sql = "ALTER TABLE adsb_blogPosts MODIFY date DATETIME NOT NULL";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
|
||||
$sql = "ALTER TABLE adsb_flights MODIFY firstSeen DATETIME NOT NULL";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
|
||||
$sql = "ALTER TABLE adsb_flights MODIFY firstSeen DATETIME NOT NULL";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
|
||||
$sql = "ALTER TABLE adsb_positions MODIFY time DATETIME NOT NULL";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
|
||||
$dbh = NULL;
|
||||
}
|
||||
|
||||
// Convert times to GMT.
|
||||
|
||||
// You may wish to uncomment this block of code in order to convert existing times
|
||||
// stored in the database to UTC/GMT time. Before doing so it is recommended that
|
||||
// you set the setting max_execution_time setting to a large amount of time in your
|
||||
// php.ini file. Depending on the amount of flight data logged this may take quite
|
||||
// some time for this upgrade script to complete so be patient and let it run it's
|
||||
// course. Afterwards set the max_execution_time back to it previous setting.
|
||||
|
||||
/*
|
||||
$dbh = $common->pdoOpen();
|
||||
|
||||
$sql = "ALTER TABLE ".$settings::db_prefix."aircraft MODIFY firstSeen DATETIME NOT NULL";
|
||||
$sql = "SELECT id, firstSeen, lastSeen FROM ".$settings::db_prefix."aircraft";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
|
||||
$sql = "ALTER TABLE adsb_aircraft MODIFY lastSeen DATETIME NOT NULL";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
|
||||
$sql = "ALTER TABLE adsb_blogPosts MODIFY date DATETIME NOT NULL";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
|
||||
$sql = "ALTER TABLE adsb_flights MODIFY firstSeen DATETIME NOT NULL";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
|
||||
$sql = "ALTER TABLE adsb_flights MODIFY firstSeen DATETIME NOT NULL";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
|
||||
$sql = "ALTER TABLE adsb_positions MODIFY time DATETIME NOT NULL";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
|
||||
$dbh = NULL;
|
||||
}
|
||||
|
||||
// Convert times to GMT.
|
||||
|
||||
// You may wish to uncomment this block of code in order to convert existing times
|
||||
// stored in the database to UTC/GMT time. Before doing so it is recommended that
|
||||
// you set the setting max_execution_time setting to a large amount of time in your
|
||||
// php.ini file. Depending on the amount of flight data logged this may take quite
|
||||
// some time for this upgrade script to complete so be patient and let it run it's
|
||||
// course. Afterwards set the max_execution_time back to it previous setting.
|
||||
|
||||
/*
|
||||
$dbh = $common->pdoOpen();
|
||||
$sql = "SELECT id, firstSeen, lastSeen FROM ".$settings::db_prefix."aircraft";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$aircraft = $sth->fetchAll();
|
||||
$sth = NULL;
|
||||
$dbh = NULL;
|
||||
|
||||
foreach ($aircraft as $airframe) {
|
||||
$dbh = $common->pdoOpen();
|
||||
$sql = "UPDATE ".$settings::db_prefix."aircraft SET firstSeen = :firstSeen, lastSeen = :lastSeen WHERE id = :id";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->bindParam(':firstSeen', gmdate("Y-m-d H:i:s", $airframe["firstSeen"]), PDO::PARAM_STR);
|
||||
$sth->bindParam(':lastSeen', gmdate("Y-m-d H:i:s", $airframe["lastSeen"]), PDO::PARAM_STR);
|
||||
$sth->bindParam(':id', $airframe["id"], PDO::PARAM_INT);
|
||||
$sth->execute();
|
||||
$aircraft = $sth->fetchAll();
|
||||
$sth = NULL;
|
||||
$dbh = NULL;
|
||||
}
|
||||
|
||||
$dbh = $common->pdoOpen();
|
||||
$sql = "SELECT id, date FROM ".$settings::db_prefix."blogPosts";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$blogPosts = $sth->fetchAll();
|
||||
$sth = NULL;
|
||||
$dbh = NULL;
|
||||
foreach ($aircraft as $airframe) {
|
||||
$dbh = $common->pdoOpen();
|
||||
$sql = "UPDATE ".$settings::db_prefix."aircraft SET firstSeen = :firstSeen, lastSeen = :lastSeen WHERE id = :id";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->bindParam(':firstSeen', gmdate("Y-m-d H:i:s", $airframe["firstSeen"]), PDO::PARAM_STR);
|
||||
$sth->bindParam(':lastSeen', gmdate("Y-m-d H:i:s", $airframe["lastSeen"]), PDO::PARAM_STR);
|
||||
$sth->bindParam(':id', $airframe["id"], PDO::PARAM_INT);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
$dbh = NULL;
|
||||
}
|
||||
|
||||
foreach ($blogPosts as $post) {
|
||||
$dbh = $common->pdoOpen();
|
||||
$sql = "UPDATE ".$settings::db_prefix."blogPosts SET date = :date WHERE id = :id";
|
||||
$sql = "SELECT id, date FROM ".$settings::db_prefix."blogPosts";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->bindParam(':date', gmdate("Y-m-d H:i:s", $post["date"]), PDO::PARAM_STR);
|
||||
$sth->bindParam(':id', $post["id"], PDO::PARAM_INT);
|
||||
$sth->execute();
|
||||
$blogPosts = $sth->fetchAll();
|
||||
$sth = NULL;
|
||||
$dbh = NULL;
|
||||
}
|
||||
|
||||
$dbh = $common->pdoOpen();
|
||||
$sql = "SELECT id, firstSeen, lastSeen FROM ".$settings::db_prefix."flights";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$flights = $sth->fetchAll();
|
||||
$sth = NULL;
|
||||
$dbh = NULL;
|
||||
foreach ($blogPosts as $post) {
|
||||
$dbh = $common->pdoOpen();
|
||||
$sql = "UPDATE ".$settings::db_prefix."blogPosts SET date = :date WHERE id = :id";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->bindParam(':date', gmdate("Y-m-d H:i:s", $post["date"]), PDO::PARAM_STR);
|
||||
$sth->bindParam(':id', $post["id"], PDO::PARAM_INT);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
$dbh = NULL;
|
||||
}
|
||||
|
||||
foreach ($flights as $flight) {
|
||||
$dbh = $common->pdoOpen();
|
||||
$sql = "UPDATE ".$settings::db_prefix."flights SET firstSeen = :firstSeen, lastSeen = lastSeen WHERE id = :id";
|
||||
$sql = "SELECT id, firstSeen, lastSeen FROM ".$settings::db_prefix."flights";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->bindParam(':firstSeen', gmdate("Y-m-d H:i:s", $flight["firstSeen"]), PDO::PARAM_STR);
|
||||
$sth->bindParam(':lastSeen', gmdate("Y-m-d H:i:s", $flight["lastSeen"]), PDO::PARAM_STR);
|
||||
$sth->bindParam(':id', $flight["id"], PDO::PARAM_INT);
|
||||
$sth->execute();
|
||||
$flights = $sth->fetchAll();
|
||||
$sth = NULL;
|
||||
$dbh = NULL;
|
||||
}
|
||||
|
||||
$dbh = $common->pdoOpen();
|
||||
$sql = "SELECT id, time FROM ".$settings::db_prefix."positions";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$positionss = $sth->fetchAll();
|
||||
$sth = NULL;
|
||||
$dbh = NULL;
|
||||
foreach ($flights as $flight) {
|
||||
$dbh = $common->pdoOpen();
|
||||
$sql = "UPDATE ".$settings::db_prefix."flights SET firstSeen = :firstSeen, lastSeen = lastSeen WHERE id = :id";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->bindParam(':firstSeen', gmdate("Y-m-d H:i:s", $flight["firstSeen"]), PDO::PARAM_STR);
|
||||
$sth->bindParam(':lastSeen', gmdate("Y-m-d H:i:s", $flight["lastSeen"]), PDO::PARAM_STR);
|
||||
$sth->bindParam(':id', $flight["id"], PDO::PARAM_INT);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
$dbh = NULL;
|
||||
}
|
||||
|
||||
foreach ($positions as $position) {
|
||||
$dbh = $common->pdoOpen();
|
||||
$sql = "UPDATE ".$settings::db_prefix."positions SET time = :time WHERE id = :id";
|
||||
$sql = "SELECT id, time FROM ".$settings::db_prefix."positions";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->bindParam(':time', gmdate("Y-m-d H:i:s", $position["time"]), PDO::PARAM_STR);
|
||||
$sth->bindParam(':id', $position["id"], PDO::PARAM_INT);
|
||||
$sth->execute();
|
||||
$positionss = $sth->fetchAll();
|
||||
$sth = NULL;
|
||||
$dbh = NULL;
|
||||
|
||||
foreach ($positions as $position) {
|
||||
$dbh = $common->pdoOpen();
|
||||
$sql = "UPDATE ".$settings::db_prefix."positions SET time = :time WHERE id = :id";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->bindParam(':time', gmdate("Y-m-d H:i:s", $position["time"]), PDO::PARAM_STR);
|
||||
$sth->bindParam(':id', $position["id"], PDO::PARAM_INT);
|
||||
$sth->execute();
|
||||
$sth = NULL;
|
||||
$dbh = NULL;
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
|
||||
// Add timezone setting.
|
||||
$common->addSetting("timeZone", date_default_timezone_get());
|
||||
|
||||
// update version and patch settings.
|
||||
$common->updateSetting("version", "2.0.1");
|
||||
$common->updateSetting("patch", "");
|
||||
} catch(Exception $e) {
|
||||
$error = TRUE;
|
||||
$errorMessage = $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// Add timezone setting.
|
||||
$common->addSetting("timeZone", date_default_timezone_get());
|
||||
///////////////////////
|
||||
// UPGRADE RO V2.0.2
|
||||
///////////////////////
|
||||
|
||||
// update version and patch settings.
|
||||
$common->updateSetting("version", $thisVersion);
|
||||
$common->updateSetting("patch", "");
|
||||
} catch(Exception $e) {
|
||||
$error = TRUE;
|
||||
$errorMessage = $e->getMessage();
|
||||
if ($common->getSetting("version") == "2.0.1") {
|
||||
try {
|
||||
$common->updateSetting("version", $thisVersion);
|
||||
$common->updateSetting("patch", "");
|
||||
} catch(Exception $e) {
|
||||
$error = TRUE;
|
||||
$errorMessage = $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
require_once('../admin/includes/header.inc.php');
|
||||
|
|
Ładowanie…
Reference in New Issue