Skip to content

Instantly share code, notes, and snippets.

@tegansnyder
Created January 28, 2014 17:23
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save tegansnyder/8672061 to your computer and use it in GitHub Desktop.
Save tegansnyder/8672061 to your computer and use it in GitHub Desktop.
Running a Magento Dataflow profile manually
<?php
/*
Author: Tegan Snyder <tsnyder@tegdesign.com>
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);
@kongper
Copy link

kongper commented Apr 10, 2015

$log_file = 'my-manual-run.log' missing a semi-colon

Copy link

ghost commented Nov 24, 2015

If running script from shell folder, then change:

require_once('app/Mage.php');
to
require_once('../app/Mage.php');

@mll32
Copy link

mll32 commented Aug 17, 2016

It dont work for import product profil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment