[TASK] Make the extension usable in 4.6 again. Also pushed some changes regarding...
authortmaroschik <tmaroschik@735d13b6-9817-0410-8766-e36946ffe9aa>
Wed, 6 Jul 2011 17:18:11 +0000 (17:18 +0000)
committertmaroschik <tmaroschik@735d13b6-9817-0410-8766-e36946ffe9aa>
Wed, 6 Jul 2011 17:18:11 +0000 (17:18 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/identity/trunk@49538 735d13b6-9817-0410-8766-e36946ffe9aa

Classes/Compat/interface.t3lib_db_postprocessqueryhook.php
Classes/Hooks/class.tx_identity_t3lib_db_postprocess.php [deleted file]
Classes/Hooks/class.tx_identity_t3lib_db_preprocess.php [new file with mode: 0644]
Classes/Hooks/class.tx_identity_tcemain_hook.php
Classes/Provider/AbstractUuid.php
ext_localconf.php

index d66c79a..69e14fc 100644 (file)
@@ -45,7 +45,7 @@ interface t3lib_DB_postProcessQueryHook {
         * @param t3lib_DB $parentObject
         * @return void
         */
-       public function exec_INSERTquery_postProcessAction($table, array $fieldsValues, $noQuoteFields, t3lib_DB $parentObject);
+       public function exec_INSERTquery_postProcessAction(&$table, array &$fieldsValues, &$noQuoteFields, t3lib_DB $parentObject);
 
        /**
         * Post-processor for the exec_INSERTmultipleRows method.
@@ -57,7 +57,7 @@ interface t3lib_DB_postProcessQueryHook {
         * @param t3lib_DB $parentObject
         * @return void
         */
-       public function exec_INSERTmultipleRows_postProcessAction($table, array $fields, array $rows, $noQuoteFields, t3lib_DB $parentObject);
+       public function exec_INSERTmultipleRows_postProcessAction(&$table, array &$fields, array &$rows, &$noQuoteFields, t3lib_DB $parentObject);
 
        /**
         * Post-processor for the exec_UPDATEquery method.
@@ -69,7 +69,7 @@ interface t3lib_DB_postProcessQueryHook {
         * @param t3lib_DB $parentObject
         * @return void
         */
-       public function exec_UPDATEquery_postProcessAction($table, $where, array $fieldsValues, $noQuoteFields, t3lib_DB $parentObject);
+       public function exec_UPDATEquery_postProcessAction(&$table, &$where, array &$fieldsValues, &$noQuoteFields, t3lib_DB $parentObject);
 
        /**
         * Post-processor for the exec_DELETEquery method.
@@ -79,7 +79,7 @@ interface t3lib_DB_postProcessQueryHook {
         * @param t3lib_DB $parentObject
         * @return void
         */
-       public function exec_DELETEquery_postProcessAction($table, $where, t3lib_DB $parentObject);
+       public function exec_DELETEquery_postProcessAction(&$table, &$where, t3lib_DB $parentObject);
 
        /**
         * Post-processor for the exec_TRUNCATEquery method.
@@ -88,7 +88,7 @@ interface t3lib_DB_postProcessQueryHook {
         * @param t3lib_DB $parentObject
         * @return void
         */
-       public function exec_TRUNCATEquery_postProcessAction($table, t3lib_DB $parentObject);
+       public function exec_TRUNCATEquery_postProcessAction(&$table, t3lib_DB $parentObject);
 
 }
 
diff --git a/Classes/Hooks/class.tx_identity_t3lib_db_postprocess.php b/Classes/Hooks/class.tx_identity_t3lib_db_postprocess.php
deleted file mode 100644 (file)
index 6fcf976..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-class tx_identity_t3lib_db_postprocess implements t3lib_DB_preProcessQueryHook {
-
-       /**
-        * @var Tx_Identity_Map
-        */
-       protected $identityMap;
-
-       /**
-        * Constructor method for the t3lib_DB posprocess hook
-        */
-       public function __construct() {
-               $this->identityMap = t3lib_div::makeInstance('Tx_Identity_Map');
-       }
-
-       /**
-        * Pre-processor for the INSERTquery method.
-        *
-        * @param string $table Database table name
-        * @param array $fieldsValues Field values as key => value pairs
-        * @param string/array $noQuoteFields List/array of keys NOT to quote
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function INSERTquery_preProcessAction(&$table, array &$fieldsValues, &$noQuoteFields, t3lib_DB $parentObject) {
-               $identityField = $this->identityMap->getIdentifierFieldForResourceLocation($table);
-               if ($identityField) {
-                       $fieldsValues[$identityField] = $this->identityMap->getIdentifierForNewResourceLocation($table);
-               }
-       }
-
-       /**
-        * Pre-processor for the INSERTmultipleRows method.
-        *
-        * @param string $table Database table name
-        * @param array $fields Field names
-        * @param array $rows Table rows
-        * @param string/array $noQuoteFields List/array of keys NOT to quote
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function INSERTmultipleRows_preProcessAction(&$table, array &$fields, array &$rows, &$noQuoteFields, t3lib_DB $parentObject) {
-               $identityField = $this->identityMap->getIdentifierFieldForResourceLocation($table);
-               if ($identityField) {
-                       foreach ($rows as &$row) {
-                               $row[$identityField] = $this->identityMap->getIdentifierForNewResourceLocation($table);
-                       }
-               }
-       }
-
-       /**
-        * Pre-processor for the UPDATEquery method.
-        *
-        * @param string $table Database table name
-        * @param string $where WHERE clause
-        * @param array $fieldsValues Field values as key => value pairs
-        * @param string/array $noQuoteFields List/array of keys NOT to quote
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function UPDATEquery_preProcessAction(&$table, &$where, array &$fieldsValues, &$noQuoteFields, t3lib_DB $parentObject) {
-               // Do nothing
-       }
-
-       /**
-        * Pre-processor for the DELETEquery method.
-        *
-        * @param string $table Database table name
-        * @param string $where WHERE clause
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function DELETEquery_preProcessAction(&$table, &$where, t3lib_DB $parentObject) {
-               // Do nothing
-       }
-
-       /**
-        * Pre-processor for the TRUNCATEquery method.
-        *
-        * @param string $table Database table name
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function TRUNCATEquery_preProcessAction(&$table, t3lib_DB $parentObject) {
-               // Do nothing
-       }
-}
-?>
\ No newline at end of file
diff --git a/Classes/Hooks/class.tx_identity_t3lib_db_preprocess.php b/Classes/Hooks/class.tx_identity_t3lib_db_preprocess.php
new file mode 100644 (file)
index 0000000..bfedafe
--- /dev/null
@@ -0,0 +1,94 @@
+<?php
+
+class tx_identity_t3lib_db_preprocess implements t3lib_DB_preProcessQueryHook {
+
+       /**
+        * @var Tx_Identity_Map
+        */
+       protected $identityMap;
+
+       /**
+        * Constructor method for the t3lib_DB posprocess hook
+        */
+       public function __construct() {
+               $this->identityMap = t3lib_div::makeInstance('Tx_Identity_Map');
+       }
+
+       /**
+        * Pre-processor for the INSERTquery method.
+        *
+        * @param string $table Database table name
+        * @param array $fieldsValues Field values as key => value pairs
+        * @param string/array $noQuoteFields List/array of keys NOT to quote
+        * @param t3lib_DB $parentObject
+        * @return void
+        */
+       public function INSERTquery_preProcessAction(&$table, array &$fieldsValues, &$noQuoteFields, t3lib_DB $parentObject) {
+               // Check if applicable
+               $identifier = $this->identityMap->getIdentifierForNewResourceLocation($table);
+               if ($identifier !== NULL) {
+                       $identityField = $this->identityMap->getIdentifierFieldForResourceLocation($table);
+                       $fieldsValues[$identityField] = $identifier;
+               }
+       }
+
+       /**
+        * Pre-processor for the INSERTmultipleRows method.
+        *
+        * @param string $table Database table name
+        * @param array $fields Field names
+        * @param array $rows Table rows
+        * @param string/array $noQuoteFields List/array of keys NOT to quote
+        * @param t3lib_DB $parentObject
+        * @return void
+        */
+       public function INSERTmultipleRows_preProcessAction(&$table, array &$fields, array &$rows, &$noQuoteFields, t3lib_DB $parentObject) {
+               // Check if applicable
+               $identifier = $this->identityMap->getIdentifierForNewResourceLocation($table);
+               if ($identifier !== NULL) {
+                       $identityField = $this->identityMap->getIdentifierFieldForResourceLocation($table);
+                       foreach ($rows as &$row) {
+                               $fieldsValues[$identityField] = $identifier;
+                               $identifier = $this->identityMap->getIdentifierForNewResourceLocation($table);
+                       }
+               }
+       }
+
+       /**
+        * Pre-processor for the UPDATEquery method.
+        *
+        * @param string $table Database table name
+        * @param string $where WHERE clause
+        * @param array $fieldsValues Field values as key => value pairs
+        * @param string/array $noQuoteFields List/array of keys NOT to quote
+        * @param t3lib_DB $parentObject
+        * @return void
+        */
+       public function UPDATEquery_preProcessAction(&$table, &$where, array &$fieldsValues, &$noQuoteFields, t3lib_DB $parentObject) {
+               // Do nothing
+       }
+
+       /**
+        * Pre-processor for the DELETEquery method.
+        *
+        * @param string $table Database table name
+        * @param string $where WHERE clause
+        * @param t3lib_DB $parentObject
+        * @return void
+        */
+       public function DELETEquery_preProcessAction(&$table, &$where, t3lib_DB $parentObject) {
+               // Do nothing
+       }
+
+       /**
+        * Pre-processor for the TRUNCATEquery method.
+        *
+        * @param string $table Database table name
+        * @param t3lib_DB $parentObject
+        * @return void
+        */
+       public function TRUNCATEquery_preProcessAction(&$table, t3lib_DB $parentObject) {
+               // Do nothing
+       }
+}
+?>
\ No newline at end of file
index ed4e219..90c0ff0 100644 (file)
@@ -3,7 +3,7 @@
 class tx_identity_tcemain_hook {
        public function processDatamap_afterAllOperations($parent) {
                $identityMap = t3lib_div::makeInstance('Tx_Identity_Map');
-//             $identityMap->rebuild();
+               // $identityMap->rebuild();
                $identityMap->commit();
        }
 }
index 8d51ce6..ca9ac1b 100644 (file)
@@ -228,8 +228,8 @@ class Tx_Identity_Provider_AbstractUuid implements Tx_Identity_ProviderInterface
                                $identityField => $uuid,
                                'foreign_tablename' => $tablename,
                        );
+                       return $uuid;
                }
-               return $uuid;
        }
 
        /**
index 831d713..bab4ca5 100644 (file)
@@ -35,7 +35,7 @@ if (!interface_exists('t3lib_DB_preProcessQueryHook')) {
        $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_db.php'] = t3lib_extMgm::extPath($_EXTKEY) . 'Classes/Xclass/class.ux_t3lib_db.php';
 }
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][$_EXTKEY] = 'EXT:' . $_EXTKEY . '/Classes/Hooks/class.tx_identity_tcemain_hook.php:tx_identity_tcemain_hook';
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_db.php']['queryProcessors'][$_EXTKEY] = 'EXT:' . $_EXTKEY . '/Classes/Hooks/class.tx_identity_t3lib_db_postprocess.php:tx_identity_t3lib_db_postprocess';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_db.php']['queryProcessors'][$_EXTKEY] = 'EXT:' . $_EXTKEY . '/Classes/Hooks/class.tx_identity_t3lib_db_preprocess.php:tx_identity_t3lib_db_preprocess';
 
 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY] = array(
        Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST     => array(