From: Roland Häder Date: Sun, 31 Jul 2011 21:23:48 +0000 (+0000) Subject: Added cache loader for table 'points_data' X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4c054f452a66010b40966bd862a048b7a49b57f3;p=mailer.git Added cache loader for table 'points_data' --- diff --git a/.gitattributes b/.gitattributes index 6a16f1a654..1e4ed11c7b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -378,6 +378,7 @@ inc/loader/load-extensions.php svneol=native#text/plain inc/loader/load-filter.php svneol=native#text/plain inc/loader/load-imprint.php svneol=native#text/plain inc/loader/load-modules.php svneol=native#text/plain +inc/loader/load-points_data.php svneol=native#text/plain inc/loader/load-refdepths.php svneol=native#text/plain inc/loader/load-refsystem.php svneol=native#text/plain inc/loader/load-revision.php svneol=native#text/plain diff --git a/inc/classes/cachesystem.class.php b/inc/classes/cachesystem.class.php index 7d722b121e..71e752b361 100644 --- a/inc/classes/cachesystem.class.php +++ b/inc/classes/cachesystem.class.php @@ -207,6 +207,9 @@ class CacheSystem { } elseif ($this->name == 'imprint') { // Imprint $GLOBALS['cache_array']['imprint'][$k][$data['imprint_id']] = $v; + } elseif ($this->name == 'points_data') { + // Table 'points_data' + $GLOBALS['cache_array']['points_data'][$k][$data['id']] = $v; } elseif (is_array($v)) { // Serialize and BASE64-encode the array $v = base64_encode(serialize($v)); diff --git a/inc/loader/load- b/inc/loader/load- index da52c77498..c66bde252d 100644 --- a/inc/loader/load- +++ b/inc/loader/load- @@ -52,7 +52,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('foo')) && ($GLOBALS['cache_insta $GLOBALS['cache_instance']->init(); // Load every data from DB to cache file - $add = runFilterChain('sql_admin_extra_data'); + //$add = runFilterChain('sql_admin_extra_data'); // Query the database about this $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_foos` ORDER BY `some_bar` ASC', __FILE__, __LINE__); diff --git a/inc/loader/load-points_data.php b/inc/loader/load-points_data.php new file mode 100644 index 0000000000..ed77359ecd --- /dev/null +++ b/inc/loader/load-points_data.php @@ -0,0 +1,89 @@ +loadCacheFile('points_data')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { + // Load cache + $GLOBALS['cache_array']['points_data'] = $GLOBALS['cache_instance']->getArrayFromCache(); + + // Init temporary array + $pointsData = array(); + + // Rewrite all to subject + foreach ($GLOBALS['cache_array']['points_data']['subject'] as $key=>$subject) { + // Re-add key with subject + foreach ($GLOBALS['cache_array']['points_data'] as $key2=>$array) { + // Is key2 not 'subject'? + if ($key2 != 'subject') { + // Then Add it + $pointsData[$subject][$key2] = $GLOBALS['cache_array']['points_data'][$key2][$key]; + } // END - if + } // END - foreach + } // END - foreach + + // Set the array back and remove temporary + $GLOBALS['cache_array']['points_data'] = $pointsData; + unset($pointsData); +} elseif (isHtmlOutputMode()) { + // Create cache file + $GLOBALS['cache_instance']->init(); + + // Query the database about this + $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_points_data` ORDER BY `id` ASC', __FILE__, __LINE__); + while ($dummy = SQL_FETCHARRAY($result)) { + // Save row + $GLOBALS['cache_instance']->addRow($dummy); + } // END - while + + // Free memory + SQL_FREERESULT($result); + + // Close cache + $GLOBALS['cache_instance']->storeExtensionVersion('sql_patches'); + $GLOBALS['cache_instance']->finalize(); +} + +// [EOF] +?>