X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fextensions-functions.php;h=dfa79d8fb9c739f19abcb241befba9d73297b13d;hp=359b09fe45e45d5a3ae7bd93e0279d4c48b2a8a1;hb=6aa5b6c3d7c49ceb5a41b836657321e9c0b5dea5;hpb=64c8349613addc3da2242c5cd6b99d64e3fb5f8e
diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php
index 359b09fe45..dfa79d8fb9 100644
--- a/inc/extensions-functions.php
+++ b/inc/extensions-functions.php
@@ -92,7 +92,7 @@ function loadExtension ($ext_name, $ext_mode = 'init', $ext_ver = '', $dry_run =
// Do we have cache?
if (isExtensionFunctionFileReadable($ext_name)) {
// Not yet loaded?
- if (($GLOBALS['cache_array']['extension']['ext_func'][$ext_name] == 'Y') && (!isset($GLOBALS['ext_loaded']['funcs'][$ext_name]))) {
+ if ((($GLOBALS['cache_array']['extension']['ext_func'][$ext_name] == 'Y') || (!isset($GLOBALS['cache_array']['extension']['ext_func'][$ext_name]))) && (!isset($GLOBALS['ext_loaded']['funcs'][$ext_name]))) {
// Construct FQFN for functions file
$funcsInclude = sprintf("inc/libs/%s_functions.php", $ext_name);
@@ -102,7 +102,7 @@ function loadExtension ($ext_name, $ext_mode = 'init', $ext_ver = '', $dry_run =
// Download functions file
loadIncludeOnce($funcsInclude);
} // END - if
- } elseif ((!isset($GLOBALS['cache_array']['extension']['ext_func'][$ext_name])) && (isDebugModeEnabled()) && (getOutputMode() == '0') && ($ext_name != 'sql_patches') && (substr($ext_name, 0, 10) != 'admintheme') && (getExtensionMode() == 'test')) {
+ } elseif ((!isset($GLOBALS['cache_array']['extension']['ext_func'][$ext_name])) && (isDebugModeEnabled()) && (getOutputMode() == 0) && ($ext_name != 'sql_patches') && (substr($ext_name, 0, 10) != 'admintheme') && (getExtensionMode() == 'test')) {
// No functions file is not so good...
logDebugMessage(__FUNCTION__, __LINE__, sprintf("NOTICE: Extension %s has no own functions file or we cannot read from it. mode=%s",
$ext_name,
@@ -534,7 +534,7 @@ function getExtensionVersion ($ext_name) {
// Count cache hits
incrementStatsEntry('cache_hits');
- } elseif ((!isCacheInstanceValid()) || (isset($GLOBALS['cache_array']['extension'])) || (getOutputMode() != '0')) {
+ } elseif ((!isCacheInstanceValid()) || (isset($GLOBALS['cache_array']['extension'])) || (getOutputMode() != 0)) {
// Load from database
$result = SQL_QUERY_ESC("SELECT `ext_version` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
@@ -610,17 +610,23 @@ function updateExtension ($ext_name, $ext_ver, $dry_run = false) {
if (count($depencies) > 0) {
// Apply all extension depencies
foreach ($depencies as $ext_depend) {
- // Set it as current
- setCurrentExtensionName($ext_depend);
-
- // Is the extension there?
- if (isExtensionInstalled()) {
- // Update another extension first!
- $test = updateExtension($ext_depend, getExtensionVersion($ext_depend), getExtensionDryRun());
- } else {
- // Register new extension
- $test = registerExtension($ext_depend, 0, getExtensionDryRun(), false);
- }
+ // Did we already update/register this?
+ if (!isset($GLOBALS['ext_updated'][$ext_depend])) {
+ // Set it as current
+ setCurrentExtensionName($ext_depend);
+
+ // Mark it as already updated before we update it
+ $GLOBALS['ext_updated'][$ext_depend] = true;
+
+ // Is the extension there?
+ if (isExtensionInstalled($ext_depend)) {
+ // Update another extension first!
+ $test = updateExtension($ext_depend, getExtensionVersion($ext_depend), getExtensionDryRun());
+ } else {
+ // Register new extension
+ $test = registerExtension($ext_depend, 0, getExtensionDryRun(), false);
+ }
+ } // END - if
} // END - foreach
// Set name back
@@ -1030,7 +1036,7 @@ function addExtensionNotes ($ver) {
$out = ''; $content = array();
// Is do we have verbose output enabled?
- if ((getConfig('verbose_sql') == 'Y') || (!isExtensionActive('sql_patches'))) {
+ if ((!isExtensionActive('sql_patches')) || (getConfig('verbose_sql') == 'Y')) {
// Update notes found?
if (getExtensionUpdateNotes($ver) != '') {
// Update notes found
@@ -1385,9 +1391,9 @@ function FILTER_INIT_EXTENSIONS () {
// Do we have some entries?
//* DEBUG */ print __FUNCTION__.': ENTRY!
';
if (isset($GLOBALS['cache_array']['extension']['ext_name'])) {
- //* DEBUG */ print __FUNCTION__.': CACHE - START!
';
// Load all found extensions if found
- foreach ($GLOBALS['cache_array']['extension']['ext_name'] as $key=>$ext_name) {
+ //* DEBUG */ print __FUNCTION__.': CACHE - START!
';
+ foreach ($GLOBALS['cache_array']['extension']['ext_name'] as $key => $ext_name) {
// Load it
//* DEBUG */ print __FUNCTION__.': '.$ext_name.' - START
';
loadExtension($ext_name, 'init');
@@ -1570,5 +1576,137 @@ function isExtensionFunctionFileReadable ($ext_name) {
return ($GLOBALS['cache_array']['extension']['ext_func'][$ext_name] == 'Y');
}
+// Adds an admin menu to the SQL queue of the menu entry is not found
+function addAdminMenuSql ($action, $what, $title, $descr, $sort) {
+ // Now check if this menu is there
+ if (!isMenuActionValid('admin', $action, $what)) {
+ // Is what null?
+ if (is_null($what)) {
+ // Add main menu
+ $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES('%s',NULL,'%s','%s',%s)",
+ $action,
+ $title,
+ $descr,
+ bigintval($sort)
+ );
+ } else {
+ // Add sub menu
+ $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES('%s','%s','%s','%s',%s)",
+ $action,
+ $what,
+ $title,
+ $descr,
+ bigintval($sort)
+ );
+ }
+
+ // Add it to the queue
+ addExtensionSql($sql);
+ } elseif (isDebugModeEnabled()) {
+ // Double menus should be located and fixed!
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Double admin menu action=%s, what=%s detected.", $action, $what));
+ }
+}
+
+// Adds a guest menu to the SQL queue if the menu entry is not found
+function addGuestMenuSql ($action, $what, $title, $visible, $locked, $sort) {
+ // Now check if this menu is there
+ if (!isMenuActionValid('guest', $action, $what)) {
+ // Is what null?
+ if (is_null($what)) {
+ // Add main menu
+ $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s',NULL,'%s','%s','%s',%s)",
+ $action,
+ $title,
+ $visible,
+ $locked,
+ bigintval($sort)
+ );
+ } else {
+ // Add sub menu
+ $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s','%s','%s','%s','%s',%s)",
+ $action,
+ $what,
+ $title,
+ $visible,
+ $locked,
+ bigintval($sort)
+ );
+ }
+
+ // Add it to the queue
+ addExtensionSql($sql);
+ } elseif (isDebugModeEnabled()) {
+ // Double menus should be located and fixed!
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Double guest menu action=%s, what=%s detected.", $action, $what));
+ }
+}
+
+// Adds a member menu to the SQL queue if the menu entry is not found
+function addMemberMenuSql ($action, $what, $title, $visible, $locked, $sort) {
+ // Now check if this menu is there
+ if (!isMenuActionValid('member', $action, $what)) {
+ // Is what null?
+ if (is_null($what)) {
+ // Add main menu
+ $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s',NULL,'%s','%s','%s',%s)",
+ $action,
+ $title,
+ $visible,
+ $locked,
+ bigintval($sort)
+ );
+ } else {
+ // Add sub menu
+ $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s','%s','%s','%s','%s',%s)",
+ $action,
+ $what,
+ $title,
+ $visible,
+ $locked,
+ bigintval($sort)
+ );
+ }
+
+ // Add it to the queue
+ addExtensionSql($sql);
+ } elseif (isDebugModeEnabled()) {
+ // Double menus should be located and fixed!
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Double member menu action=%s, what=%s detected.", $action, $what));
+ }
+}
+
+// Adds a sponsor menu to the SQL queue if the menu entry is not found
+function addSponsorMenuSql ($action, $what, $title, $active, $sort) {
+ // Now check if this menu is there, if no ext-sponsor is installed all is not yet added
+ if ((!isExtensionInstalled('sponsor')) || (!isMenuActionValid('sponsor', $action, $what))) {
+ // Is what null?
+ if (is_null($what)) {
+ // Add main menu
+ $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_sponsor_menu` (`action`,`what`,`title`,`active`,`sort`) VALUES('%s',NULL,'%s','%s',%s)",
+ $action,
+ $title,
+ $active,
+ bigintval($sort)
+ );
+ } else {
+ // Add sub menu
+ $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_sponsor_menu` (`action`,`what`,`title`,`active`,`sort`) VALUES('%s','%s','%s','%s',%s)",
+ $action,
+ $what,
+ $title,
+ $active,
+ bigintval($sort)
+ );
+ }
+
+ // Add it to the queue
+ addExtensionSql($sql);
+ } elseif (isDebugModeEnabled()) {
+ // Double menus should be located and fixed!
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Double sponsor menu action=%s, what=%s detected.", $action, $what));
+ }
+}
+
// [EOF]
?>