Hotfix: Patch download packer, which was inadvertently broken

This commit is contained in:
Starbeamrainbowlabs 2019-08-29 00:14:10 +01:00
parent 53dd5e3d70
commit 24d15b1f5a
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
2 changed files with 32 additions and 7 deletions

View File

@ -24,6 +24,10 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Pepperminty Wiki _shouldn't_ make remote requests without you asking it to - see above and the theme gallery
## v0.19.1-hotfix
- Patched [the downloader](https://starbeamrainbowlabs.com/labs/peppermint/download.php) which was throwing warnings when packing downloads
## v0.19
_(No changes have been made since the last beta release.)_

View File

@ -1,5 +1,8 @@
<?php
$paths = new stdClass();
$paths->extra_data_directory = "._extra_data";
if(isset($_GET["determine-latest-version"])) {
header("content-type: application/json");
exit(json_encode([
@ -21,12 +24,23 @@ function log_str(string $line) {
log_str("*** Beginning main build sequence ***\n");
log_str("Reading in module index...\n");
if(isset($_GET["modules"]))
$requested_modules = explode(",", $_GET["modules"]);
$module_index = json_decode(file_get_contents("module_index.json"));
$module_list = [];
foreach($module_index as $module)
{
// If the module is optional, the module's id isn't present in the command line arguments, and the special 'all' module id wasn't passed in, skip it
if($module->optional &&
foreach($module_index as $module) {
/*
* If:
* - The module is optional
* - ...AND we're on the command line
* - ...AND the module isn't specified in the CLI arguments
* - ...AND the special keyword "all" isn't specified in the CLI arguments
* ....then skip it.
*/
if(
php_sapi_name() == "cli" &&
$module->optional &&
(
isset($argv) &&
strrpos(implode(" ", $argv), $module->id) === false &&
@ -34,12 +48,19 @@ foreach($module_index as $module)
)
)
continue;
/*
* If:
* - We're NOT on the command line
* - ...AND the module isn't requested
* ...then skip it.
*/
if(php_sapi_name() != "cli" && !in_array($module->id, $requested_modules))
continue;
$module_list[] = $module;
}
if(isset($_GET["modules"]))
$module_list = explode(",", $_GET["modules"]);
if(php_sapi_name() != "cli") {
header("content-type: text/php");
header("content-disposition: attachment; filename=\"index.php\"");