From b83fedb8c8f81ea7c003275030857800c9587206 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 24 Dec 2014 18:41:56 +0100 Subject: [PATCH] Continued: - Don't generate cache key if caching is disabled. This will save some time - Updated debug message (minor) - Updated TODOs.txt MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- docs/TODOs.txt | 20 +++++++++---------- .../main/class_BaseFrameworkSystem.php | 2 +- .../database/class_BaseDatabaseWrapper.php | 10 ++++++++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/docs/TODOs.txt b/docs/TODOs.txt index 790159c1..d57865a4 100644 --- a/docs/TODOs.txt +++ b/docs/TODOs.txt @@ -5,11 +5,11 @@ ./inc/classes/interfaces/class_FrameworkInterface.php:11: * @todo Find a better name for this interface ./inc/classes/interfaces/criteria/extended/class_LocalSearchCriteria.php:30: * @todo Find a nice casting here. (int) allows until and including 32766. ./inc/classes/interfaces/criteria/extended/class_LocalSearchCriteria.php:54: * @todo Find a nice casting here. (int) allows until and including 32766. -./inc/classes/main/class_BaseFrameworkSystem.php:1855: * @todo Write a logging mechanism for productive mode -./inc/classes/main/class_BaseFrameworkSystem.php:1870: // @TODO Finish this part! -./inc/classes/main/class_BaseFrameworkSystem.php:225: // @todo Try to clean these constants up -./inc/classes/main/class_BaseFrameworkSystem.php:450: // @TODO __CLASS__ does always return BaseFrameworkSystem but not the extending (=child) class -./inc/classes/main/class_BaseFrameworkSystem.php:524: * @todo SearchableResult and UpdateableResult shall have a super interface to use here +./inc/classes/main/class_BaseFrameworkSystem.php:1927: * @todo Write a logging mechanism for productive mode +./inc/classes/main/class_BaseFrameworkSystem.php:1942: // @TODO Finish this part! +./inc/classes/main/class_BaseFrameworkSystem.php:240: // @todo Try to clean these constants up +./inc/classes/main/class_BaseFrameworkSystem.php:465: // @TODO __CLASS__ does always return BaseFrameworkSystem but not the extending (=child) class +./inc/classes/main/class_BaseFrameworkSystem.php:539: * @todo SearchableResult and UpdateableResult shall have a super interface to use here ./inc/classes/main/commands/web/class_WebLoginAreaCommand.php:64: * @todo Add some stuff here: Some personal data, app/game related data ./inc/classes/main/commands/web/class_WebProblemCommand.php:58: * @todo 0% done ./inc/classes/main/commands/web/class_WebStatusCommand.php:58: * @todo 0% done @@ -31,7 +31,7 @@ ./inc/classes/main/criteria/search/class_SearchCriteria.php:102: * @todo Find a nice casting here. (int) allows until and including 32766. ./inc/classes/main/criteria/search/class_SearchCriteria.php:70: * @todo Find a nice casting here. (int) allows until and including 32766. ./inc/classes/main/database/databases/class_LocalFileDatabase.php:327: * @todo Do some checks on the database directory and files here -./inc/classes/main/database/databases/class_LocalFileDatabase.php:605: * @todo Add more generic non-public data for removal +./inc/classes/main/database/databases/class_LocalFileDatabase.php:613: * @todo Add more generic non-public data for removal ./inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php:427: * @todo Find something useful with this! ./inc/classes/main/discovery/payment/class_LocalPaymentDiscovery.php:85: * @todo 0% done ./inc/classes/main/file_directories/class_BaseFileIo.php:162: * @todo Handle seekStatus @@ -80,8 +80,8 @@ ./inc/classes/main/response/image/class_ImageResponse.php:89: * @todo Why are these parameters conflicting? ./inc/classes/main/response/image/class_ImageResponse.php:90: * @todo If the return statement is removed and setcookie() commented out, ./inc/classes/main/response/image/class_ImageResponse.php:91: * @todo this will send only one cookie out, the first one. -./inc/classes/main/result/class_DatabaseResult.php:239: * @todo 0% done -./inc/classes/main/result/class_DatabaseResult.php:393: * @todo Find a caching way without modifying the result array +./inc/classes/main/result/class_DatabaseResult.php:244: * @todo 0% done +./inc/classes/main/result/class_DatabaseResult.php:398: * @todo Find a caching way without modifying the result array ./inc/classes/main/rng/class_RandomNumberGenerator.php:175: * @todo I had a better random number generator here but now it is somewhere lost :( ./inc/classes/main/rng/class_RandomNumberGenerator.php:97: * @todo Add site key for stronger salt! ./inc/classes/main/stacker/file/class_BaseFileStack.php:147: * @todo Currently the stack file is not cached, please implement a memory-handling class and if enough RAM is found, cache the whole stack file. @@ -105,7 +105,7 @@ ./inc/classes/main/user/class_BaseUser.php:308: * @todo Try to make this method more generic so we can move it in BaseFrameworkSystem ./inc/classes/main/user/class_BaseUser.php:80: * @todo Find a way of casting here. "(int)" might destroy the user id > 32766 ./inc/classes/main/user/member/class_Member.php:84: * @todo Add more ways over creating user classes -./inc/classes/middleware/compressor/class_CompressorChannel.php:100: // @TODO Is there a configurable fall-back compressor needed, or is NullCompressor okay? +./inc/classes/middleware/compressor/class_CompressorChannel.php:103: // @TODO Is there a configurable fall-back compressor needed, or is NullCompressor okay? ./inc/classes/middleware/debug/class_DebugMiddleware.php:113: // @TODO Initialization phase ./inc/classes/middleware/io/class_FileIoHandler.php:174: * @todo 0% done ./inc/classes.php:10: * @todo Minimize these includes @@ -117,7 +117,7 @@ ./inc/includes.php:11: * @todo Minimize these includes ./inc/includes.php:37:// @TODO This makes the core depending on the SPL. But it should be installed anyway. ./inc/includes.php:41:// @TODO Find a nicer OOP-ed way for this -./inc/loader/class_ClassLoader.php:321: /* @todo: Do not die here. */ +./inc/loader/class_ClassLoader.php:319: /* @TODO: Do not exit here. */ ./inc/output.php:11: * @todo Minimize these includes ./inc/selector.php:11: * @todo Minimize these includes ### ### DEPRECATION FOLLOWS: ### ### diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index b6556472..a3774fc4 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -1890,7 +1890,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $fieldValue = $fieldArray[$fieldName]; } else { // Missing field entry, may require debugging - self::createDebugInstance(__CLASS__)->debugOutput($this->__toString() . ':fieldname=' . $fieldName . ' not found!'); + self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']:fieldName=' . $fieldName . ' not found!'); } // Return it diff --git a/inc/classes/main/database/class_BaseDatabaseWrapper.php b/inc/classes/main/database/class_BaseDatabaseWrapper.php index 866a6c23..cd785bb7 100644 --- a/inc/classes/main/database/class_BaseDatabaseWrapper.php +++ b/inc/classes/main/database/class_BaseDatabaseWrapper.php @@ -145,8 +145,14 @@ class BaseDatabaseWrapper extends BaseFrameworkSystem { * @return $resultInstance An instance of a database result class */ public function doSelectByCriteria (Criteria $criteriaInstance, array $onlyKeys = array()) { - // First get a key suitable for our cache and extend it with this class name - $cacheKey = $this->getCacheKeyByCriteria($criteriaInstance, $onlyKeys); + // Default cache key if cache is not enabled + $cacheKey = NULL; + + // Is the cache enabled? + if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) { + // First get a key suitable for our cache and extend it with this class name + $cacheKey = $this->getCacheKeyByCriteria($criteriaInstance, $onlyKeys); + } // END - if // Does this key exists in cache? if (($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) && ($this->cacheInstance->offsetExists($cacheKey, BaseDatabaseBackend::RESULT_INDEX_ROWS, 1))) { -- 2.39.5