Forked from tegansnyder/manual-dataflow-profile.php
Created
January 18, 2016 14:52
-
-
Save opensourcelib/eef98634ea73f33e559f to your computer and use it in GitHub Desktop.
Running a Magento Dataflow profile manually
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
<?php | |
/* | |
Author: Tegan Snyder <[email protected]> | |
Example of running a Dataflow profile via command line | |
you can change the profile_id to the one you want to | |
run and issue: | |
time php manual-dataflow-profile.php | |
note you may need to increase the memory_limit in php cli's php_cli.ini | |
RHEL linux copy /etc/php.ini to /etc/php_cli.ini and make changes there then restart Apache. | |
*/ | |
require_once('app/Mage.php'); | |
umask(0); | |
Mage::app('admin'); | |
$log_file = 'my-manual-run.log' | |
Mage::log('Dataflow Started', null, $log_file); | |
$profileId = 21; | |
Mage::log('profile started: ' . $profileId . ' at ' . date('Y-m-d H:i:s'), null, $log_file); | |
$profile = Mage::getModel('dataflow/profile'); | |
$userModel = Mage::getModel('admin/user'); | |
$userModel->setUserId(0); | |
Mage::getSingleton('admin/session')->setUser($userModel); | |
$profile->load($profileId); | |
if (!$profile->getId()) { | |
Mage::log('error: ' . $profileId . ' - incorrect profile id', null, $log_file); | |
return; | |
} | |
Mage::register('current_convert_profile', $profile); | |
$profile->run(); | |
Mage::log('profile ended: ' . $profileId . ' at ' . date('Y-m-d H:i:s'), null, $log_file); | |
Mage::log('-----------------------------------', null, $log_file); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment