-
-
Save escopecz/9a1a0b10861941a457f4 to your computer and use it in GitHub Desktop.
<?php | |
if (!isset($_GET['ILoveMauticReallyIDo'])) { | |
echo 'The secret phrase is wrong.'; | |
die; | |
} | |
$link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; | |
$allowedTasks = array( | |
'cache:clear', | |
'mautic:leadlists:update', | |
'mautic:campaigns:update', | |
'mautic:campaigns:trigger', | |
'mautic:email:process', | |
'mautic:fetch:email', | |
'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 '<br><a href="' . $href . '">' . $href . '</a>'; | |
} | |
echo '<br><a href="https://www.mautic.org/docs/setup/index.html">Read more</a>'; | |
echo '<br><b style="color:red">Please, backup your database before executing the doctrine commands!</b>'; | |
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 '<h3>Executing ' . implode(' ', $args) . '</h3>'; | |
require_once __DIR__.'/app/bootstrap.php.cache'; | |
require_once __DIR__.'/app/AppKernel.php'; | |
use Symfony\Bundle\FrameworkBundle\Console\Application; | |
use Symfony\Component\Console\Input\ArgvInput; | |
use Symfony\Component\Console\Output\BufferedOutput; | |
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 "<pre>\n".$output->fetch().'</pre>'; | |
} catch (\Exception $exception) { | |
echo $exception->getMessage(); | |
} |
Yes .htaccess file needs to include command.php as allowed Sent from my iPhone. Please excuse any typos Best regards,
…
El 30 jun 2021, a las 13:48, nerddigital @.> escribió: @. commented on this gist. I am receiving Forbidden You don't have permission to access this resource. and it is working in 2.16.5 hey did you find a solution? are you still seeing the "permission denied" message? I'm still stuck — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Please do you mean one needs to copy the content in commands.php into .htaccess file?
No.. edit the file and you have one row with the php files allowed to be executed... you have to add commands. That is all
Please I did not realize that my phone was in the signature so I will appreciate if you edit your message and delete it
Thank you
No.. edit the file and you have one row with the php files allowed to be executed... you have to add commands. That is all
Please I did not realize that my phone was in the signature so I will appreciate if you edit your message and delete it
Thank you
Thank you for your prompt response. I have also edited my last comment.
I am a rookie please, just one last clarification, please, I'll be grateful.
Do you commands like this as found in the script:
'cache:clear',
'cache:clear --no-warmup',
'mautic:install:data',
'mautic:campaigns:trigger',
'mautic:campaigns:rebuild',
'mautic:social:monitoring',
'mautic:iplookup:download',
'mautic:emails:send',
'mautic:email:fetch',
'mautic:messages:send',
'mautic:integration:fetchleads -i Salesforce',
'mautic:integration:fetchleads --integration=Hubspot',
'mautic:segments:update',
'doctrine:migration:status',
'doctrine:migrations:migrate',
'doctrine:schema:update --dump-sql',
'doctrine:schema:update --force',
'mautic:maintenance:cleanup --days-old=365 --dry-run'
);
or
https://myurl.com/commands.php?secretphase
Kindly assist, I'll be grateful.
Just "commands" added in .htaccess after upgrade_V3
Except those whitelisted bellow.
<FilesMatch "^(index|index_dev|filemanager|upgrade|upgrade_v3|commands)\.php$">
Require all granted
</FilesMatch>
Just "commands" added in .htaccess after upgrade_V3
Except those whitelisted bellow.
<FilesMatch "^(index|index_dev|filemanager|upgrade|upgrade_v3|commands)\.php$"> Require all granted </FilesMatch>
I got it. Thank you.
Hello Brother and sisters
i am creating commands.php file but i access it thorogh my browser i receive this error
Please help me to resolve this issue i have installed latest version of mautic and facing this error
Uh oh! I think I broke it. If I do it again, please report me to the system administrator!
500 Internal Server Error
mautic not give access to login to my administrator account and i receive this error
Let me know what to do to resolve this prompt
Best Regards
Muhammad Ashfaq
Hey Muhammad, please read the post above yours - but maybe you solved it meanwhile ;)
hey did you find a solution? are you still seeing the "permission denied" message?
I'm still stuck