This shows you the differences between two versions of the page.
Next revision | Previous revision Last revision Both sides next revision | ||
urapidflow:v3:run_scheduled [2016/11/01 21:23] jamby77 created |
urapidflow:v3:run_scheduled [2019/03/19 21:06] wtsergo |
||
---|---|---|---|
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 = ' | ||
+ | /** @var \Magento\Framework\App\State $state */ | ||
+ | $state = $om-> | ||
+ | $state-> | ||
+ | /** @var \Magento\Framework\ObjectManager\ConfigLoaderInterface $configLoader */ | ||
+ | $configLoader = $om-> | ||
+ | |||
+ | $omCfgLoaded = $configLoader-> | ||
+ | if ($configLoader instanceof \Magento\Framework\App\ObjectManager\ConfigLoader\Compiled) { | ||
+ | $pfsDiVal = @$omCfgLoaded[' | ||
+ | if (is_array($pfsDiVal) && isset($pfsDiVal[' | ||
+ | $pfsDiVal[' | ||
+ | } elseif (!is_array($pfsDiVal)) { | ||
+ | $pfsDiVal = @unserialize($pfsDiVal); | ||
+ | if (!is_array($pfsDiVal)) { | ||
+ | $pfsDiVal = []; | ||
+ | } | ||
+ | $pfsDiVal[' | ||
+ | $pfsDiVal = serialize($pfsDiVal); | ||
+ | } | ||
+ | $omCfgLoaded[' | ||
+ | } else { | ||
+ | $omCfgLoaded[' | ||
+ | } | ||
+ | |||
+ | $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 * * * / | ||
+ | </ |