// Registeres an extension and possible update depencies
function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = true) {
- global $UPDATE_NOTES, $_CONFIG, $INC_POOL, $cacheInstance;
- global $EXT_VER_HISTORY, $SQLs, $NOTES, $EXT_ALWAYS_ACTIVE, $EXT_VERSION;
- global $EXT_UPDATE_DEPENDS;
+ global $UPDATE_NOTES, $INC_POOL, $cacheInstance;
+ global $EXT_VER_HISTORY, $NOTES, $EXT_ALWAYS_ACTIVE, $EXT_VERSION;
+ global $EXT_UPDATE_DEPENDS, $SQLs;
// This shall never do a non-admin user!
if (!IS_ADMIN()) return false;
$NOTES = "";
$INC_POOL = array();
- // By default the language prefix is the extension's name
- // @TODO: Do we really need this one anymore? Can't we just take $ext_name and done?
// By default we have no failtures
$EXT_REPORTS_FAILURE = false;
array($ext_name, $EXT_ALWAYS_ACTIVE, $EXT_VERSION), __FILE__, __LINE__);
// Remove cache file(s) if extension is active
- RUN_FILTER('post_extension_installed', array('ext_name' => $ext_name, 'task_id' => $task_id));
+ RUN_FILTER('post_extension_installed', array('ext_name' => $ext_name, 'task_id' => $task_id, 'inc_pool' => $INC_POOL));
// In normal mode return a true on success
$ret = true;
// Run SQL queries for given extension id
// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
function EXTENSION_RUN_SQLS ($ext_id, $load_mode) {
- global $cacheInstance, $_CONFIG;
+ global $cacheInstance, $SQLs;
// This shall never do a non-admin user!
if (!IS_ADMIN()) return false;
// Load extension in detected mode
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":ext_name[{$ext_id}]={$ext_name}");
- LOAD_EXTENSION($ext_name, $load_mode, false, $SQLs);
+ LOAD_EXTENSION($ext_name, $load_mode, "", false, $SQLs);
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":SQLs::count=".count($SQLs)."");
if ((is_array($SQLs) && (sizeof($SQLs) > 0))) {
// Run SQL commands...
- foreach ($SQLs as $sql) {
- // Trim spaces away which we don't need
- $sql = trim($sql);
-
- // Is there still an SQL query?
- if (!empty($sql)) {
- // Do we have an "ALTER TABLE" command?
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":SQL={$SQL}");
- if (substr(strtolower($sql), 0, 11) == "alter table") {
- // Analyse the alteration command
- SQL_ALTER_TABLE($sql, __FILE__, __LINE__);
- } else {
- // Run regular SQL command
- $result = SQL_QUERY($sql, __FILE__, __LINE__, false);
- }
-
- // An SQL has been executed
- $sqlRan = true;
- } // END - if
- } // END - foreach
+ RUN_FILTER('run_sqls');
// Removal mode?
if ($load_mode == "remove") {
// Updates a given extension with current extension version to latest version
function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) {
// This shall never do a non-admin user!
- global $cacheInstance, $_CONFIG, $UPDATE_NOTES, $NOTES, $EXT_VER_HISTORY;
- global $EXT_UPDATE_DEPENDS, $EXT_VERSION, $INC_POOL, $SQLs, $cacheArray;
+ global $cacheInstance, $UPDATE_NOTES, $NOTES, $EXT_VER_HISTORY;
+ global $EXT_UPDATE_DEPENDS, $EXT_VERSION, $INC_POOL, $cacheArray;
// Init arrays
$SQLs = array(); $INC_POOL = array();
// In real-mode execute any existing includes
if (!$dry_run) {
$cacheArray['inc_pool'][$ext_name] = $INC_POOL;
- RUN_FILTER('load_includes');
+ RUN_FILTER('load_includes', $INC_POOL);
$INC_POOL = $cacheArray['inc_pool'][$ext_name];
unset($cacheArray['inc_pool'][$ext_name]);
} // END - if
// Run SQLs
- RUN_FILTER('run_sqls', $dry_run);
+ RUN_FILTER('run_sqls', array('dry_run' => $dry_run, 'sqls' => $SQLs));
if (!$dry_run) {
// Create task
// Output verbose SQL table for extension
function EXTENSION_VERBOSE_TABLE ($queries = array(), $title = ADMIN_SQLS_EXECUTED_ON_REMOVAL, $dashed = "", $switch = false, $width = "100%") {
- global $_CONFIG, $SQLs;
+ global $SQLs;
// Are there some queries in $queries?
if (count($queries) > 0) {