I can execute a shell script from a custom php script. I have no trouble including the abstract.php
, log a string or calling let's say the product model. Playing around with including parameters from the php script to the shell script is no problem either.
But when it comes to calling a custom helper-function like this:
Mage::helper('customModuleName/helperName')->methodName()
and var_dump()
the result (or whatever function you like) I get nothing. I've called the helper function a dozen times in other scripts. It seems that the helper function cannot be executed in a shell script. Whatever helper method for that matter. I tried to call other helpers too.
Is my deduction a valid one or do I miss the knowledge of execution a shell script? In other words: is it possible to execute a custom helper function in a shell script?
EDIT :
thanks in advance for all your replies!
here's my code
<?php
require_once 'abstract.php';
class Santee_Shell_Upload extends Mage_Shell_Abstract {
public function run() {
global $argv;
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$path = $argv[1];
$dir = Mage::getBaseDir() . "/shell/";
MAGE::helper('updateproducts/runupdate')->unSetIndex();
$objects = MAGE::helper('updateproducts/runupdate')->getAllObjects($path);
MAGE::helper('updateproducts/runupdate')->startUpdate($objects);
MAGE::helper('updateproducts/runupdate')->setIndex();
$command = 'php -f ' . $dir . 'indexer.php reindexall';
$result = shell_exec($command);
}
public function usageHelp() {
return <<<USAGE
Usage: php -f upload.php -- [options]
php -f upload.php
USAGE;
}
}
$shell = new Santee_Shell_Upload();
$shell->run();
MAGE
in all caps. Are you on a windows server? Casing matters in windows.