mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-25 05:22:59 +00:00
cleared space for a new build script
This commit is contained in:
parent
58456834c6
commit
8b61af93b1
3 changed files with 57 additions and 54 deletions
|
@ -1,2 +1,2 @@
|
|||
del index.php
|
||||
php build.php
|
||||
php build.old.php
|
||||
|
|
54
build.old.php
Normal file
54
build.old.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
$start_time = microtime(true);
|
||||
function logstr($str, $newline = true, $showtime = true)
|
||||
{
|
||||
global $start_time;
|
||||
if($showtime)
|
||||
echo("[ " . round(microtime(true) - $start_time, 4) . " ] ");
|
||||
echo($str);
|
||||
if($newline)
|
||||
echo("\n");
|
||||
}
|
||||
|
||||
function removeouterphptags($phpcode)
|
||||
{
|
||||
$firstindex = strpos($phpcode, "\n", strpos($phpcode, "<?php"));
|
||||
$lastindex = strrpos($phpcode, "?>");
|
||||
|
||||
return substr($phpcode, $firstindex, $lastindex - $firstindex);
|
||||
}
|
||||
|
||||
header("content-type: text/plain");
|
||||
|
||||
// Protects against users wiping the settings if run via CGI
|
||||
logstr("Checking for existing build....", false);
|
||||
if(file_exists("index.php"))
|
||||
{
|
||||
log_str("fail!", true, false);
|
||||
log_str("A build already exists in this directory.");
|
||||
log_str("Please delete it and then run this script again.");
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
logstr("pass - no other builds were found.", true, false);
|
||||
|
||||
logstr("Reading `core.php`...", false);
|
||||
$build = file_get_contents("core.php");
|
||||
logstr("done", true, false);
|
||||
logstr("Reading `settings.fragment.php`...", false);
|
||||
$settings = removeouterphptags(file_get_contents("settings.fragment.php"));
|
||||
logstr("done", true, false);
|
||||
|
||||
logstr("Building.....", false);
|
||||
$build = str_replace([
|
||||
"{settings}"
|
||||
], [
|
||||
$settings
|
||||
], $build);
|
||||
logstr("done", true, false);
|
||||
|
||||
logstr("Writing build....", false);
|
||||
file_put_contents("index.php", $build);
|
||||
logstr("done!", true, false);
|
||||
logstr("*** Build Completed ***");
|
55
build.php
55
build.php
|
@ -1,54 +1,3 @@
|
|||
<?php
|
||||
$start_time = microtime(true);
|
||||
function logstr($str, $newline = true, $showtime = true)
|
||||
{
|
||||
global $start_time;
|
||||
if($showtime)
|
||||
echo("[ " . round(microtime(true) - $start_time, 4) . " ] ");
|
||||
echo($str);
|
||||
if($newline)
|
||||
echo("\n");
|
||||
}
|
||||
|
||||
function removeouterphptags($phpcode)
|
||||
{
|
||||
$firstindex = strpos($phpcode, "\n", strpos($phpcode, "<?php"));
|
||||
$lastindex = strrpos($phpcode, "?>");
|
||||
|
||||
return substr($phpcode, $firstindex, $lastindex - $firstindex);
|
||||
}
|
||||
|
||||
header("content-type: text/plain");
|
||||
|
||||
// Protects against users wiping the settings if run via CGI
|
||||
logstr("Checking for existing build....", false);
|
||||
if(file_exists("index.php"))
|
||||
{
|
||||
log_str("fail!", true, false);
|
||||
log_str("A build already exists in this directory.");
|
||||
log_str("Please delete it and then run this script again.");
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
logstr("pass - no other builds were found.", true, false);
|
||||
|
||||
logstr("Reading `core.php`...", false);
|
||||
$build = file_get_contents("core.php");
|
||||
logstr("done", true, false);
|
||||
logstr("Reading `settings.fragment.php`...", false);
|
||||
$settings = removeouterphptags(file_get_contents("settings.fragment.php"));
|
||||
logstr("done", true, false);
|
||||
|
||||
logstr("Building.....", false);
|
||||
$build = str_replace([
|
||||
"{settings}"
|
||||
], [
|
||||
$settings
|
||||
], $build);
|
||||
logstr("done", true, false);
|
||||
|
||||
logstr("Writing build....", false);
|
||||
file_put_contents("index.php", $build);
|
||||
logstr("done!", true, false);
|
||||
logstr("*** Build Completed ***");
|
||||
exit("The new build system hasn't been written yet!");
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue