forked from sbrl/Pepperminty-Wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.php
More file actions
63 lines (49 loc) · 1.72 KB
/
build.php
File metadata and controls
63 lines (49 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?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 = [];
// Defined just in case a module needs to reference them when we require() them
// to gain information
$env = $paths = new stdClass();
function register_module($settings)
{
global $module_index;
// 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;
$newmodule = [
"name" => $settings["name"],
"version" => $settings["version"],
"author" => $settings["author"],
"description" => $settings["description"],
"id" => $settings["id"],
"lastupdate" => filemtime("modules/" . $settings["id"] . ".php"),
"optional" => $settings["optional"]
];
$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");
?>