1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 04:23:01 +00:00

added php script to auto-build the module index

This commit is contained in:
Starbeamrainbowlabs 2015-04-25 14:33:09 +01:00
parent 8b61af93b1
commit 96a1b4db9b
3 changed files with 120 additions and 9 deletions

View file

@ -1,10 +1,90 @@
[
{
"name": "Page Viewer",
"name": "Password hashing action",
"version": "0.4",
"author": "Starbeamrainbowlabs",
"description": "Adds a utility action (that anyone can use) called hash that hashes a given string. Useful when changing a user's password.",
"id": "action-hash",
"lastmodified": 1429968727
},
{
"name": "Credits",
"version": "0.4",
"author": "Starbeamrainbowlabs",
"description": "Adds the credits page. You *must* have this module :D",
"id": "page-credits",
"lastmodified": 1428760042
},
{
"name": "Page deleter",
"version": "0.4",
"author": "Starbeamrainbowlabs",
"description": "Adds an action to allow administrators to delete pages.",
"id": "page-delete",
"lastmodified": 1428759115
},
{
"name": "Page editor",
"version": "0.4",
"author": "Starbeamrainbowlabs",
"description": "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
"id": "page-edit",
"lastmodified": 1428758936
},
{
"name": "Help page",
"version": "0.4",
"author": "Starbeamrainbowlabs",
"description": "Adds the help action. You really want this one.",
"id": "page-help",
"lastmodified": 1428759307
},
{
"name": "Page list",
"version": "0.4",
"author": "Starbeamrainbowlabs",
"description": "Adds a page that lists all the pages in the index long with their metadata.",
"id": "page-list",
"lastmodified": 1428758608
},
{
"name": "Login",
"version": "0.4",
"author": "Starbeamrainbowlabs",
"description": "Adds a pair of actions (login and checklogin) that allow users to login. You need this one if you want your users to be able to login.",
"id": "page-login",
"lastmodified": 1428759587
},
{
"name": "Logout",
"version": "0.4",
"author": "Starbeamrainbowlabs",
"description": "Adds an action to let users user out. For security reasons it is wise to add this module since logging in automatically opens a session that is valid for 30 days.",
"id": "page-logout",
"lastmodified": 1428760035
},
{
"name": "Page mover",
"version": "0.4",
"author": "Starbeamrainbowlabs",
"description": "Adds an action to allow administrators to move pages.",
"id": "page-move",
"lastmodified": 1428760214
},
{
"name": "Update",
"version": "0.4",
"author": "Starbeamrainbowlabs",
"description": "Adds an update page that downloads the latest stable version of Pepperminty Wiki. This module is currently outdated as it doesn't save your module preferences.",
"id": "page-update",
"lastmodified": 1428760319
},
{
"name": "Page viewer",
"version": "0.4",
"author": "Starbeamrainbowlabs",
"description": "Allows you to view pages. You should include this one.",
"id": "page-view",
"lastupdate": 1426362000,
"lastmodified": 1428757674
}
]

View file

@ -4,7 +4,7 @@ register_module([
"version" => "0.4",
"author" => "Starbeamrainbowlabs",
"description" => "Adds a utility action (that anyone can use) called hash that hashes a given string. Useful when changing a user's password.",
"id" => "page-hash",
"id" => "action-hash",
"code" => function() {
add_action("hash", function() {
if(!isset($_GET["string"]))

31
rebuild_module_index.php Normal file
View file

@ -0,0 +1,31 @@
<?php
$modules = glob("modules/*.php");
$module_index = [];
function register_module($settings)
{
global $module_index;
$newmodule = [
"name" => $settings["name"],
"version" => $settings["version"],
"author" => $settings["author"],
"description" => $settings["description"],
"id" => $settings["id"],
"lastmodified" => filemtime("modules/" . $settings["id"] . ".php")
];
$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");
?>