Hi
We are using version 2.8.0 of mautic and for cron jobs we use the php script reported below.
if (!isset($_GET[‘CampCoFi’])) {
echo ‘The secret phrase is wrong.’;
die;
}
$link = “http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”;
$allowedTasks = array(
‘mautic:campaigns:trigger’,
‘mautic:campaigns:rebuild’,
‘mautic:iplookup:download’,
‘mautic:emails:send’,
‘mautic:email:fetch’,
‘mautic:integration:fetchleads -i Salesforce’,
‘mautic:segments:update’,
‘doctrine:migrations:migrate’,
‘doctrine:schema:update --dump-sql’,
‘doctrine:schema:update --force’
);
if (!isset($_GET[‘task’])) {
echo ‘Specify what task to run. You can run these:’;
foreach ($allowedTasks as $task) {
$href = $link . ‘&task=’ . urlencode($task);
echo ‘
’ . $href . ‘’;
}
echo ‘
Read more’;
echo ‘
Please, backup your database before executing the doctrine commands!’;
die;
}
$task = urldecode($_GET[‘task’]);
if (!in_array($task, $allowedTasks)) {
echo ‘Task ’ . $task . ’ is not allowed.’;
die;
}
$fullCommand = explode(’ ‘, $task);
$command = $fullCommand[0];
$argsCount = count($fullCommand) - 1;
$args = array(‘console’, $command);
if ($argsCount) {
for ($i = 1; $i <= $argsCount; $i++) {
$args[] = $fullCommand[$i];
}
}
echo ‘
Executing ’ . implode(’ ‘, $args) . ‘
’;require_once DIR.’/app/bootstrap.php.cache’;
require_once DIR.’/app/AppKernel.php’;
require DIR.’/vendor/autoload.php’;
use SymfonyBundleFrameworkBundleConsoleApplication;
use SymfonyComponentConsoleInputArgvInput;
use SymfonyComponentConsoleOutputBufferedOutput;
defined(‘IN_MAUTIC_CONSOLE’) or define(‘IN_MAUTIC_CONSOLE’, 1);
try {
$input = new ArgvInput($args);
$output = new BufferedOutput();
$kernel = new AppKernel(‘prod’, false);
$app = new Application($kernel);
$app->setAutoExit(false);
$result = $app->run($input, $output);
echo “
n”.$output->fetch().’’;
} catch (Exception $exception) {
echo $exception->getMessage();
}
The version of PHP of our hosting is 5.6.30.
This problem avoid our mautic campaign to execute the designed workflow.
We need urgently to fix this problem because we are preparing a campaign for one of our customers and we have to start that as soon as possible.
Thank you in advance for your support.
Giulio