1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-24 17:13:01 +00:00

Add optional module support

This commit is contained in:
Starbeamrainbowlabs 2015-09-21 15:18:55 +01:00
parent 8197c32232
commit 03c908bb70
3 changed files with 12 additions and 1 deletions

View file

@ -5,6 +5,8 @@ php:
- 5.6
- nightly
before_script: php build.php
before_script:
- php build.php
- ls modules/*.php | xargs -n 1 php -l
script: php -l build/index.php

View file

@ -22,6 +22,11 @@ $module_index = [];
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"],

View file

@ -10,6 +10,10 @@ $module_index = json_decode(file_get_contents("module_index.json"));
$module_list = [];
foreach($module_index as $module)
{
// If the module is optional, the module's id isn't present in the command line arguments, and the special '*' module id wasn't passed in, skip it
if($module->optional &&
strrpos(implode(" ", $argv), $module->id) === false &&
!in_array("*", $argv)) continue;
$module_list[] = $module->id;
}