From 06d97fddd5c72e2b1c14ddb855b7eddc53f169a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 27 Oct 2009 18:10:16 +0000 Subject: [PATCH] Fixes for installation phase --- inc/extensions-functions.php | 2 +- inc/extensions/ext-other.php | 11 +++++++++-- inc/filter-functions.php | 25 +++++++++++++------------ inc/filters.php | 10 ++++++++++ inc/load_cache.php | 1 - inc/loader/load_cache- | 3 +++ inc/loader/load_cache-admin.php | 3 +++ inc/loader/load_cache-config.php | 3 +++ inc/loader/load_cache-extension.php | 3 +++ inc/loader/load_cache-filter.php | 3 +++ inc/loader/load_cache-impressum.php | 3 +++ inc/loader/load_cache-modules.php | 3 +++ inc/loader/load_cache-refdepths.php | 3 +++ inc/loader/load_cache-refsystem.php | 3 +++ inc/loader/load_cache-them.php | 3 +++ inc/mysql-connect.php | 14 +++++++------- 16 files changed, 70 insertions(+), 23 deletions(-) diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index 359b09fe45..daac4a8218 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -614,7 +614,7 @@ function updateExtension ($ext_name, $ext_ver, $dry_run = false) { setCurrentExtensionName($ext_depend); // Is the extension there? - if (isExtensionInstalled()) { + if (isExtensionInstalled($ext_depend)) { // Update another extension first! $test = updateExtension($ext_depend, getExtensionVersion($ext_depend), getExtensionDryRun()); } else { diff --git a/inc/extensions/ext-other.php b/inc/extensions/ext-other.php index cd8ed9f78c..8520a0993e 100644 --- a/inc/extensions/ext-other.php +++ b/inc/extensions/ext-other.php @@ -42,10 +42,10 @@ if (!defined('__SECURITY')) { } // END - if // Version number -setThisExtensionVersion('0.2.2'); +setThisExtensionVersion('0.2.3'); // Version history array (add more with , '0.1.0' and so on) -setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2')); +setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3')); // Keep this extension always active! setExtensionAlwaysActive('Y'); @@ -203,6 +203,13 @@ switch (getExtensionMode()) { // Update notes (these will be set as task text!) setExtensionUpdateNotes("(Fast) alle SQL-Abfragen lassen sich nun zu Debugging-Zwecken (!) einschalten. Nur der Administrator sieht diese unten am Ende der Seite."); break; + + case '0.2.3': // SQL queries for v0.2.3 + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `max_send` BIGINT(20) NOT NULL DEFAULT 10"); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Fehlende Konfiguration hinzugefügt."); + break; } break; diff --git a/inc/filter-functions.php b/inc/filter-functions.php index b8f8313e2f..274ded1875 100644 --- a/inc/filter-functions.php +++ b/inc/filter-functions.php @@ -49,15 +49,15 @@ function initFilterSystem () { debug_report_bug(getMessage('FILTER_FAILED_ALREADY_INIT')); } // END - if - // Init dummy array - $filterArray = array( - 'chains' => array(), - 'loaded' => array(), - 'counter' => array() - ); - // Load all saved filers if sql_patches is updated if (isset($GLOBALS['cache_array']['filter']['filter_name'])) { + // Init dummy array + $filterArray = array( + 'chains' => array(), + 'loaded' => array(), + 'counter' => array() + ); + // Found in cache so rewrite the array foreach ($GLOBALS['cache_array']['filter']['filter_name'] as $idx => $filterName) { // Get filter function @@ -74,7 +74,7 @@ function initFilterSystem () { // Remove the cache $GLOBALS['cache_array']['filter'] = $filterArray; - } elseif (isExtensionInstalledAndNewer('sql_patches', '0.5.9')) { + } elseif ((!isInstallationPhase()) && (isExtensionInstalledAndNewer('sql_patches', '0.5.9'))) { // Init add $add = ''; if (getExtensionVersion('sql_patches') >= '0.6.0') $add = ", `filter_counter`"; @@ -201,7 +201,7 @@ function registerFilter ($filterName, $filterFunction, $silentAbort = true, $for } // END - if // Simply add it to the array - //* DEBUG: */ print 'filterName='.$filterName.',filterFunction='.$filterFunction.'
'; + //* DEBUG: */ print __FUNCTION__.': filterName='.$filterName.',filterFunction='.$filterFunction.'
'; $GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction] = 'A'; $GLOBALS['cache_array']['filter']['counter'][$filterName][$filterFunction] = 0; } // END - if @@ -224,6 +224,7 @@ function unregisterFilter ($filterName, $filterFunction, $force = false, $dry_ru // Shall we remove? (default, not while just showing an extension removal) if ($dry_run === false) { // Mark for filter removal + //* DEBUG: */ print __FUNCTION__.': filterName='.$filterName.',filterFunction='.$filterFunction.'
'; $GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction] = 'R'; } // END - if } @@ -233,9 +234,9 @@ function runFilterChain ($filterName, $data = null) { // Is that filter chain there? if (!isset($GLOBALS['cache_array']['filter']['chains'][$filterName])) { // We should find all these non-existing filter chains - if ($filterName != 'sql_admin_extra_data') { - /* Only for tracking: */ debug_report_bug('Filter chain ' . $filterName . ' not found!'); - } + /* Only for tracking: */ if ($filterName != 'sql_admin_extra_data') { + /* Only for tracking: */ debug_report_bug('Filter chain ' . $filterName . ' not found!'); + /* Only for tracking: */ } //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Filter chain ' . $filterName . ' not found!'); // Abort here and return content diff --git a/inc/filters.php b/inc/filters.php index 1d7a500476..1b26cddabb 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -580,6 +580,16 @@ function FILTER_HTML_INCLUDE_USERS ($mode) { // Filter for determining what/action/module function FILTER_DETERMINE_WHAT_ACTION () { + // In installation phase we don't have what/action + if (isInstallationPhase()) { + // Set both to empty + setAction(''); + setWhat(''); + + // Abort here + return; + } // END - if + // Get all values if ((getOutputMode() != 1) && (getOutputMode() != -1)) { // Fix module diff --git a/inc/load_cache.php b/inc/load_cache.php index cb35e6adf9..92db387cdb 100644 --- a/inc/load_cache.php +++ b/inc/load_cache.php @@ -43,7 +43,6 @@ if (!defined('__SECURITY')) { // Init cache instance and array $GLOBALS['cache_instance'] = null; -$GLOBALS['cache_array'] = array(); // Init cache first initCacheInstance(); diff --git a/inc/loader/load_cache- b/inc/loader/load_cache- index 548c05e6b8..4ff35f91e6 100644 --- a/inc/loader/load_cache- +++ b/inc/loader/load_cache- @@ -41,6 +41,9 @@ if (!defined('__SECURITY')) { die(); } // END - if +// Use this code if you don't want to run this cache loader on installation phase +//if (isInstallationPhase()) return; + // Let's start with the admins table... if (($GLOBALS['cache_instance']->loadCacheFile('foo')) && ($GLOBALS['cache_instance']->extensionVersionMatches('foo'))) { // Load cache diff --git a/inc/loader/load_cache-admin.php b/inc/loader/load_cache-admin.php index cc4ae544b4..93e862d4c5 100644 --- a/inc/loader/load_cache-admin.php +++ b/inc/loader/load_cache-admin.php @@ -41,6 +41,9 @@ if (!defined('__SECURITY')) { die(); } // END - if +// Use this code if you don't want to run this cache loader on installation phase +if (isInstallationPhase()) return; + // Let's start with the admins table... if (($GLOBALS['cache_instance']->loadCacheFile('admins')) && ($GLOBALS['cache_instance']->extensionVersionMatches('admins'))) { // Load cache diff --git a/inc/loader/load_cache-config.php b/inc/loader/load_cache-config.php index 8fd6c9aecf..bb4c475835 100644 --- a/inc/loader/load_cache-config.php +++ b/inc/loader/load_cache-config.php @@ -41,6 +41,9 @@ if (!defined('__SECURITY')) { die(); } +// Use this code if you don't want to run this cache loader on installation phase +if (isInstallationPhase()) return; + // Next cached table is the configuration (config)... if (($GLOBALS['cache_instance']->loadCacheFile('config')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { // Load config from cache diff --git a/inc/loader/load_cache-extension.php b/inc/loader/load_cache-extension.php index d765f85846..7ccaf9f4c9 100644 --- a/inc/loader/load_cache-extension.php +++ b/inc/loader/load_cache-extension.php @@ -43,6 +43,9 @@ if (!defined('__SECURITY')) { die(); } // END - if +// Use this code if you don't want to run this cache loader on installation phase +if (isInstallationPhase()) return; + // Next cached table is the extension if (($GLOBALS['cache_instance']->loadCacheFile('extension')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { // Load extension from cache diff --git a/inc/loader/load_cache-filter.php b/inc/loader/load_cache-filter.php index b158b05f99..74bff13b68 100644 --- a/inc/loader/load_cache-filter.php +++ b/inc/loader/load_cache-filter.php @@ -41,6 +41,9 @@ if (!defined('__SECURITY')) { die(); } // END - if +// Use this code if you don't want to run this cache loader on installation phase +if (isInstallationPhase()) return; + // Next cached table is the filteruration (filter)... if (($GLOBALS['cache_instance']->loadCacheFile('filter')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { // Load filter from cache diff --git a/inc/loader/load_cache-impressum.php b/inc/loader/load_cache-impressum.php index 20ed9562b6..ce165d830e 100644 --- a/inc/loader/load_cache-impressum.php +++ b/inc/loader/load_cache-impressum.php @@ -44,6 +44,9 @@ if (!defined('__SECURITY')) { return; } +// Use this code if you don't want to run this cache loader on installation phase +if (isInstallationPhase()) return; + // Let's start with the admins table... if (($GLOBALS['cache_instance']->loadCacheFile('imprint')) && ($GLOBALS['cache_instance']->extensionVersionMatches('imprint'))) { // Load cache diff --git a/inc/loader/load_cache-modules.php b/inc/loader/load_cache-modules.php index 8c66caa8a5..a1152a0d77 100644 --- a/inc/loader/load_cache-modules.php +++ b/inc/loader/load_cache-modules.php @@ -41,6 +41,9 @@ if (!defined('__SECURITY')) { die(); } // END - if +// Use this code if you don't want to run this cache loader on installation phase +if (isInstallationPhase()) return; + // Next cached table is the module registry (mod_reg)... if (($GLOBALS['cache_instance']->loadCacheFile('modules')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { // Load cache diff --git a/inc/loader/load_cache-refdepths.php b/inc/loader/load_cache-refdepths.php index 7b3b3157d2..5bb6ab76d8 100644 --- a/inc/loader/load_cache-refdepths.php +++ b/inc/loader/load_cache-refdepths.php @@ -41,6 +41,9 @@ if (!defined('__SECURITY')) { die(); } +// Use this code if you don't want to run this cache loader on installation phase +if (isInstallationPhase()) return; + // Next cached table is the referal system (refdepths)... if (($GLOBALS['cache_instance']->loadCacheFile('refdepths')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { // Load referal system from cache diff --git a/inc/loader/load_cache-refsystem.php b/inc/loader/load_cache-refsystem.php index 06dee6c577..c60475c1b3 100644 --- a/inc/loader/load_cache-refsystem.php +++ b/inc/loader/load_cache-refsystem.php @@ -41,6 +41,9 @@ if (!defined('__SECURITY')) { die(); } +// Use this code if you don't want to run this cache loader on installation phase +if (isInstallationPhase()) return; + // Next cached table is the referal system (refsystem)... if (($GLOBALS['cache_instance']->loadCacheFile('refsystem')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { // Load referal system from cache diff --git a/inc/loader/load_cache-them.php b/inc/loader/load_cache-them.php index da82aac80e..cbf87063a7 100644 --- a/inc/loader/load_cache-them.php +++ b/inc/loader/load_cache-them.php @@ -44,6 +44,9 @@ if (!defined('__SECURITY')) { return false; } +// Use this code if you don't want to run this cache loader on installation phase +if (isInstallationPhase()) return; + // Next cached table is the referal system (themes)... if (($GLOBALS['cache_instance']->loadCacheFile('themes')) && ($GLOBALS['cache_instance']->extensionVersionMatches('theme'))) { // Load referal system from cache diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index 741122f5a8..2a325ccc92 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -103,7 +103,7 @@ if ((!isInstalling()) && (!isInstallationPhase())) { // Remove MySQL array from namespace unset($GLOBALS['mysql']); - // Administrative functions + // Load cache loadIncludeOnce('inc/load_cache.php'); // Init filter system @@ -172,8 +172,8 @@ if ((!isInstalling()) && (!isInstallationPhase())) { loadIncludeOnce($inc); } // END - foreach - // Init filter system here - initFilterSystem(); + // Load config + loadIncludeOnce('inc/load_config.php'); // Are we installation routine? if ((!isInstalling()) && (getOutputMode() != '1') && (getOutputMode() != -1)) { @@ -181,14 +181,14 @@ if ((!isInstalling()) && (!isInstallationPhase())) { redirectToUrl('install.php'); } // END - if - // Administrative functions + // Init filter system here + initFilterSystem(); + + // Load cache loadIncludeOnce('inc/load_cache.php'); // Run the init filter chain runFilterChain('init'); - - // Load configuration file(s) here - loadIncludeOnce('inc/load_config.php'); } // Handle fatal errors -- 2.39.5