1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-12-25 14:45:02 +00:00
Pepperminty-Wiki/build.php
2014-12-26 11:06:37 +00:00

45 lines
1.1 KiB
PHP

<?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");
}
header("content-type: text/plain");
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 = 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 ***");