Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
cron.php
Go to the documentation of this file.
1 <?php
11 
12 require dirname(__DIR__) . '/app/bootstrap.php';
13 
14 if (php_sapi_name() === 'cli') {
15  echo "You cannot run this from the command line." . PHP_EOL .
16  "Run \"php bin/magento cron:run\" instead." . PHP_EOL;
17  exit(1);
18 } else {
19  $opt = $_GET;
20 }
21 
22 try {
23  foreach ($opt as $key => $value) {
24  $opt[$key] = escapeshellarg($value);
25  }
26  $opt['standaloneProcessStarted'] = '0';
27  $params = $_SERVER;
28  $params[StoreManager::PARAM_RUN_CODE] = 'admin';
29  $params[Store::CUSTOM_ENTRY_POINT_PARAM] = true;
32  $app = $bootstrap->createApplication(\Magento\Framework\App\Cron::class, ['parameters' => $opt]);
33  $bootstrap->run($app);
34 } catch (\Exception $e) {
35  echo $e;
36  exit(1);
37 }
$params
Definition: cron.php:27
static create($rootDir, array $initParams, ObjectManagerFactory $factory=null)
Definition: Bootstrap.php:119
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
$bootstrap
Definition: cron.php:30
$value
Definition: gender.phtml:16
exit
Definition: redirect.phtml:12
const BP
Definition: autoload.php:14
$app
Definition: cron.php:32