private static function update_from_6()
 {
     $Connection = new Connection();
     if (!Connection::indexExists('spotter_output', 'flightaware_id')) {
         $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);\n\t\t\tALTER TABLE spotter_output ADD INDEX(date);\n\t\t\tALTER TABLE spotter_output ADD INDEX(ident);\n\t\t\tALTER TABLE spotter_live ADD INDEX(flightaware_id);\n\t\t\tALTER TABLE spotter_live ADD INDEX(ident);\n\t\t\tALTER TABLE spotter_live ADD INDEX(date);\n\t\t\tALTER TABLE spotter_live ADD INDEX(longitude);\n\t\t\tALTER TABLE spotter_live ADD INDEX(latitude);\n\t\t\tALTER TABLE routes ADD INDEX(CallSign);\n\t\t\tALTER TABLE aircraft_modes ADD INDEX(ModeS);\n\t\t\tALTER TABLE aircraft ADD INDEX(icao);\n\t\t\tALTER TABLE airport ADD INDEX(icao);\n\t\t\tALTER TABLE translation ADD INDEX(Operator);";
         try {
             $sth = Connection::$db->prepare($query);
             $sth->execute();
         } catch (PDOException $e) {
             return "error (add some indexes) : " . $e->getMessage() . "\n";
         }
     }
     $error = '';
     // Update table countries
     if (Connection::tableExists('airspace')) {
         $error .= update_db::update_countries();
         if ($error != '') {
             return $error;
         }
     }
     // Update schema_version to 7
     $query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
     try {
         $sth = Connection::$db->prepare($query);
         $sth->execute();
     } catch (PDOException $e) {
         return "error (update schema_version) : " . $e->getMessage() . "\n";
     }
     return $error;
 }
#!/usr/bin/php
<?php 
require_once '../require/settings.php';
if ($globalInstalled) {
    echo '$globalInstalled must be set to FALSE in require/settings.php';
    exit;
}
require 'class.update_db.php';
if (isset($globalIVAO) && $globalIVAO) {
    if (!file_exists('tmp/ivae_feb2013.zip')) {
        echo "You have to download the file ivae_feb2013.zip from https://www.ivao.aero/softdev/mirrors.asp?software=IvAeDataUp and put it in install/tmp directory";
    } else {
        echo "Install IVAO airlines and logos...";
        update_db::update_IVAO();
        echo "Done !\n";
    }
}
Beispiel #3
0
#!/usr/bin/php
<?php 
require_once '../require/settings.php';
if ($globalInstalled) {
    echo '$globalInstalled must be set to FALSE in require/settings.php';
    exit;
}
require 'class.create_db.php';
echo "Create and import all tables...";
create_db::import_all_db('../db/');
echo "Done !\n";
require 'class.update_db.php';
echo "Populate all tables...\n";
update_db::update_all();
echo "\nInstall waypoints...(VERY slow!)";
update_db::update_waypoints();
echo "Done !\n";
echo "Install airspace...";
update_db::update_airspace();
echo "Done !\n";
echo 'All is now installed ! Thanks' . "\n";
if ($globalSBS1) {
    echo 'You need to run cron-sbs.php as a daemon. You can use init script in the install/init directory.' . "\n";
}
if ($globalACARS) {
    echo 'You need to run cron-acars.php as a daemon. You can use init script in the install/init directory.' . "\n";
}
Beispiel #4
0
 unset($_SESSION['install']);
 if (!is_writable('tmp')) {
     print '<p><strong>The directory <i>install/tmp</i> must be writable.</strong></p>';
     require '../footer.php';
     exit;
 }
 print '<div class="info column"><ul>';
 foreach ($_SESSION['done'] as $done) {
     print '<li>' . $done . '....<strong>SUCCESS</strong></li>';
 }
 print '<li>Populate notam table with externals data....<img src="../images/loading.gif" /></li></ul></div>';
 flush();
 @ob_flush();
 include_once 'class.update_db.php';
 $globalDebug = FALSE;
 update_db::update_notam();
 $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data'));
 $_SESSION['install'] = 'sources';
 print "<script>window.location = 'index.php?" . rand() . "&next=" . $_SESSION['install'] . "';</script>";
 /*
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'ivao') {
 	unset($_SESSION['install']);
 	if (!is_writable('tmp')) {
 		print '<p><strong>The directory <i>install/tmp</i> must be writable.</strong></p>';
 		require('../footer.php');
 		exit;
 	}
 
 	print '<div class="info column"><ul>';
 	foreach ($_SESSION['done'] as $done) {
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
Beispiel #5
0
#!/usr/bin/php
<?php 
/**
* This script is used to update databases with external data.
* Should be run as cronjob no more than every 2 weeks if NOTAM is not activated, once a day if NOTAM is activated and every hour if METAR is activated.
*/
require_once dirname(__FILE__) . '/../require/settings.php';
require dirname(__FILE__) . '/../install/class.update_db.php';
$update_db = new update_db();
if (isset($globalNOTAM) && $globalNOTAM && $update_db->check_last_notam_update()) {
    echo "updating NOTAM...";
    $update_db->update_notam();
    $update_db->insert_last_notam_update();
} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
    echo "NOTAM are only updated once a day.\n";
}
if ($update_db->check_last_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
    $update_db->update_all();
    require_once '../require/class.Spotter.php';
    $Spotter = new Spotter();
    $Spotter->updateFieldsFromOtherTables();
    $update_db->insert_last_update();
} elseif (isset($globalDebug) && $globalDebug && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
    echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
}
if (isset($globalMETAR) && isset($globalMETARcycle) && $globalMETAR && $globalMETARcycle) {
    echo "updating METAR...";
    require_once '../require/class.METAR.php';
    $METAR = new METAR();
    $METAR->addMETARCycle();
}
 public static function update_all()
 {
     update_db::update_routes();
     update_db::update_ModeS();
     update_db::update_translation();
 }
                 if (file_exists('tmp/ivae_feb2013.zip')) {
                     update_db::update_IVAO();
                     $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data'));
                 } else {
                     update_db::update_vatsim();
                     $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data'));
                 }
             } elseif (isset($globalVATSIM) && $globalVATSIM) {
                 update_db::update_vatsim();
                 $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data'));
             } elseif (isset($globalIVAO) && $globalIVAO) {
                 if (file_exists('tmp/ivae_feb2013.zip')) {
                     update_db::update_IVAO();
                     $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data'));
                 } else {
                     update_db::update_vatsim();
                     $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data (IVAO not found)'));
                 }
             }
             $_SESSION['install'] = 'routes';
             $_SESSION['next'] = 'Populate routes table with externals data';
             $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
             print json_encode($result);
         } else {
             //unset($_SESSION['install']);
             $_SESSION['error'] = 'Unknwon task : ' . $_SESSION['install'];
             $result = array('error' => 'Unknwon task : ' . $_SESSION['install'], 'done' => $_SESSION['done'], 'next' => 'finish', 'install' => 'finish');
             print json_encode($result);
         }
     }
 }
