Created
January 23, 2012 13:20
-
-
Save t10u/1663087 to your computer and use it in GitHub Desktop.
Download Magento CE module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
if (!isset($argv[1])) { | |
echo 'Magento extension key is required. Example usage: php '. $argv[0]. ' <Magento Connect 2.0 extension key>'. PHP_EOL; | |
exit(-1); | |
} | |
$mage_module_key = $argv[1]; | |
$mage_module_name = basename($mage_module_key); | |
$releases_url = $mage_module_key. '/releases.xml'; | |
$releases = simplexml_load_file($releases_url); | |
$versions = array(); | |
foreach ($releases as $release) { | |
$versions[] = (string) $release->v; | |
} | |
asort($versions); | |
$latest_version = array_pop($versions); | |
$download_url = sprintf('%s/%s/%s-%s.tgz', $mage_module_key, $latest_version, $mage_module_name, $latest_version); | |
exec('wget '. $download_url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment