CVS: phpweather/db pw_db_common.php,1.6,1.7
Brought to you by:
iridium
From: Martin G. <gim...@us...> - 2002-03-25 23:33:32
|
Update of /cvsroot/phpweather/phpweather/db In directory usw-pr-cvs1:/tmp/cvs-serv12552/db Modified Files: pw_db_common.php Log Message: Nicer output. When we run this from a cronjob, we can just redirect it to /dev/null, but it's nice to see how it goes when run by hand. Index: pw_db_common.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/db/pw_db_common.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- pw_db_common.php 25 Mar 2002 21:12:09 -0000 1.6 +++ pw_db_common.php 25 Mar 2002 23:33:29 -0000 1.7 @@ -78,6 +78,8 @@ $fp = fopen($file, 'r'); $i = 0; + $inserted = 0; + $updated = 0; while (!feof($fp)) { @@ -103,12 +105,15 @@ if ($this->get_metar($icao)) { $this->update_metar($icao, addslashes($metar), $timestamp); + $updated++; } else { $this->insert_metar($icao, addslashes($metar), $timestamp); + $inserted++; } if ($i % 100 == 0) { - $this->debug("Inserted $i METARs..."); + printf("Inserted %6d new METARs, updated %6d METARs...\n", + $inserted, $updated); } $i++; |