// Registeres an extension and possible update depencies
function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = true) {
global $INC_POOL;
- global $NOTES;
// This shall never do a non-admin user!
if (!IS_ADMIN()) return false;
} // END - if
} // END - if
- // Init queries
+ // Init queries and notes
INIT_SQLS();
+ EXT_INIT_NOTES();
// Init variables
$ret = false;
- $NOTES = "";
$INC_POOL = array();
// By default we have no failures
LOAD_EXTENSION($ext_name, "update", $ver, $dry_run);
// Add update notes to our output
- $NOTES .= ADD_EXTENSION_NOTES($ver);
+ ADD_EXTENSION_NOTES($ver);
} // END - foreach
// Does this extension depends on an outstanding update of another update?
// 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 $NOTES;
global $INC_POOL;
// Init arrays
INIT_SQLS();
+ EXT_INIT_NOTES();
$INC_POOL = array();
- // Init notes
- $NOTES = "";
-
// Only admins are allowed to update extensions
if ((!IS_ADMIN()) || (empty($ext_name))) return false;
} // END - if
// Add notes
- $NOTES .= ADD_EXTENSION_NOTES($GLOBALS['cache_array']['update_ver'][$ext_name]);
+ ADD_EXTENSION_NOTES($GLOBALS['cache_array']['update_ver'][$ext_name]);
} // END - for
// In real-mode execute any existing includes
if (!$dry_run) {
// Create task
- CREATE_EXTENSION_UPDATE_TASK(GET_CURRENT_ADMIN_ID(), $ext_name, $GLOBALS['cache_array']['update_ver'][$ext_name], SQL_ESCAPE($NOTES));
+ CREATE_EXTENSION_UPDATE_TASK(GET_CURRENT_ADMIN_ID(), $ext_name, $GLOBALS['cache_array']['update_ver'][$ext_name], SQL_ESCAPE(EXT_GET_NOTES(EXT_GET_NOTES())));
// Update extension's version
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_version='%s' WHERE ext_name='%s' LIMIT 1",
'ver' => $ver,
'notes' => EXT_GET_UPDATE_NOTES()
);
+
+ // Reset them
EXT_SET_UPDATE_NOTES("");
} elseif (($ver == "0.0") || ($ver == "0.0.0")) {
// Initial release
$out = LOAD_TEMPLATE("admin_ext_notes", true, $content);
} // END - if
- // Return the output
- return $out;
+ // Add the notes
+ EXT_APPEND_NOTES($out);
}
// Getter for CSS files array
// Setter for EXT_ALWAYS_ACTIVE flag
function EXT_SET_ALWAYS_ACTIVE ($active) {
- $GLOBALS['ext_always_active'] = $active;
+ $GLOBALS['ext_always_active'] = (string) $active;
}
// Getter for EXT_ALWAYS_ACTIVE flag
// Setter for EXT_VERSION flag
function EXT_SET_VERSION ($version) {
- $GLOBALS['ext_version'] = $version;
+ $GLOBALS['ext_version'] = (float) $version;
}
// Getter for EXT_VERSION flag
// Setter for EXT_DEPRECATED flag
function EXT_SET_DEPRECATED ($deprecated) {
- $GLOBALS['ext_deprecated'] = $deprecated;
+ $GLOBALS['ext_deprecated'] = (string) $deprecated;
}
// Getter for EXT_DEPRECATED flag
// Setter for EXT_UPDATE_DEPENDS flag
function EXT_SET_UPDATE_DEPENDS ($updateDepends) {
- $GLOBALS['ext_update_depends'] = $updateDepends;
+ $GLOBALS['ext_update_depends'] = (string) $updateDepends;
}
// Getter for EXT_UPDATE_DEPENDS flag
// Setter for EXT_REPORTS_FAILURE flag
function EXT_SET_REPORTS_FAILURE ($reportsFailure) {
- $GLOBALS['ext_reports_failure'] = $reportsFailure;
+ $GLOBALS['ext_reports_failure'] = (string) $reportsFailure;
}
// Getter for EXT_REPORTS_FAILURE flag
$GLOBALS['ext_ver_history'] = (array) $verHistory;
}
-// Getter for EXT_VER_HISTORY flag
+// Getter for EXT_VER_HISTORY array
function EXT_GET_VER_HISTORY () {
return $GLOBALS['ext_ver_history'];
}
// Setter for EXT_UPDATE_NOTES flag
function EXT_SET_UPDATE_NOTES ($updateNotes) {
- $GLOBALS['ext_update_notes'] = (array) $updateNotes;
+ $GLOBALS['ext_update_notes'] = (string) $updateNotes;
}
// Getter for EXT_UPDATE_NOTES flag
return $GLOBALS['ext_update_notes'];
}
+// Init extension notice
+function EXT_INIT_NOTES () {
+ $GLOBALS['ext_notes'] = "";
+}
+
+// Append extension notice
+function EXT_APPEND_NOTES ($notes) {
+ $GLOBALS['ext_notes'] .= (string) $notes;
+}
+
+// Getter for extension notes
+function EXT_GET_NOTES () {
+ return $GLOBALS['ext_notes'];
+}
+
//
?>