Skip to content
Snippets Groups Projects
Commit 8ea42e31 authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

Fixed updater didn't used headers for zip download

parent 7d11f6d8
Branches
No related tags found
No related merge requests found
......@@ -111,6 +111,14 @@ if (!$hasNewUpdate) {
}
?>
});
function isJson(str) {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
}
async function updateVBcms(){
<?php
$updateKey = getRandomString(5);
......@@ -132,7 +140,9 @@ if (!$hasNewUpdate) {
timeout: false
});
}else{
console.log(data);
console.log("<?=VBcmsGetSetting("websiteUrl")?>backTasks?updateVBcms=<?=$updateKey?> : "+data);
if(isJson(data)){
details = JSON.parse(data);
if (details.success == true) {
window.location.replace(details.link);
......@@ -157,6 +167,14 @@ if (!$hasNewUpdate) {
});
}
}
}else{
SnackBar({
message: "Erreur, backTasks ne retourne pas du JSON. Check la console.",
status: "danger",
timeout: false
});
}
}
});
}
......
......@@ -7,7 +7,10 @@ if (isset($_GET["updateVBcms"])&&!empty($_GET["updateVBcms"])) {
$updateFilename = $GLOBALS['vbcmsRootPath']."/vbcms-content/updates/".basename($newUpdateInfos['zip']);
if (!file_exists($GLOBALS['vbcmsRootPath']."/vbcms-content/updates")) mkdir($GLOBALS['vbcmsRootPath']."/vbcms-content/updates", 0755);
//echo $updateInfosData["downloadLink"]."?serverId=".VBcmsGetSetting("serverId")."&key=".$key;
file_put_contents($updateFilename, file_get_contents($newUpdateInfos["zip"]));
$options = array('http' => array('user_agent' => 'VBcms Updater'));
$context = stream_context_create($options);
file_put_contents($updateFilename, file_get_contents($newUpdateInfos["zip"], true, $context));
if (file_exists($updateFilename)) {
$zip = new ZipArchive;
if ($zip->open($updateFilename) === TRUE) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment