mailpoet
Last commit date
assets
6 years ago
generated
6 years ago
lang
6 years ago
lib
6 years ago
lib-3rd-party
6 years ago
vendor
6 years ago
vendor-prefixed
6 years ago
views
6 years ago
index.php
6 years ago
license.txt
9 years ago
mailpoet-cron.php
6 years ago
mailpoet.php
6 years ago
mailpoet_initializer.php
6 years ago
readme.txt
6 years ago
uninstall.php
6 years ago
mailpoet-cron.php
51 lines
| 1 | <?php |
| 2 | |
| 3 | ini_set("display_errors", "1"); |
| 4 | error_reporting(E_ALL); |
| 5 | |
| 6 | if (!isset($argv[1]) || !$argv[1]) { |
| 7 | echo 'You need to pass a WordPress root as an argument.'; |
| 8 | exit(1); |
| 9 | } |
| 10 | |
| 11 | $wpLoadFile = $argv[1] . '/wp-load.php'; |
| 12 | if (!file_exists($wpLoadFile)) { |
| 13 | echo 'WordPress root argument is not valid.'; |
| 14 | exit(1); |
| 15 | } |
| 16 | |
| 17 | if (!defined('ABSPATH')) { |
| 18 | /** Set up WordPress environment */ |
| 19 | require_once($wpLoadFile); |
| 20 | } |
| 21 | |
| 22 | if (!is_plugin_active('mailpoet/mailpoet.php')) { |
| 23 | echo 'MailPoet plugin is not active'; |
| 24 | exit(1); |
| 25 | } |
| 26 | |
| 27 | // Check for minimum supported PHP version |
| 28 | if (version_compare(phpversion(), '7.0.0', '<')) { |
| 29 | echo 'MailPoet requires PHP version 7.0 or newer (version 7.3 recommended).'; |
| 30 | exit(1); |
| 31 | } |
| 32 | |
| 33 | if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
| 34 | set_time_limit(0); |
| 35 | } |
| 36 | |
| 37 | $container = \MailPoet\DI\ContainerWrapper::getInstance(WP_DEBUG); |
| 38 | |
| 39 | // Check if Linux Cron method is set in plugin settings |
| 40 | $settings = $container->get(\MailPoet\Settings\SettingsController::class); |
| 41 | if ($settings->get('cron_trigger.method') !== \MailPoet\Cron\CronTrigger::METHOD_LINUX_CRON) { |
| 42 | echo 'MailPoet is not configured to run with Linux Cron.'; |
| 43 | exit(1); |
| 44 | } |
| 45 | |
| 46 | // Run Cron Daemon |
| 47 | $cronHelper = $container->get(\MailPoet\Cron\CronHelper::class); |
| 48 | $data = $cronHelper->createDaemon(null); |
| 49 | $trigger = $container->get(\MailPoet\Cron\Daemon::class); |
| 50 | $trigger->run($data); |
| 51 |