function migrate_example_baseball_get_files in Migrate 7.2
Obtain our sample data from Retrosheet.
Parameters
$path:
2 calls to migrate_example_baseball_get_files()
- migrate_example_baseball_enable in migrate_example_baseball/
migrate_example_baseball.install - @file Set up the migration baseball example module.
- migrate_example_baseball_update_7201 in migrate_example_baseball/
migrate_example_baseball.install - Get a copy of the sample CSV data if necessary.
File
- migrate_example_baseball/
migrate_example_baseball.install, line 24 - Set up the migration baseball example module.
Code
function migrate_example_baseball_get_files($path) {
// Don't replace old upper-case names
if (!file_exists("{$path}/GL2000.TXT") && !file_exists("{$path}/gl2000.txt")) {
file_prepare_directory($path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
$result = copy('http://www.retrosheet.org/gamelogs/gl2000_09.zip', $path . '/gl2000_09.zip');
if ($result) {
$zip = new ZipArchive();
$zip
->open($path . '/gl2000_09.zip');
$zip
->extractTo($path);
$zip
->close();
unlink("{$path}/gl2000_09.zip");
}
}
}