Start using the module order.

This commit is contained in:
markjcrane
2016-05-26 10:31:59 -06:00
parent 71525c26b0
commit 4c4a1bd15e
2 changed files with 51 additions and 44 deletions

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
Copyright (C) 2010 - 2016
All Rights Reserved.
Contributor(s):
@@ -25,45 +25,6 @@
*/
include "root.php";
//add the database structure
/*
require_once "resources/classes/modules.php";
$mod = new modules;
$mod->dir = $_SESSION['switch']['mod']['dir'];
echo $mod->dir."\n";
//database connection object
$mod->db = $db;
//get modules from the database
$mod->get_modules();
//module exists
if ($mod->exists("mod_lua")) {
echo "exists true\n";
}
else {
echo "exists false\n";
}
//module active
if ($mod->active("mod_lua")) {
echo "active true\n";
}
else {
echo "active false\n";
}
//synch
$mod->synch();
echo $mod->msg;
//show module info
$result = $mod->info("mod_lua");
echo "<pre>\n";
print_r($result);
echo "</pre>\n";
//list modules
//$result = $mod->modules
//echo "<pre>\n";
//print_r($result);
//echo "</pre>\n";
*/
//define the directory class
class modules {
public $db;
@@ -156,6 +117,7 @@ echo $mod->dir."\n";
$mod['module_label'] = 'Commands';
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'API interface commands.';
$mod['module_order'] = 100;
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
@@ -170,6 +132,7 @@ echo $mod->dir."\n";
$mod['module_label'] = 'Console';
$mod['module_category'] = 'Loggers';
$mod['module_description'] = 'Send logs to the console.';
$mod['module_order'] = 300;
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
@@ -345,6 +308,7 @@ echo $mod->dir."\n";
$mod['module_label'] = 'Log File';
$mod['module_category'] = 'Loggers';
$mod['module_description'] = 'Send logs to the local file system.';
$mod['module_order'] = 300;
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
@@ -359,7 +323,7 @@ echo $mod->dir."\n";
$mod['module_label'] = 'Lua';
$mod['module_category'] = 'Languages';
$mod['module_description'] = 'Lua script.';
$mod['module_order'] = 100;
$mod['module_order'] = 200;
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
@@ -368,6 +332,7 @@ echo $mod->dir."\n";
$mod['module_category'] = 'Applications';
$mod['module_description'] = 'API for memcached.';
$mod['module_enabled'] = 'true';
$mod['module_order'] = 100;
$mod['module_default_enabled'] = 'true';
break;
case "mod_native_file":
@@ -584,6 +549,7 @@ echo $mod->dir."\n";
$mod['module_label'] = 'Syslog';
$mod['module_category'] = 'Loggers';
$mod['module_description'] = 'Send logs to a remote syslog server.';
$mod['module_order'] = 300;
$mod['module_enabled'] = 'true';
$mod['module_default_enabled'] = 'true';
break;
@@ -736,7 +702,7 @@ echo $mod->dir."\n";
$order = $mod['module_order'];
}
else {
$order = 200;
$order = 500;
}
//insert the data
$module_uuid = uuid();
@@ -781,4 +747,43 @@ echo $mod->dir."\n";
}
} //class
?>
//add the database structure
/*
require_once "resources/classes/modules.php";
$mod = new modules;
$mod->dir = $_SESSION['switch']['mod']['dir'];
echo $mod->dir."\n";
//database connection object
$mod->db = $db;
//get modules from the database
$mod->get_modules();
//module exists
if ($mod->exists("mod_lua")) {
echo "exists true\n";
}
else {
echo "exists false\n";
}
//module active
if ($mod->active("mod_lua")) {
echo "active true\n";
}
else {
echo "active false\n";
}
//synch
$mod->synch();
echo $mod->msg;
//show module info
$result = $mod->info("mod_lua");
echo "<pre>\n";
print_r($result);
echo "</pre>\n";
//list modules
//$result = $mod->modules
//echo "<pre>\n";
//print_r($result);
//echo "</pre>\n";
*/
?>

View File

@@ -391,7 +391,9 @@ function save_module_xml() {
$xml .= "<configuration name=\"modules.conf\" description=\"Modules\">\n";
$xml .= " <modules>\n";
$sql = "select * from v_modules order by module_name='mod_commands' OR module_category = 'Languages' OR module_category = 'Loggers' DESC, module_category ";
$sql = "select * from v_modules ";
$sql .= "order by module_order ASC ";
$sql .= "module_category ASC";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$prev_module_cat = '';