Last active
May 4, 2021 11:15
-
-
Save dennisameling/169983c167f9e409e3b0970f19c89aa2 to your computer and use it in GitHub Desktop.
Mautic 3 upgrade script debug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
=========== | |
PLEASE DELETE THIS FILE WHEN YOU'VE FINISHED DEBUGGING! | |
Run on the CLI with: | |
php m3-upgrade-debug.php | |
=========== | |
*/ | |
define('MAUTIC_ROOT', __DIR__); | |
// Data we fetch from a special JSON file to control upgrade behavior, like e.g. the download URL. | |
$data = make_request('https://updates.mautic.org/upgrade-configs/m2-to-m3.json', 'GET'); | |
$updateData = json_decode($data, true); | |
var_dump($updateData); | |
function make_request($url, $method = 'GET', $data = null) | |
{ | |
$method = strtoupper($method); | |
$ch = curl_init(); | |
$timeout = 15; | |
if ($data && 'POST' == $method) { | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); | |
} | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); | |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); | |
// The CA file doesn't exist while we move all Mautic 2 files to a temp folder. We won't need it anyway on most servers nowadays. | |
if (file_exists(MAUTIC_ROOT . '/vendor/joomla/http/src/Transport/cacert.pem')) { | |
curl_setopt($ch, CURLOPT_CAINFO, MAUTIC_ROOT . '/vendor/joomla/http/src/Transport/cacert.pem'); | |
} | |
$data = curl_exec($ch); | |
curl_close($ch); | |
return $data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment