2015-09-20 11:37:21 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
echo("*** Preparing environment ***\n");
|
|
|
|
|
|
|
|
$build_env = new stdClass();
|
|
|
|
$build_env->target = "build/index.php";
|
|
|
|
|
|
|
|
if(file_exists($build_env->target))
|
|
|
|
{
|
|
|
|
echo("Deleting old target...\n");
|
|
|
|
unlink($build_env->target);
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
//////////////////////// Rebuild Module Index ////////////////////////
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
echo("*** Rebuilding module index ***\n");
|
|
|
|
$modules = glob("modules/*.php");
|
|
|
|
$module_index = [];
|
2016-03-12 15:26:30 +00:00
|
|
|
// Defined just in case a module needs to reference them when we require() them
|
|
|
|
// to gain information
|
|
|
|
$env = $paths = new stdClass();
|
2015-09-20 11:37:21 +00:00
|
|
|
|
|
|
|
function register_module($settings)
|
|
|
|
{
|
|
|
|
global $module_index;
|
2015-09-21 14:18:55 +00:00
|
|
|
|
|
|
|
// If the optional flag isn't set, then we should set it to false.
|
|
|
|
if(!isset($settings["optional"]) || !is_bool($settings["optional"]))
|
|
|
|
$settings["optional"] = false;
|
|
|
|
|
2015-09-20 11:37:21 +00:00
|
|
|
$newmodule = [
|
|
|
|
"name" => $settings["name"],
|
|
|
|
"version" => $settings["version"],
|
|
|
|
"author" => $settings["author"],
|
|
|
|
"description" => $settings["description"],
|
|
|
|
"id" => $settings["id"],
|
2015-09-22 13:51:38 +00:00
|
|
|
"lastupdate" => filemtime("modules/" . $settings["id"] . ".php"),
|
|
|
|
"optional" => $settings["optional"]
|
2015-09-20 11:37:21 +00:00
|
|
|
];
|
|
|
|
$module_index[] = $newmodule;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach($modules as $filename)
|
|
|
|
{
|
|
|
|
echo("Processing $filename\n");
|
|
|
|
require($filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
echo("*** Processing complete ***\n");
|
|
|
|
|
|
|
|
echo("Writing new module index to disk...");
|
|
|
|
file_put_contents("module_index.json", json_encode($module_index, JSON_PRETTY_PRINT));
|
|
|
|
echo("done\n");
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////// Build New Target //////////////////////////
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
require("pack.php");
|
|
|
|
|
|
|
|
?>
|