[BUGFIX] Adapt cache configuration to 4.6
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 19 Jun 2011 10:55:10 +0000 (12:55 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 19 Jun 2011 11:14:49 +0000 (13:14 +0200)
Change-Id: I85e68730e07b994ec4a21bcccded7295d036e566
Resolves: #27543
Depends: #27506

typo3/sysext/workspaces/Classes/Service/GridData.php
typo3/sysext/workspaces/Classes/Service/Tcemain.php
typo3/sysext/workspaces/ext_localconf.php
typo3/sysext/workspaces/ext_tables.sql

index 536d88d..c3effca 100644 (file)
@@ -189,16 +189,6 @@ class tx_Workspaces_Service_GridData {
         */
        protected function initializeWorkspacesCachingFramework() {
                if (TYPO3_UseCachingFramework === TRUE) {
-                       try {
-                               $GLOBALS['typo3CacheFactory']->create(
-                                       'workspaces_cache',
-                                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['sys_workspace_cache']['frontend'],
-                                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['sys_workspace_cache']['backend'],
-                                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['sys_workspace_cache']['options']);
-                       } catch (t3lib_cache_exception_DuplicateIdentifier $e) {
-                               // do nothing, a workspace cache already exists
-                       }
-
                        $this->workspacesCache = $GLOBALS['typo3CacheManager']->getCache('workspaces_cache');
                }
        }
@@ -213,9 +203,7 @@ class tx_Workspaces_Service_GridData {
        protected function setDataArrayIntoCache (array $versions, $filterTxt) {
                if (TYPO3_UseCachingFramework === TRUE) {
                        $hash = $this->calculateHash($versions, $filterTxt);
-                       $content = serialize($this->dataArray);
-
-                       $this->workspacesCache->set($hash, $content, array($this->currentWorkspace));
+                       $this->workspacesCache->set($hash, $this->dataArray, array($this->currentWorkspace));
                }
        }
 
@@ -225,6 +213,7 @@ class tx_Workspaces_Service_GridData {
         *
         * @param array $versions All records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid, t3ver_oid and t3ver_swapmode fields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid"
         * @param string $filterTxt The given filter text from the grid.
+        * @return boolean TRUE if cache entry was successfully fetched from cache and content put to $this->dataArray
         */
        protected function getDataArrayFromCache (array $versions, $filterTxt) {
                $cacheEntry = FALSE;
@@ -234,8 +223,8 @@ class tx_Workspaces_Service_GridData {
 
                        $content = $this->workspacesCache->get($hash);
 
-                       if ($content != FALSE) {
-                               $this->dataArray = unserialize($content);
+                       if ($content !== FALSE) {
+                               $this->dataArray = $content;
                                $cacheEntry = TRUE;
                        }
                }
index 553cb08..6804081 100644 (file)
@@ -150,18 +150,7 @@ class tx_Workspaces_Service_Tcemain {
         */
        protected function flushWorkspaceCacheEntriesByWorkspaceId($workspaceId) {
                if (TYPO3_UseCachingFramework === TRUE) {
-                       try {
-                               $GLOBALS['typo3CacheFactory']->create(
-                                       'workspaces_cache',
-                                       't3lib_cache_frontend_StringFrontend',
-                                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['sys_workspace_cache']['backend'],
-                                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['sys_workspace_cache']['options']);
-                       } catch (t3lib_cache_exception_DuplicateIdentifier $e) {
-                               // do nothing, a workspace cache already exists
-                       }
-       
                        $workspacesCache = $GLOBALS['typo3CacheManager']->getCache('workspaces_cache');
-       
                        $workspacesCache->flushByTag($workspaceId);
                        $workspacesCache->flushByTag(tx_Workspaces_Service_Workspaces::SELECT_ALL_WORKSPACES);
                }
index 70359cf..93599d6 100644 (file)
@@ -21,15 +21,9 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['viewO
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_eofe']['workspaces'] = 'EXT:workspaces/Classes/Service/Fehooks.php:tx_Workspaces_Service_Fehooks->hook_eofe';
 
 if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['useCachingFramework']) {
-               // Initialize the caching framework. The caching framework is asking it self if it is initialized already before initializing.
-       t3lib_cache::initializeCachingFramework();
-
-       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['sys_workspace_cache']['frontend'] = 't3lib_cache_frontend_VariableFrontend';
-       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['sys_workspace_cache']['backend'] = 't3lib_cache_backend_DbBackend';
-       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['sys_workspace_cache']['options'] = array(
-               'cacheTable' => 'sys_workspace_cache',
-               'tagsTable' => 'sys_workspace_cache_tags'
-       );
+       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['workspaces_cache']['frontend'] = 't3lib_cache_frontend_VariableFrontend';
+       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['workspaces_cache']['backend'] = 't3lib_cache_backend_DbBackend';
+       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['workspaces_cache']['options'] = array();
 }
 
 t3lib_extMgm::addUserTSConfig('options.workspaces.considerReferences = 1');
index 3a0f570..32d2ede 100644 (file)
@@ -46,31 +46,4 @@ CREATE TABLE sys_workspace_stage (
 
        PRIMARY KEY (uid),
        KEY parent (pid)
-);
-
-
-#
-# Table structure for table 'sys_workspace_cache'
-#
-CREATE TABLE sys_workspace_cache (
-    id int(11) unsigned NOT NULL auto_increment,
-    identifier varchar(32) DEFAULT '' NOT NULL,
-    content mediumblob NOT NULL,
-    crdate int(11) DEFAULT '0' NOT NULL,
-    lifetime int(11) DEFAULT '0' NOT NULL,    
-      PRIMARY KEY (id),
-      KEY cache_id (identifier)
-) ENGINE=InnoDB;
-
-
-#
-# Table structure for table 'sys_workspace_cache_tags'
-#
-CREATE TABLE sys_workspace_cache_tags (
-  id int(11) unsigned NOT NULL auto_increment,
-  identifier varchar(128) DEFAULT '' NOT NULL,
-  tag varchar(128) DEFAULT '' NOT NULL,
-  PRIMARY KEY (id),
-  KEY cache_id (identifier),
-  KEY cache_tag (tag)
-) ENGINE=InnoDB;
+);
\ No newline at end of file