Start using the module order.
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Copyright (C) 2010
|
Copyright (C) 2010 - 2016
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
@@ -25,45 +25,6 @@
|
|||||||
*/
|
*/
|
||||||
include "root.php";
|
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
|
//define the directory class
|
||||||
class modules {
|
class modules {
|
||||||
public $db;
|
public $db;
|
||||||
@@ -156,6 +117,7 @@ echo $mod->dir."\n";
|
|||||||
$mod['module_label'] = 'Commands';
|
$mod['module_label'] = 'Commands';
|
||||||
$mod['module_category'] = 'Applications';
|
$mod['module_category'] = 'Applications';
|
||||||
$mod['module_description'] = 'API interface commands.';
|
$mod['module_description'] = 'API interface commands.';
|
||||||
|
$mod['module_order'] = 100;
|
||||||
$mod['module_enabled'] = 'true';
|
$mod['module_enabled'] = 'true';
|
||||||
$mod['module_default_enabled'] = 'true';
|
$mod['module_default_enabled'] = 'true';
|
||||||
break;
|
break;
|
||||||
@@ -170,6 +132,7 @@ echo $mod->dir."\n";
|
|||||||
$mod['module_label'] = 'Console';
|
$mod['module_label'] = 'Console';
|
||||||
$mod['module_category'] = 'Loggers';
|
$mod['module_category'] = 'Loggers';
|
||||||
$mod['module_description'] = 'Send logs to the console.';
|
$mod['module_description'] = 'Send logs to the console.';
|
||||||
|
$mod['module_order'] = 300;
|
||||||
$mod['module_enabled'] = 'true';
|
$mod['module_enabled'] = 'true';
|
||||||
$mod['module_default_enabled'] = 'true';
|
$mod['module_default_enabled'] = 'true';
|
||||||
break;
|
break;
|
||||||
@@ -345,6 +308,7 @@ echo $mod->dir."\n";
|
|||||||
$mod['module_label'] = 'Log File';
|
$mod['module_label'] = 'Log File';
|
||||||
$mod['module_category'] = 'Loggers';
|
$mod['module_category'] = 'Loggers';
|
||||||
$mod['module_description'] = 'Send logs to the local file system.';
|
$mod['module_description'] = 'Send logs to the local file system.';
|
||||||
|
$mod['module_order'] = 300;
|
||||||
$mod['module_enabled'] = 'true';
|
$mod['module_enabled'] = 'true';
|
||||||
$mod['module_default_enabled'] = 'true';
|
$mod['module_default_enabled'] = 'true';
|
||||||
break;
|
break;
|
||||||
@@ -359,7 +323,7 @@ echo $mod->dir."\n";
|
|||||||
$mod['module_label'] = 'Lua';
|
$mod['module_label'] = 'Lua';
|
||||||
$mod['module_category'] = 'Languages';
|
$mod['module_category'] = 'Languages';
|
||||||
$mod['module_description'] = 'Lua script.';
|
$mod['module_description'] = 'Lua script.';
|
||||||
$mod['module_order'] = 100;
|
$mod['module_order'] = 200;
|
||||||
$mod['module_enabled'] = 'true';
|
$mod['module_enabled'] = 'true';
|
||||||
$mod['module_default_enabled'] = 'true';
|
$mod['module_default_enabled'] = 'true';
|
||||||
break;
|
break;
|
||||||
@@ -368,6 +332,7 @@ echo $mod->dir."\n";
|
|||||||
$mod['module_category'] = 'Applications';
|
$mod['module_category'] = 'Applications';
|
||||||
$mod['module_description'] = 'API for memcached.';
|
$mod['module_description'] = 'API for memcached.';
|
||||||
$mod['module_enabled'] = 'true';
|
$mod['module_enabled'] = 'true';
|
||||||
|
$mod['module_order'] = 100;
|
||||||
$mod['module_default_enabled'] = 'true';
|
$mod['module_default_enabled'] = 'true';
|
||||||
break;
|
break;
|
||||||
case "mod_native_file":
|
case "mod_native_file":
|
||||||
@@ -584,6 +549,7 @@ echo $mod->dir."\n";
|
|||||||
$mod['module_label'] = 'Syslog';
|
$mod['module_label'] = 'Syslog';
|
||||||
$mod['module_category'] = 'Loggers';
|
$mod['module_category'] = 'Loggers';
|
||||||
$mod['module_description'] = 'Send logs to a remote syslog server.';
|
$mod['module_description'] = 'Send logs to a remote syslog server.';
|
||||||
|
$mod['module_order'] = 300;
|
||||||
$mod['module_enabled'] = 'true';
|
$mod['module_enabled'] = 'true';
|
||||||
$mod['module_default_enabled'] = 'true';
|
$mod['module_default_enabled'] = 'true';
|
||||||
break;
|
break;
|
||||||
@@ -736,7 +702,7 @@ echo $mod->dir."\n";
|
|||||||
$order = $mod['module_order'];
|
$order = $mod['module_order'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$order = 200;
|
$order = 500;
|
||||||
}
|
}
|
||||||
//insert the data
|
//insert the data
|
||||||
$module_uuid = uuid();
|
$module_uuid = uuid();
|
||||||
@@ -781,4 +747,43 @@ echo $mod->dir."\n";
|
|||||||
}
|
}
|
||||||
} //class
|
} //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";
|
||||||
|
*/
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -391,7 +391,9 @@ function save_module_xml() {
|
|||||||
$xml .= "<configuration name=\"modules.conf\" description=\"Modules\">\n";
|
$xml .= "<configuration name=\"modules.conf\" description=\"Modules\">\n";
|
||||||
$xml .= " <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 = $db->prepare(check_sql($sql));
|
||||||
$prep_statement->execute();
|
$prep_statement->execute();
|
||||||
$prev_module_cat = '';
|
$prev_module_cat = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user