Skip to content

Instantly share code, notes, and snippets.

@gmoigneu
Created August 9, 2015 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmoigneu/ef9835775a6a37ad6c96 to your computer and use it in GitHub Desktop.
Save gmoigneu/ef9835775a6a37ad6c96 to your computer and use it in GitHub Desktop.
<crontab>
<jobs>
<your_module_getfile>
<schedule><cron_expr>30 2 * * *</cron_expr></schedule>
<run><model>your_module/observer::getLocalFileForCronJob</model></run>
</gem_crawler_generate>
</jobs>
</crontab>
// Helper Data
class Your_Module_Helper_Data extends Mage_Core_Helper_Abstract
{
protected function handleFile($file) {
// Open file and do whatever you want
}
}
class Your_Module_Model_Observer
{
protected function getLocalFileForCronjob() {
// Get the file
$file = ...
// Send it to the helper
Mage::helper('yourModule')->handleFile($file);
}
}
class TestCrontroller extends Controller
{
public function uploadFile() {
// Get the file
$file = ...
// Send it to the helper
Mage::helper('yourModule')->handleFile($file);
return $whatever;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment