[TASK] Relocate cache backend sql resource files 95/18895/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Wed, 13 Feb 2013 23:50:12 +0000 (00:50 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 14 Mar 2013 10:29:43 +0000 (11:29 +0100)
Some cache backends have specific sql resource files located at
t3lib/cache/backend/resources.
After namespace switch, the class files are located at ext:core.
According to the extbase scheme, the resource files are now moved
to ext:core/Resources/Private/Sql/Cache/Backend and renamed.

Change-Id: Ib693e0dfed8636b9898ef9bbff73dab21df5c2b0
Resolves: #46263
Releases: 6.1
Reviewed-on: https://review.typo3.org/18895
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
t3lib/cache/backend/resources/dbbackend-layout-cache.sql [deleted file]
t3lib/cache/backend/resources/dbbackend-layout-tags.sql [deleted file]
t3lib/cache/backend/resources/ddl.sql [deleted file]
typo3/sysext/core/Classes/Cache/Backend/PdoBackend.php
typo3/sysext/core/Classes/Cache/Backend/Typo3DatabaseBackend.php
typo3/sysext/core/Resources/Private/.htaccess [new file with mode: 0644]
typo3/sysext/core/Resources/Private/Sql/Cache/Backend/PdoBackendCacheAndTags.sql [new file with mode: 0644]
typo3/sysext/core/Resources/Private/Sql/Cache/Backend/Typo3DatabaseBackendCache.sql [new file with mode: 0644]
typo3/sysext/core/Resources/Private/Sql/Cache/Backend/Typo3DatabaseBackendTags.sql [new file with mode: 0644]

diff --git a/t3lib/cache/backend/resources/dbbackend-layout-cache.sql b/t3lib/cache/backend/resources/dbbackend-layout-cache.sql
deleted file mode 100644 (file)
index 1730855..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-CREATE TABLE ###CACHE_TABLE### (
-       id int(11) unsigned NOT NULL auto_increment,
-       identifier varchar(250) DEFAULT '' NOT NULL,
-       expires int(11) unsigned DEFAULT '0' NOT NULL,
-       content mediumblob,
-       PRIMARY KEY (id),
-       KEY cache_id (identifier,expires)
-) ENGINE=InnoDB;
\ No newline at end of file
diff --git a/t3lib/cache/backend/resources/dbbackend-layout-tags.sql b/t3lib/cache/backend/resources/dbbackend-layout-tags.sql
deleted file mode 100644 (file)
index d9b3672..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-CREATE TABLE ###TAGS_TABLE### (
-       id int(11) unsigned NOT NULL auto_increment,
-       identifier varchar(250) DEFAULT '' NOT NULL,
-       tag varchar(250) DEFAULT '' NOT NULL,
-       PRIMARY KEY (id),
-       KEY cache_id (identifier),
-       KEY cache_tag (tag)
-) ENGINE=InnoDB;
\ No newline at end of file
diff --git a/t3lib/cache/backend/resources/ddl.sql b/t3lib/cache/backend/resources/ddl.sql
deleted file mode 100644 (file)
index 72e26be..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-BEGIN;
-
-CREATE TABLE "cache" (
-  "identifier" VARCHAR(250) NOT NULL,
-  "cache" VARCHAR(250) NOT NULL,
-  "context" VARCHAR(150) NOT NULL,
-  "created" INTEGER UNSIGNED NOT NULL,
-  "lifetime" INTEGER UNSIGNED DEFAULT '0' NOT NULL,
-  "content" TEXT,
-  PRIMARY KEY ("identifier", "cache", "context")
-);
-
-CREATE TABLE "tags" (
-  "identifier" VARCHAR(250) NOT NULL,
-  "cache" VARCHAR(250) NOT NULL,
-  "context" VARCHAR(150) NOT NULL,
-  "tag" VARCHAR(250) NOT NULL
-);
-CREATE INDEX "identifier" ON "tags" ("identifier", "cache", "context");
-CREATE INDEX "tag" ON "tags" ("tag");
-
-COMMIT;
\ No newline at end of file
index fcf7132..752ab04 100644 (file)
@@ -274,7 +274,12 @@ class PdoBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend implement
         */
        protected function createCacheTables() {
                try {
         */
        protected function createCacheTables() {
                try {
-                       \TYPO3\CMS\Core\Database\PdoHelper::importSql($this->databaseHandle, $this->pdoDriver, PATH_t3lib . 'cache/backend/resources/ddl.sql');
+                       \TYPO3\CMS\Core\Database\PdoHelper::importSql(
+                               $this->databaseHandle,
+                               $this->pdoDriver,
+                               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('core') .
+                               'Resources/Private/Sql/Cache/Backend/PdoBackendCacheAndTags.sql'
+                       );
                } catch (\PDOException $e) {
                        throw new \RuntimeException('Could not create cache tables with DSN "' . $this->dataSourceName . '". PDO error: ' . $e->getMessage(), 1259576985);
                }
                } catch (\PDOException $e) {
                        throw new \RuntimeException('Could not create cache tables with DSN "' . $this->dataSourceName . '". PDO error: ' . $e->getMessage(), 1259576985);
                }
index a66df7b..8f3787b 100644 (file)
@@ -344,9 +344,15 @@ class Typo3DatabaseBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend
         * @return string SQL of table definitions
         */
        public function getTableDefinitions() {
         * @return string SQL of table definitions
         */
        public function getTableDefinitions() {
-               $cacheTableSql = file_get_contents(PATH_t3lib . 'cache/backend/resources/dbbackend-layout-cache.sql');
+               $cacheTableSql = file_get_contents(
+                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('core') .
+                       'Resources/Private/Sql/Cache/Backend/Typo3DatabaseBackendCache.sql'
+               );
                $requiredTableStructures = str_replace('###CACHE_TABLE###', $this->cacheTable, $cacheTableSql) . LF . LF;
                $requiredTableStructures = str_replace('###CACHE_TABLE###', $this->cacheTable, $cacheTableSql) . LF . LF;
-               $tagsTableSql = file_get_contents(PATH_t3lib . 'cache/backend/resources/dbbackend-layout-tags.sql');
+               $tagsTableSql = file_get_contents(
+                       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('core') .
+                       'Resources/Private/Sql/Cache/Backend/Typo3DatabaseBackendTags.sql'
+               );
                $requiredTableStructures .= str_replace('###TAGS_TABLE###', $this->tagsTable, $tagsTableSql) . LF;
                return $requiredTableStructures;
        }
                $requiredTableStructures .= str_replace('###TAGS_TABLE###', $this->tagsTable, $tagsTableSql) . LF;
                return $requiredTableStructures;
        }
diff --git a/typo3/sysext/core/Resources/Private/.htaccess b/typo3/sysext/core/Resources/Private/.htaccess
new file mode 100644 (file)
index 0000000..3418e55
--- /dev/null
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/Private/Sql/Cache/Backend/PdoBackendCacheAndTags.sql b/typo3/sysext/core/Resources/Private/Sql/Cache/Backend/PdoBackendCacheAndTags.sql
new file mode 100644 (file)
index 0000000..72e26be
--- /dev/null
@@ -0,0 +1,22 @@
+BEGIN;
+
+CREATE TABLE "cache" (
+  "identifier" VARCHAR(250) NOT NULL,
+  "cache" VARCHAR(250) NOT NULL,
+  "context" VARCHAR(150) NOT NULL,
+  "created" INTEGER UNSIGNED NOT NULL,
+  "lifetime" INTEGER UNSIGNED DEFAULT '0' NOT NULL,
+  "content" TEXT,
+  PRIMARY KEY ("identifier", "cache", "context")
+);
+
+CREATE TABLE "tags" (
+  "identifier" VARCHAR(250) NOT NULL,
+  "cache" VARCHAR(250) NOT NULL,
+  "context" VARCHAR(150) NOT NULL,
+  "tag" VARCHAR(250) NOT NULL
+);
+CREATE INDEX "identifier" ON "tags" ("identifier", "cache", "context");
+CREATE INDEX "tag" ON "tags" ("tag");
+
+COMMIT;
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/Private/Sql/Cache/Backend/Typo3DatabaseBackendCache.sql b/typo3/sysext/core/Resources/Private/Sql/Cache/Backend/Typo3DatabaseBackendCache.sql
new file mode 100644 (file)
index 0000000..1730855
--- /dev/null
@@ -0,0 +1,8 @@
+CREATE TABLE ###CACHE_TABLE### (
+       id int(11) unsigned NOT NULL auto_increment,
+       identifier varchar(250) DEFAULT '' NOT NULL,
+       expires int(11) unsigned DEFAULT '0' NOT NULL,
+       content mediumblob,
+       PRIMARY KEY (id),
+       KEY cache_id (identifier,expires)
+) ENGINE=InnoDB;
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/Private/Sql/Cache/Backend/Typo3DatabaseBackendTags.sql b/typo3/sysext/core/Resources/Private/Sql/Cache/Backend/Typo3DatabaseBackendTags.sql
new file mode 100644 (file)
index 0000000..d9b3672
--- /dev/null
@@ -0,0 +1,8 @@
+CREATE TABLE ###TAGS_TABLE### (
+       id int(11) unsigned NOT NULL auto_increment,
+       identifier varchar(250) DEFAULT '' NOT NULL,
+       tag varchar(250) DEFAULT '' NOT NULL,
+       PRIMARY KEY (id),
+       KEY cache_id (identifier),
+       KEY cache_tag (tag)
+) ENGINE=InnoDB;
\ No newline at end of file