function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = true) {
global $UPDATE_NOTES, $INC_POOL, $cacheInstance;
global $EXT_VER_HISTORY, $NOTES, $EXT_ALWAYS_ACTIVE, $EXT_VERSION;
- global $EXT_UPDATE_DEPENDS, $SQLs;
+ global $EXT_UPDATE_DEPENDS;
// 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;
// "Dry-run-mode" activated?
if (!$dry_run) {
// Run installation pre-installation filters
- RUN_FILTER('pre_extension_installed', false);
+ RUN_FILTER('pre_extension_installed', array('dry_run' => $dry_run, 'sqls' => $SQLs));
// Register extension
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_extensions (ext_name, ext_active, ext_version) VALUES ('%s','%s','%s')",
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_extensions (ext_name, ext_active, ext_version) VALUES ('%s','%s','%s')",
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;
}
} elseif (($task_id > 0) && (!empty($ext_name))) {
// Remove task from system when id and extension's name is valid
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE id=%s AND status='NEW' LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE id=%s AND status='NEW' LIMIT 1",
array(bigintval($task_id)), __FILE__, __LINE__);
}
// 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, $SQLs;
+ global $cacheInstance;
// This shall never do a non-admin user!
if (!IS_ADMIN()) return false;
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":SQLs::count=".count($SQLs)."");
if ((is_array($SQLs) && (sizeof($SQLs) > 0))) {
// Run SQL commands...
- RUN_FILTER('run_sqls');
+ RUN_FILTER('run_sqls', array('dry_run' => false, 'sqls' => $SQLs));
// Removal mode?
if ($load_mode == "remove") {
// Delete this extension (remember to remove it from your server *before* you click on welcome!
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
array($ext_name), __FILE__, __LINE__);
} // END - if
} // END - if
function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) {
// This shall never do a non-admin user!
global $cacheInstance, $UPDATE_NOTES, $NOTES, $EXT_VER_HISTORY;
- global $EXT_UPDATE_DEPENDS, $EXT_VERSION, $INC_POOL, $cacheArray;
+ global $EXT_UPDATE_DEPENDS, $EXT_VERSION, $INC_POOL, $cacheArray, $SQLs;
// 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
CREATE_EXTENSION_UPDATE_TASK(GET_CURRENT_ADMIN_ID(), $ext_name, $cacheArray['update_ver'][$ext_name], addslashes($NOTES));
// Update extension's version
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_version='%s' WHERE ext_name='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_version='%s' WHERE ext_name='%s' LIMIT 1",
array($cacheArray['update_ver'][$ext_name], $ext_name), __FILE__, __LINE__);
// Remove arrays
// In "dry-run" mode return array with SQL commands
return $SQLs;
}
- }
+ } // END - if
}
// Output verbose SQL table for extension
// Activate given extension
function ACTIVATE_EXTENSION ($ext_name) {
// Activate the extension
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_active='Y' WHERE ext_name='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_active='Y' WHERE ext_name='%s' LIMIT 1",
array($ext_name), __FILE__, __LINE__);
// Extension has been activated?
// Deactivate given extension
function DEACTIVATE_EXTENSION($ext_name) {
// Activate the extension
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_active='N' WHERE ext_name='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_active='N' WHERE ext_name='%s' LIMIT 1",
array($ext_name), __FILE__, __LINE__);
// Extension has been activated?
}
// Task not created so it's a brand-new extension which we need to register and create a task for!
- $result_insert = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created)
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created)
VALUES (%s,0,'NEW','EXTENSION','%s','%s',UNIX_TIMESTAMP())",
array(
$admin_id,
// Not installed and do we have created a task for the admin?
if ((DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) && (GET_EXT_VERSION($ext) != "")) {
// Task not created so add it
- $result_insert = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created)
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created)
VALUES (0,0,'NEW','EXTENSION_DEACTIVATION','%s','%s',UNIX_TIMESTAMP())",
array(
$subject,
), __FILE__, __LINE__, true, false
);
} // END - if
-
- // Free memory
- SQL_FREERESULT($result);
}
// Checks if the module has a menu