I'm attempting to create a custom shell script that will extract a zip file in my media/tmp
directory.
I've created a labeler.php file in the shell directory. It extends Mage_Shell_Abstract
and run() looks like this:
/**
* Run script
*
*/
public function run()
{
$_SESSION = array();
if ($this->getArg('unzip')) {
$zipFile = strval($this->getArg('unzip'));
echo "Unzipping {$zipFile}";
}elseif ($this->getArg('pendingList')) {
echo "this\n";
} else {
echo $this->usageHelp();
}
}
The command that I am executing from is php -f shell/labeler.php -- unzip file.zip
. The output that I get is: Unzipping 1
strval
on the argument ?1
. I probably should have removed it from my example above.php -f shell/labeler.php --unzip file.zip
(without the space between--
andunzip
) ?php -f shell/labeler.php -- --unzip file.zip
php -f shell/labeler.php -- unzip file.zip
andphp -f shell/labeler.php unzip file.zip
produced the same output of1
. Andphp -f shell/labeler.php --unzip file.zip
outputs usage suggestions. Which is bothersome because I don't see how my code is different from the model I followed in indexer.php