Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv4986
Added Files:
db_updater.php
Log Message:
This little script will update the METAR database with new data. It's
meant to be called periodically from a cronjob.
--- NEW FILE ---
#!/usr/bin/php4 -f
<?php
error_reporting(E_ALL);
function print_usage() {
echo "Usage:\n";
echo " From the commandline: db_updater.php /path/to/new/metars or\n";
echo " In a webbrowser: db_updater.php?filename=/path/to/new/metars\n";
}
if (!empty($filename) && file_exists($filename)) {
$fn = $filename;
} else if (!empty($argv[1]) && file_exists($argv[1])) {
$fn = $argv[1];
} else {
print_usage();
exit(1);
}
define('PHPWEATHER_BASE_DIR', dirname(__FILE__));
require_once(PHPWEATHER_BASE_DIR . '/db_layer.php');
$db = new db_layer(array());
$db->db->connect();
$db->db->update_all_metars($fn);
?>
|