When I run this command from within the /shell/ directory:
php -f regularPromos.php
Why do I receive this error?
PHP Fatal error: Class 'Mage' not found in /var/www/vhosts/yoohoo/httpdocs/shell/regularPromos.php on line 28
This is regularPromos.php:
<?php
require_once 'abstract.php';
class Mage_Shell_RegularPromos extends Mage_Shell_Abstract
{
//Day of week to repeat promotion
protected $day;
//ID of promotion
protected $promoID;
//Rule process object
protected $rule;
public function Mage_Shell_RegularPromos($promoID, $day)
{
$this->day = $day;
$this->promoID = $promoID;
$this->rule = Mage::getModel('salesrule/rule');
}
public function run()
{
date_default_timezone_set('America/New_York');
$nextWeek = date('Y-m-d', strtotime('next '. $this->day));
$rule = $rule->load($this->promoID);
$rule->setFromDate($nextWeek)
->setToDate($nextWeek)
->save();
}
}
$shell = new Mage_Shell_RegularPromos(7, 'monday');
$shell->run();
?>
Per all the SO threads I could find on this issue:
I've tried running with compiler on/off/cleared/compiled, with the same error message
I've cleared cache via the admin panel and manually deleting everything in /var/cache/.
APC does not show up in phpinfo(), so that shouldn't be an issue either.
I can run compiler.php just fine, so I assume I've just made a mistake in my php above.
I'm running Magento 1.7 CE, PHP 5.3.3