Version 1.04 05-19-2008 First Release: added user selectable log file feature
Version 1.05 05-20-2008 updated the "How to use it" section in this file and the readme. (no code changes)
Version 1.06 05-20-2008 added error trap for failed fsockopen when checking new file times.
Version 1.07 05-21-2008 fixed remote location of mesomap graphic for SWN members - K. True
Version 1.08 05-21-2008 added many error traps with descriptive errors for files not found, not readable, etc.
The program should exit on all the new error traps instead of trying to plow forward with warnings.
Version 1.09 05-21-2008 fixed the error check for HTTP/1.* 200 OK - K. True The file is attached to this message below, be sure to check back here for future updates################
#
Why use it:# ##############
Most network members run a copy of the network map PHP script on their weather web site.
It used to be that whenever a new member was added to the map at the parent network server,
all the member sites had to download a zip file and manually replace the files
or their map would not display the newest members.
By using this utility, the map image, map control file, and map php script
can self update from the parent network server.
When using this utility, the network member sites only have to install the map files once.
################
#
What does it do?:# ##############
It updates the XXXX_meso.jpg, XXXX-stations-cc.txt, and the XXXX-mesomap.php
It reads the *-mesomap-config.txt file on your web server and uses that info to
check out the 'freshness' of the map graphic, control file and PHP code,
then automatically updates if needed.
Tip: This script can be manually run from the web browser or from a cron schedule.
No parameters are required for the script.
################
#
How to use it:# ##############
1) Set your settings in the "Settings" section in the script header,
the most important one is the first one, your network initials
2) Upload the file as mesomap-update-utility.php file in the same directory as your network mesomap files
XXXX_meso.jpg, XXXX-stations-cc.txt, XXXX-mesomap.php and XXXX-mesomap-config.txt
in this example XXXX is the prefix of the network files, ie: SWN, NWWN, NEWN, etc.
mesomap-update-utility.php will pick up other needed settings from the XXXX-mesomap-config.txt
3) Test the script by visiting your site URL to the php file
like this:
http://www.yoursite.com/mesomap-update-utility.phpSample output when no updates were needed:./NWWN_meso.jpg does not need to be updated
./NWWN-stations-cc.txt does not need to be updated
./NWWN-mesomap.php does not need to be updated
nothing was updated
done
Sample output when all 3 updates were needed:downloading a newer ./NWWN_meso.jpg
downloading a newer ./NWWN-stations-cc.txt
downloading a newer ./NWWN-mesomap.php
3 files were updated
done
4)Visit the mesomap-update-utility.php URL regularly to make sure your map stays up to date with new WX stations that are added.
Once a day is probably enough.
5) OPTIONAL, Schedule automatic timed updates: There are many ways to do this, method 1 is probably easiest.
Method 1: Use a program like System scheduler to ping the URL
http://www.yourwebsite.com/mesomap-update-utility.php once a day, or whenever you want
System scheduler:
http://www.splinterware.com/products/wincron.htmMethod 2: If you already have weather-display software click on
Control Panel | FTP & Connections | HTTP Download tab
Click on #1,#2 or #3 setup button | switch on the button for "downloads on
| enter your mesomap-update-utility.php url in the box called
"URL of file to be downloaded" | click "add to list"
| check the tick that says "Tick if text file"
| enter mesomap-update-utility.txt in the box that says
"Local filename to be downloaded"
| click "add to list" | click "download hourly" (or for once a day, click "clear all" then click the 00:00 in the right column so it then shows in the left column)
| click "save now" | click OK
Method 3: Schedule a server cron job to run this php file five minutes after midnight, every day.
Example using crontab -e: (change /path/to/ to your server path)
# run five minutes after midnight, every day
5 0 * * * php /path/to/mesomap-update-utility.php 2>&1 > /dev/null
If your site uses a control panel you may have a different method of setting up cron jobs.
see also
http://en.wikipedia.org/wiki/CronNOTE!! if you get PHP warning errors during an update:
warning: fopen(./XXXX_meso.jpg) "failed to open stream: Permission denied"
try changing the folder permissions CHMOD to 755, or on some servers 777
NOTE, you may not find out there is a permissions problem until an update occurs.
How to Change File Permissions (chmod) with FTP...
http://www.stadtaus.com/en/tutorials/chmod-ftp-file-permissions.phpTip: If you change a setting you might not know if the setting works until
new map files are available for update.
Tip: changes are logged to a file if you set $use_log_file = true; (default) mesomap-update-log.txt
Anytime after an update, view the log at
http://www.yourwebsite.com/mesomap-update-log.txtIf you find any bugs, or can think of other possible settings/features for future releases:
Post in this forum:
http://www.northamericanweather.net/forum/index.php?topic=29.0 Contact Mike -
http://www.carmosaic.com/weather/contact_us.php