Beispiel #8
0
<?php 
require_once '../require/settings.php';
if ($globalInstalled) {
    echo '$globalInstalled must be set to FALSE in require/settings.php';
    exit;
}
require 'class.update_db.php';
echo "Populate all tables...\n";
update_db::update_all();
echo "\nInstall waypoints...(VERY slow!)";
update_db::update_waypoints();
echo "Done !\n";
echo "Install airspace...";
update_db::update_airspace();
echo "Done !\n";
echo "Install countries...";
update_db::update_countries();
echo "Done !\n";
/*
if (isset($globalIVAO) && $globalIVAO) {
    echo "Install IVAO airlines and logos...";
    update_db::update_IVAO();
	echo "Done !\n";
}
*/
if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
    echo "Install NOTAM from notaminfo.com...";
    update_db:
    update_notam();
    echo "Done !\n";
}
Beispiel #9
0
#!/usr/bin/php
<?php 
/**
* This script is used to update databases with external data.
* Should be run as cronjob no more than every 2 weeks if NOTAM is not activated, else once a day.
*/
require_once dirname(__FILE__) . '/../require/settings.php';
require dirname(__FILE__) . '/../install/class.update_db.php';
if (isset($globalNOTAM) && $globalNOTAM && update_db::check_last_notam_update()) {
    echo "update NOTAM";
    update_db::update_notam();
    update_db::insert_last_notam_update();
} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
    echo "NOTAM are only updated once a day.\n";
}
if (update_db::check_last_update() && (!isset($globalIVAO) || !$globalIVAO)) {
    update_db::update_all();
    #    require_once('../require/class.Spotter.php');
    #    Spotter::updateFieldsFromOtherTables();
    update_db::insert_last_update();
} elseif (isset($globalDebug) && $globalDebug && (!isset($globalIVAO) || !$globalIVAO)) {
    echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
}
Beispiel #10
0
#!/usr/bin/php
<?php 
/**
* This script is used to update databases with external data.
* Should be run as cronjob no more than every 2 weeks if NOTAM is not activated, else once a day.
*/
require_once dirname(__FILE__) . '/../require/settings.php';
require dirname(__FILE__) . '/../install/class.update_db.php';
$update_db = new update_db();
if (isset($globalNOTAM) && $globalNOTAM && $update_db->check_last_notam_update()) {
    echo "update NOTAM";
    $update_db->update_notam();
    $update_db->insert_last_notam_update();
} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
    echo "NOTAM are only updated once a day.\n";
}
if ($update_db->check_last_update() && (!isset($globalIVAO) || !$globalIVAO)) {
    $update_db->update_all();
    #    require_once('../require/class.Spotter.php');
    #    $Spotter = new Spotter();
    #    $Spotter::updateFieldsFromOtherTables();
    $update_db->insert_last_update();
} elseif (isset($globalDebug) && $globalDebug && (!isset($globalIVAO) || !$globalIVAO)) {
    echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
}
}
require 'class.update_db.php';
echo "Populate all tables...\n";
update_db::update_all();
echo "\nInstall waypoints...(VERY slow!)";
update_db::update_waypoints();
echo "Done !\n";
echo "Install airspace...";
update_db::update_airspace();
echo "Done !\n";
echo "Install countries...";
update_db::update_countries();
echo "Done !\n";
if (isset($globalOwner) && $globalOwner) {
    echo "Install private owners...";
    update_db::update_owner();
    echo "Done !\n";
}
/*
if (isset($globalIVAO) && $globalIVAO) {
    echo "Install IVAO airlines and logos...";
    update_db::update_IVAO();
	echo "Done !\n";
}
*/
if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
    echo "Install NOTAM from notaminfo.com...";
    update_db:
    update_notam();
    echo "Done !\n";
}