diff --git a/oci-framasite/oci-framagrav-uploader.php b/oci-framasite/oci-framagrav-uploader.php new file mode 100644 index 0000000..5ae803f --- /dev/null +++ b/oci-framasite/oci-framagrav-uploader.php @@ -0,0 +1,97 @@ +open($targetzip); + if ($x === true) { + $zip->extractTo('.'); + $zip->close(); + unlink($targetzip); + } +} else { + echo nl2br("Une erreur vient de se produire lors du téléversement de votre fichier.\r\n"); + exit(); +} + +// Download latest CMS zip with cURL +$ch = curl_init(); +$source = "https://ouvaton.coop/oci/framagrav-themes.zip"; +curl_setopt($ch, CURLOPT_URL, $source); +curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); +$data = curl_exec($ch); +// If any cURL error stop processing +if(curl_errno($ch)) { + echo 'Erreur cURL : '.curl_error($ch); + curl_close($ch); + exit; +} + +// Check HTTP code +switch ($http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE)) { +case 200: + // Create CMS zip + $destination = "themes.zip"; + $file = fopen($destination, "w+"); + fputs($file, $data); + fclose($file); + curl_close($ch); + + // Unzip archive file + $file = 'themes.zip'; + $zip = new ZipArchive; + if ($zip->open($file) === TRUE) { + $zip->extractTo('.'); + $zip->close(); + } else { + echo nl2br("Une erreur lors de la décompression de l'archive vient de se produire, contactez l'assistance !\r\n"); + exit; + } + // Zip archive is not needed anymore + unlink('themes.zip'); + + // Website URI + $host = $_SERVER['HTTP_HOST']; + // Set URI + $grav_custom = "custom_base_url: 'https://".$host."'"; + $set_grav_custom = file_put_contents('user/config/system.yaml', $grav_custom.PHP_EOL , FILE_APPEND | LOCK_EX); + + // Remove scripts + unlink('oci-framagrav.php'); + unlink(__FILE__); + echo "L'installation est terminée !"; + exit; +default: + // If any HTTP error stop processing + echo nl2br("Code HTTP : ".$http_code."\r\n"); + curl_close($ch); + exit; +} +?> diff --git a/oci-framasite/oci-framagrav.php b/oci-framasite/oci-framagrav.php index 8c15a00..e69de29 100644 --- a/oci-framasite/oci-framagrav.php +++ b/oci-framasite/oci-framagrav.php @@ -1,128 +0,0 @@ -open($targetzip); // open the zip file to extract - if ($x === true) { - $zip->extractTo('.'); // place in the directory with same name - $zip->close(); - - unlink($targetzip); - } - } else { - echo nl2br("Une erreur vient de se produire lors du téléversement de votre fichier.\r\n"); - exit(); - } - - // Download latest CMS zip with cURL - $ch = curl_init(); - $source = "https://ouvaton.coop/oci/framagrav-themes.zip"; - curl_setopt($ch, CURLOPT_URL, $source); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - $data = curl_exec($ch); - // If any cURL error stop processing - if(curl_errno($ch)) { - echo nl2br("Une erreur vient de se produire. Rechargez la page pour essayer à nouveau, ou contactez l'assistance si le problème persiste.\r\n"); - echo 'Erreur cURL : '.curl_error($ch); - curl_close($ch); - exit; - } - - // Check HTTP code - switch ($http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE)) { - case 200: - // Create CMS zip - $destination = "themes.zip"; - $file = fopen($destination, "w+"); - fputs($file, $data); - fclose($file); - curl_close($ch); - - // Unzip archive file - $file = 'themes.zip'; - $zip = new ZipArchive; - if ($zip->open($file) === TRUE) { - $zip->extractTo('.'); - $zip->close(); - } else {echo nl2br("Une erreur lors de la décompression de l'archive vient de se produire, contactez l'assistance !\r\n");} - // Zip archive is not needed anymore - unlink('themes.zip'); - - // Redirecting user to CMS install page - $host = $_SERVER['HTTP_HOST']; - $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); - header("Location: http://$host$uri/"); - // Remove script - unlink(__FILE__); - exit; - default: - // If any HTTP error stop processing - echo nl2br("Une erreur vient de se produire. Rechargez la page pour essayer à nouveau, ou contactez l'assistance si le problème persiste.\r\n"); - echo nl2br("Code HTTP : ".$http_code."\r\n"); - curl_close($ch); - exit; - } -} -?> - - - - - - Migration de votre Framasite chez Ouvaton - - - $message

"; ?> -
- -
- -
- - \ No newline at end of file