1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-24 17:13:01 +00:00

Add support for core sharding to build script

This commit is contained in:
Starbeamrainbowlabs 2019-03-02 21:13:41 +00:00
parent 55989f11b6
commit 4f9f1a6cf9
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
6 changed files with 21 additions and 29 deletions

View file

@ -2,11 +2,12 @@
echo("*** Preparing environment ***\n"); echo("*** Preparing environment ***\n");
ini_set("user_agent", "Pepperminty-Wiki-Downloader PHP/" . phpversion() . "; +https://github.com/sbrl/Pepperminty-Wiki/ Pepperminty-Wiki/" . file_get_contents("version"));
$build_env = new stdClass(); $build_env = new stdClass();
$build_env->target = "build/index.php"; $build_env->target = "build/index.php";
if(file_exists($build_env->target)) if(file_exists($build_env->target)) {
{
echo("Deleting old target...\n"); echo("Deleting old target...\n");
unlink($build_env->target); unlink($build_env->target);
} }

View file

@ -121,13 +121,12 @@ function task_docs-livereload {
function task_start-server { function task_start-server {
task_begin "Starting Server"; task_begin "Starting Server";
if [ -f "${server_pid_file}" ]; then if [ -f "${server_pid_file}" ]; then
echo -e "${FRED}${HC}Error: A development server appears to be running already. Try running the 'stop-server' task before starting it again.${RS}"; task_end 1 "${FRED}${HC}Error: A development server appears to be running already. Try running the 'stop-server' task before starting it again.${RS}";
task_end 1;
fi fi
php -S [::]:35623 -t build/ & php -S [::]:35623 -t build/ &
exit_code=$?; pid=$!; exit_code=$?; pid=$!;
echo "${pid}" >"${server_pid_file}"; echo "${pid}" >"${server_pid_file}";
task_end "${exit_code}"; task_end "${exit_code}" "";
task_begin "Opening Browser"; task_begin "Opening Browser";
sensible-browser [::]:35623; sensible-browser [::]:35623;

View file

@ -11,15 +11,6 @@ if(!isset($actions->credits))
exit(page_renderer::render_main("Error - $settings->$sitename", "<p>No credits page detected. The credits page is a required module!</p>")); exit(page_renderer::render_main("Error - $settings->$sitename", "<p>No credits page detected. The credits page is a required module!</p>"));
} }
// Download all the requested remote files
ini_set("user_agent", "$settings->sitename (Pepperminty-Wiki-Downloader; PHP/" . phpversion() . "; +https://github.com/sbrl/Pepperminty-Wiki/) Pepperminty-Wiki/$version");
foreach($remote_files as $remote_file_def) {
if(file_exists($remote_file_def["local_filename"]) && filesize($remote_file_def["local_filename"]) > 0)
continue;
error_log("[ Pepperminty-Wiki/$settings->sitename ] Downloading {$remote_file_def["local_filename"]} from {$remote_file_def["remote_url"]}");
file_put_contents($remote_file_def["local_filename"], fopen($remote_file_def["remote_url"], "rb"));
}
////////////////////////////////// //////////////////////////////////
/// Final Consistency Measures /// /// Final Consistency Measures ///

View file

@ -25,7 +25,7 @@
"version": "0.3", "version": "0.3",
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds an action called 'random' that redirects you to a random page.", "description": "Adds an action called 'random' that redirects you to a random page.",
"lastupdate": 1530448215, "lastupdate": 1551543744,
"optional": false, "optional": false,
"extra_data": [] "extra_data": []
}, },
@ -205,9 +205,11 @@
"version": "0.17.3", "version": "0.17.3",
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Allows you to edit pages by adding the edit and save actions. You should probably include this one.", "description": "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
"lastupdate": 1548629209, "lastupdate": 1551560775,
"optional": false, "optional": false,
"extra_data": [] "extra_data": {
"diff.min.js": "https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jsdiff\/2.2.2\/diff.min.js"
}
}, },
{ {
"id": "page-export", "id": "page-export",

View file

@ -5,15 +5,13 @@ register_module([
"author" => "Starbeamrainbowlabs", "author" => "Starbeamrainbowlabs",
"description" => "Allows you to edit pages by adding the edit and save actions. You should probably include this one.", "description" => "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
"id" => "page-edit", "id" => "page-edit",
"extra_data" => [
"diff.min.js" => "https://cdnjs.cloudflare.com/ajax/libs/jsdiff/2.2.2/diff.min.js"
],
"code" => function() { "code" => function() {
global $settings, $env; global $settings, $env;
// Download diff.min.js - which we use when displaying edit conflicts
register_remote_file([
"local_filename" => "diff.min.js",
"remote_url" => "https://cdnjs.cloudflare.com/ajax/libs/jsdiff/2.2.2/diff.min.js"
]);
/** /**
* @api {get} ?action=edit&page={pageName}[&newpage=yes] Get an editing page * @api {get} ?action=edit&page={pageName}[&newpage=yes] Get an editing page
@ -438,7 +436,7 @@ window.addEventListener("load", function(event) {
}); });
DIFFSCRIPT; DIFFSCRIPT;
// diff.min.js is downloaded above // diff.min.js is downloaded above
$content .= "\n<script src='diff.min.js'></script> $content .= "\n<script src='$paths->extra_data_dir/page-edit/diff.min.js'></script>
<script>$diffScript</script>\n"; <script>$diffScript</script>\n";
header("x-failure-reason: edit-conflict"); header("x-failure-reason: edit-conflict");

View file

@ -39,18 +39,19 @@ if(php_sapi_name() != "cli") {
log_str("Reading in core files...\n"); log_str("Reading in core files...\n");
// We trim from the end here because of the __halt_compiler() directive $core_files_list = glob("core/*.php"); natsort($core_files_list);
$core = rtrim(file_get_contents("core.php"));
$settings = file_get_contents("settings.fragment.php"); $core = "<?php\n";
$settings = str_replace([ "<?php", "?>" ], "", $settings); foreach($core_files_list as $core_filename)
$core .= str_replace([ "<?php", "?>" ], "", file_get_contents($core_filename));
$core = str_replace([ $core = str_replace([
"//{settings}",
"{version}", "{version}",
"{commit}", "{commit}",
"{guiconfig}", "{guiconfig}",
"{default-css}" "{default-css}"
], [ ], [
$settings,
trim(file_get_contents("version")), trim(file_get_contents("version")),
exec("git rev-parse HEAD"), exec("git rev-parse HEAD"),
trim(file_get_contents("peppermint.guiconfig.json")), trim(file_get_contents("peppermint.guiconfig.json")),