This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
urapidflow:v3:run_scheduled [2016/11/01 21:23] jamby77 |
urapidflow:v3:run_scheduled [2017/05/19 19:08] 127.0.0.1 external edit |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Running uRapidFlow profiles using cron job ====== | ||
+ | <file php urapidflow.php> | ||
+ | <?php | ||
+ | |||
+ | use Magento\Framework\ObjectManagerInterface; | ||
+ | |||
+ | try { | ||
+ | // if you move this file, adjust bootstrap.php path | ||
+ | require __DIR__ . '/ | ||
+ | } catch (\Exception $e) { | ||
+ | echo <<< | ||
+ | {$e-> | ||
+ | </ | ||
+ | HTML; | ||
+ | exit(1); | ||
+ | } | ||
+ | |||
+ | $params = $_SERVER; | ||
+ | $params[\Magento\Store\Model\StoreManager:: | ||
+ | $params[\Magento\Store\Model\Store:: | ||
+ | $bootstrap = \Magento\Framework\App\Bootstrap:: | ||
+ | |||
+ | /** @var \Magento\Framework\App\Http $app */ | ||
+ | $app = $bootstrap-> | ||
+ | |||
+ | // configure environment | ||
+ | $om = $bootstrap-> | ||
+ | $areaList = $om-> | ||
+ | $areaCode = $areaList-> | ||
+ | /** @var \Magento\Framework\App\State $state */ | ||
+ | $state = $om-> | ||
+ | $state-> | ||
+ | /** @var \Magento\Framework\ObjectManager\ConfigLoaderInterface $configLoader */ | ||
+ | $configLoader = $om-> | ||
+ | $om-> | ||
+ | |||
+ | function rfEavExport(ObjectManagerInterface $om) | ||
+ | { | ||
+ | runRfProfile($om, | ||
+ | } | ||
+ | |||
+ | function rfCatExport(ObjectManagerInterface $om) | ||
+ | { | ||
+ | runRfProfile($om, | ||
+ | } | ||
+ | |||
+ | function rfExtraExport(ObjectManagerInterface $om) | ||
+ | { | ||
+ | runRfProfile($om, | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Function to | ||
+ | * @param ObjectManagerInterface $om | ||
+ | * @param string|int $profile | ||
+ | */ | ||
+ | function runRfProfile(ObjectManagerInterface $om, $profile) | ||
+ | { | ||
+ | /** @var \Unirgy\RapidFlow\Helper\Data $helper */ | ||
+ | $helper = $om-> | ||
+ | $helper-> | ||
+ | } | ||
+ | |||
+ | rfEavExport($om); | ||
+ | |||
+ | rfCatExport($om); | ||
+ | |||
+ | rfExtraExport($om); | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | <file cron> | ||
+ | # daily import | ||
+ | 0 1 * * * / | ||
+ | # OR | ||
+ | 0 2 * * * / | ||
+ | </ |