Example #1
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>';
Example #2
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();
}