]> git.mxchange.org Git - mailer.git/blobdiff - inc/filters.php
Bad typo fixed and extension 'ext-coupon' started:
[mailer.git] / inc / filters.php
index 9a42401776dee630449587843b186aacdfdc7966..9a2ca2d52640e2126baed7e5036553f24a8a45c4 100644 (file)
@@ -164,10 +164,10 @@ function FILTER_REDIRECT_TO_LOGOUT_SQL_PATCHES () {
 // Filter for auto-activation of a extension
 function FILTER_AUTO_ACTIVATE_EXTENSION ($data) {
        // Debug message
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $data['ext_name'] . ',isExtensionAlwaysActive()=' . intval(isExtensionAlwaysActive()));
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $data['ext_name'] . ',isThisExtensionAlwaysActive()=' . intval(isThisExtensionAlwaysActive()));
 
        // Is this extension always activated?
-       if (isExtensionAlwaysActive()) {
+       if (isThisExtensionAlwaysActive()) {
                // Then activate the extension
                doActivateExtension($data['ext_name']);
        } // END - if
@@ -558,6 +558,26 @@ function FILTER_UPDATE_EXTENSION_DATA ($ext_name) {
        unset($GLOBALS['update_ver'][$ext_name]);
 }
 
+// Load more hourly reset scripts
+function FILTER_RUN_HOURLY_INCLUDES () {
+       // Is the reset set or old sql_patches?
+       if (((!isHourlyResetEnabled()) || (!isExtensionInstalledAndNewer('sql_patches', '0.7.5'))) && (isHtmlOutputMode())) {
+               // Then abort here
+               debug_report_bug(__FUNCTION__, __LINE__, 'Cannot run reset! enabled='.intval(isHourlyResetEnabled()).',ext_newer[sql_patches:0.7.5]='.intval(isExtensionInstalledAndNewer('sql_patches', '0.7.5')).' Please report this bug. Thanks');
+       } // END - if
+
+       // Get more hourly reset scripts
+       setIncludePool('hourly', getArrayFromDirectory('inc/hourly/', 'hourly_'));
+
+       // Update database
+       if ((!isConfigEntrySet('DEBUG_RESET')) || (!isDebugResetEnabled())) {
+               updateConfiguration('last_hour', getHour());
+       } // END - if
+
+       // Run the filter
+       runFilterChain('load_includes', 'hourly');
+}
+
 // Load more reset scripts
 function FILTER_RUN_RESET_INCLUDES () {
        // Is the reset set or old sql_patches?
@@ -570,7 +590,9 @@ function FILTER_RUN_RESET_INCLUDES () {
        setIncludePool('reset', getArrayFromDirectory('inc/daily/', 'daily_'));
 
        // Update database
-       if ((!isConfigEntrySet('DEBUG_RESET')) || (getConfig('DEBUG_RESET') != 'Y')) updateConfiguration('last_update', 'UNIX_TIMESTAMP()');
+       if ((!isConfigEntrySet('DEBUG_RESET')) || (!isDebugResetEnabled())) {
+               updateConfiguration('last_update', 'UNIX_TIMESTAMP()');
+       } // END - if
 
        // Is the config entry set?
        if (isExtensionInstalledAndNewer('sql_patches', '0.4.2')) {
@@ -595,7 +617,9 @@ function FILTER_RUN_RESET_INCLUDES () {
                        mergeIncludePool('reset', getArrayFromDirectory('inc/monthly/', 'monthly_'));
 
                        // Update config
-                       if (!isMonthlyResetDebugEnabled()) updateConfiguration('last_month', $currMonth);
+                       if (!isMonthlyResetDebugEnabled()) {
+                               updateConfiguration('last_month', $currMonth);
+                       } // END - if
                } // END - if
        } // END - if
 
@@ -736,15 +760,31 @@ function FILTER_CHECK_REPOSITORY_REVISION () {
 // Filter for running daily reset
 function FILTER_RUN_DAILY_RESET () {
        // Only execute this filter if installed
-       if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalled('sql_patches'))) return;
+       if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalled('sql_patches'))) {
+               return;
+       } // END - if
 
        // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
-       if (((getDay(getConfig('last_update')) != getDay()) || ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y'))) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (!isCssOutputMode())) {
+       if (((getDay(getConfig('last_update')) != getDay()) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (!isCssOutputMode())) {
                // Tell every module we are in reset-mode!
                doReset();
        } // END - if
 }
 
+// Filter for running hourly reset
+function FILTER_RUN_HOURLY_RESET () {
+       // Only execute this filter if installed
+       if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalledAndNewer('sql_patches', '0.7.5'))) {
+               return;
+       } // END - if
+
+       // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
+       if (((getConfig('last_hour') != getHour()) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (!isCssOutputMode())) {
+               // Tell every module we are in reset-mode!
+               doHourly();
+       } // END - if
+}
+
 // Filter for loading more runtime includes (not for installation)
 function FILTER_LOAD_RUNTIME_INCLUDES () {
        // Load more includes