Awhile ago I came across a script that basically fetched a list of countries/states from a web resource if it wasn't located in a database, and this script would then populate the database with those contents and from then on, rely on them from then on.
Since I'm working on a localization class of my own, I'll be using the same locale data Zend is using, in the form of around ~60 or so xml files which contain localised data such as countries, languages for locales.
I figure since the framework I'm working on will rely on these files from now on ( where it isn't now ), and none of the servers now have this data, should I:
- Setup my web application to download these files from a central server where all the content is stored in a .tar.gz, unpack them, store them on the server and then rely on them
- Create a separate script to do this, and not actually do this within the application.
Pseudo code:
if ( !data ) {
resource = getFile( 'http://central-server.com/tar.gz' );
if ( resource ) {
resource = unpack( directory, resource )
return true
}
throw Exception('could not download files.')
}