[TASK] Rework the extension for 6.2 only support
authortmaroschik <tmaroschik@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 11 Feb 2014 14:36:43 +0000 (14:36 +0000)
committertmaroschik <tmaroschik@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 11 Feb 2014 14:36:43 +0000 (14:36 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/identity/trunk@83715 735d13b6-9817-0410-8766-e36946ffe9aa

30 files changed:
Classes/Configuration/Check.php [deleted file]
Classes/Configuration/ConfigurationCheck.php [new file with mode: 0644]
Classes/Configuration/IdentityProviderConfigurationInterface.php [new file with mode: 0644]
Classes/Configuration/IdentityProviderInterface.php [deleted file]
Classes/Hooks/DataHandlerHook.php [new file with mode: 0644]
Classes/Hooks/DatabasePreProcessQueryHook.php [new file with mode: 0644]
Classes/Hooks/class.tx_identity_em_hook.php [deleted file]
Classes/Hooks/class.tx_identity_t3lib_db_preprocess.php [deleted file]
Classes/Hooks/class.tx_identity_tcemain_hook.php [deleted file]
Classes/IdentityMap.php [new file with mode: 0644]
Classes/Install/Installer.php [deleted file]
Classes/Map.php [deleted file]
Classes/Provider/AbstractUuid.php [deleted file]
Classes/Provider/AbstractUuidProvider.php [new file with mode: 0644]
Classes/Provider/ProviderInterface.php [new file with mode: 0644]
Classes/Provider/RecordUuid.php [deleted file]
Classes/Provider/RecordUuidProvider.php [new file with mode: 0644]
Classes/Provider/StaticRecordUuid.php [deleted file]
Classes/Provider/StaticRecordUuidProvider.php [new file with mode: 0644]
Classes/ProviderInterface.php [deleted file]
Classes/Tasks/RebuildTask.php
Classes/Utility/Algorithms.php
Classes/Utility/ExtensionManager.php [deleted file]
Classes/Utility/FieldDefinitions.php
class.ext_update.php [deleted file]
ext_autoload.php [deleted file]
ext_conf_template.txt [deleted file]
ext_emconf.php
ext_localconf.php
ext_tables.php

diff --git a/Classes/Configuration/Check.php b/Classes/Configuration/Check.php
deleted file mode 100644 (file)
index 9fe8859..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * A class that checks the configuration of the identity extension.
- *
- * @author Thomas Maroschik <tmaroschik@dfau.de>
- *
- * @package TYPO3
- * @subpackage identity
- */
-class Tx_Identity_Configuration_Check implements t3lib_Singleton {
-
-       /**
-        * Checks the configuration for an individual table
-        *
-        * @param string $table
-        * @param string $identityProvider
-        * @throws InvalidArgumentException when there is an error in the table specific configuration
-        */
-       public function checkTableSpecificIdentityProviderConfiguration($table, $identityProvider) {
-               $this->checkIdentityProviderConfiguration($identityProvider);
-               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][$identityProvider])) {
-                       throw new InvalidArgumentException(
-                               'The identity provider "' . $identityProvider .
-                               '" defined in $GLOBALS[\'TCA\'][\'' . $table . '\'][\'ctrl\'][\'EXT\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::KEY]' .
-                               ' is not in the list of available providers ' .
-                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST]',
-                               1300103324
-                       );
-               }
-               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][$identityProvider][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD_CREATE_CLAUSE])) {
-                       throw new InvalidArgumentException(
-                               'The identity provider "' . $identityProvider .
-                               '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][\'' . $identityProvider . '\']' .
-                               ' has no identity field create clause defined at ' .
-                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][\'' . $identityProvider . '\'][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD_CREATE_CLAUSE]'
-                               ,
-                               1300103750
-                       );
-               }
-       }
-
-       /**
-        * Checks the configuration of the default identity provider
-        * @param string $defaultProvider
-        * @throws InvalidArgumentException when there is an errer in the default configuration
-        */
-       public function checkDefaultIdentityProviderConfiguration($defaultProvider) {
-               $this->checkIdentityProviderConfiguration($defaultProvider);
-               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][$defaultProvider])) {
-                       throw new InvalidArgumentException(
-                               'The default identity provider "' . $defaultProvider .
-                               '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::DEFAULT_PROVIDER]' .
-                               ' is not in the list of available providers ' .
-                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST]',
-                               1300104323
-                       );
-               }
-       }
-
-       /**
-        * Checks the configuration of an individual provider
-        *
-        * @param string $identityProvider
-        * @throws InvalidArgumentException when there is an error in the provider configuration
-        */
-       public function checkIdentityProviderConfiguration($identityProvider) {
-               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][$identityProvider])) {
-                       throw new InvalidArgumentException(
-                               'The identity provider "' . $identityProvider .
-                               '" is not defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][\'' . $table . '\']',
-                               1300109077
-                       );
-               }
-               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][$identityProvider][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD])) {
-                       throw new InvalidArgumentException(
-                               'The identity provider "' . $identityProvider .
-                               '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][\'' . $table . '\']' .
-                               ' has no identity field defined at ' .
-                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][\'' . $identityProvider . '\'][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD]'
-                               ,
-                               1300110713
-                       );
-               }
-               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][$identityProvider][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD_CREATE_CLAUSE])) {
-                       throw new InvalidArgumentException(
-                               'The identity provider "' . $identityProvider .
-                               '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][\'' . $table . '\']' .
-                               ' has no identity field create clause defined at ' .
-                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][\'' . $identityProvider . '\'][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD_CREATE_CLAUSE]'
-                               ,
-                               1300103750
-                       );
-               }
-               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][$identityProvider][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDER_CLASS])) {
-                       throw new InvalidArgumentException(
-                               'The identity provider "' . $identityProvider .
-                               '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][\'' . $table . '\']' .
-                               ' has no provider class defined at ' .
-                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][\'' . $identityProvider . '\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDER_CLASS]'
-                               ,
-                               1300109191
-                       );
-               }
-       }
-
-}
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['EXT:identity/Class/Configuration/Check.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['EXT:identity/Class/Configuration/Check.php']);
-}
\ No newline at end of file
diff --git a/Classes/Configuration/ConfigurationCheck.php b/Classes/Configuration/ConfigurationCheck.php
new file mode 100644 (file)
index 0000000..4009399
--- /dev/null
@@ -0,0 +1,134 @@
+<?php
+namespace Maroschik\Identity\Configuration;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+use Maroschik\Identity\Configuration\IdentityProviderConfigurationInterface as ProviderConfiguration;
+
+/**
+ * A class that checks the configuration of the identity extension.
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ */
+class ConfigurationCheck implements \TYPO3\CMS\Core\SingletonInterface {
+
+       /**
+        * Checks the configuration for an individual table
+        *
+        * @param string $table
+        * @param string $identityProvider
+        * @throws \InvalidArgumentException when there is an error in the table specific configuration
+        */
+       public function checkTableSpecificIdentityProviderConfiguration($table, $identityProvider) {
+               $this->checkIdentityProviderConfiguration($identityProvider);
+               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][ProviderConfiguration::PROVIDERS_LIST][$identityProvider])) {
+                       throw new \InvalidArgumentException(
+                               'The identity provider "' . $identityProvider .
+                               '" defined in $GLOBALS[\'TCA\'][\'' . $table . '\'][\'ctrl\'][\'EXT\'][\'identity\'][ProviderConfiguration::KEY]' .
+                               ' is not in the list of available providers ' .
+                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::PROVIDERS_LIST]',
+                               1300103324
+                       );
+               }
+               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][ProviderConfiguration::PROVIDERS_LIST][$identityProvider][ProviderConfiguration::IDENTITY_FIELD_CREATE_CLAUSE])) {
+                       throw new \InvalidArgumentException(
+                               'The identity provider "' . $identityProvider .
+                               '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::PROVIDERS_LIST][\'' . $identityProvider . '\']' .
+                               ' has no identity field create clause defined at ' .
+                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::PROVIDERS_LIST][\'' . $identityProvider . '\'][ProviderConfiguration::IDENTITY_FIELD_CREATE_CLAUSE]'
+                               ,
+                               1300103750
+                       );
+               }
+       }
+
+       /**
+        * Checks the configuration of the default identity provider
+        * @param string $defaultProvider
+        * @throws \InvalidArgumentException when there is an errer in the default configuration
+        */
+       public function checkDefaultIdentityProviderConfiguration($defaultProvider) {
+               $this->checkIdentityProviderConfiguration($defaultProvider);
+               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][ProviderConfiguration::PROVIDERS_LIST][$defaultProvider])) {
+                       throw new \InvalidArgumentException(
+                               'The default identity provider "' . $defaultProvider .
+                               '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::DEFAULT_PROVIDER]' .
+                               ' is not in the list of available providers ' .
+                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::PROVIDERS_LIST]',
+                               1300104323
+                       );
+               }
+       }
+
+       /**
+        * Checks the configuration of an individual provider
+        *
+        * @param string $identityProvider
+        * @throws \InvalidArgumentException when there is an error in the provider configuration
+        */
+       public function checkIdentityProviderConfiguration($identityProvider) {
+               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][ProviderConfiguration::PROVIDERS_LIST][$identityProvider])) {
+                       throw new \InvalidArgumentException(
+                               'The identity provider "' . $identityProvider .
+                               '" is not defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::PROVIDERS_LIST][\'' . $identityProvider . '\']',
+                               1300109077
+                       );
+               }
+               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][ProviderConfiguration::PROVIDERS_LIST][$identityProvider][ProviderConfiguration::IDENTITY_FIELD])) {
+                       throw new \InvalidArgumentException(
+                               'The identity provider "' . $identityProvider .
+                               '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::PROVIDERS_LIST][\'' . $identityProvider . '\']' .
+                               ' has no identity field defined at ' .
+                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::PROVIDERS_LIST][\'' . $identityProvider . '\'][ProviderConfiguration::IDENTITY_FIELD]'
+                               ,
+                               1300110713
+                       );
+               }
+               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][ProviderConfiguration::PROVIDERS_LIST][$identityProvider][ProviderConfiguration::IDENTITY_FIELD_CREATE_CLAUSE])) {
+                       throw new \InvalidArgumentException(
+                               'The identity provider "' . $identityProvider .
+                               '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::PROVIDERS_LIST][\'' . $identityProvider . '\']' .
+                               ' has no identity field create clause defined at ' .
+                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::PROVIDERS_LIST][\'' . $identityProvider . '\'][ProviderConfiguration::IDENTITY_FIELD_CREATE_CLAUSE]'
+                               ,
+                               1300103750
+                       );
+               }
+               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][ProviderConfiguration::PROVIDERS_LIST][$identityProvider][ProviderConfiguration::PROVIDER_CLASS])) {
+                       throw new \InvalidArgumentException(
+                               'The identity provider "' . $identityProvider .
+                               '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::PROVIDERS_LIST][\'' . $identityProvider . '\']' .
+                               ' has no provider class defined at ' .
+                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::PROVIDERS_LIST][\'' . $identityProvider . '\'][ProviderConfiguration::PROVIDER_CLASS]'
+                               ,
+                               1300109191
+                       );
+               }
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/Configuration/IdentityProviderConfigurationInterface.php b/Classes/Configuration/IdentityProviderConfigurationInterface.php
new file mode 100644 (file)
index 0000000..25f30b2
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+namespace Maroschik\Identity\Configuration;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * An interface that supports the configuration of ext:identity by delivering some
+ * constants, that can be used in configuration arrays as keys.
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ * @api
+ */
+interface IdentityProviderConfigurationInterface {
+
+       /**
+        * A configuration key that can be used to define table specific identity providers
+        *
+        * @api
+        */
+       const KEY = 'identityProvider';
+
+       /**
+        * A configuration key for the list of identity providers
+        *
+        * @api
+        */
+       const PROVIDERS_LIST = 'identityProviders';
+
+       /**
+        * A configuration key for the default identity provider
+        *
+        * @api
+        */
+       const DEFAULT_PROVIDER = 'defaultProvider';
+
+       /**
+        * A configuration key for the field name of an identity provider
+        *
+        * @api
+        */
+       const IDENTITY_FIELD = 'identityField';
+
+       /**
+        * A configuration key for the sql create clause for identity fields of an identity provider
+        *
+        * @api
+        */
+       const IDENTITY_FIELD_CREATE_CLAUSE = 'identityFieldCreateClause';
+
+       /**
+        * A configuration key for the classname of an identity provider
+        *
+        * @api
+        */
+       const PROVIDER_CLASS = 'providerClass';
+
+}
\ No newline at end of file
diff --git a/Classes/Configuration/IdentityProviderInterface.php b/Classes/Configuration/IdentityProviderInterface.php
deleted file mode 100644 (file)
index d937ce5..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * An interface that supports the configuration of ext:identity by delivering some
- * constants, that can be used in configuration arrays as keys.
- *
- * @author Thomas Maroschik <tmaroschik@dfau.de>
- * @api
- * @package TYPO3
- * @subpackage identity
- */
-interface Tx_Identity_Configuration_IdentityProviderInterface {
-
-       /**
-        * A configuration key that can be used to define table specific identity providers
-        *
-        * @api
-        */
-       const KEY                                                       = 'identityProvider';
-
-       /**
-        * A configuration key for the list of identity providers
-        *
-        * @api
-        */
-       const PROVIDERS_LIST                            = 'identityProviders';
-
-       /**
-        * A configuration key for the default identity provider
-        *
-        * @api
-        */
-       const DEFAULT_PROVIDER                          = 'defaultProvider';
-
-       /**
-        * A configuration key for the field name of an identity provider
-        *
-        * @api
-        */
-       const IDENTITY_FIELD                            = 'identityField';
-
-       /**
-        * A configuration key for the sql create clause for identity fields of an identity provider
-        *
-        * @api
-        */
-       const IDENTITY_FIELD_CREATE_CLAUSE      = 'identityFieldCreateClause';
-
-       /**
-        * A configuration key for the classname of an identity provider
-        *
-        * @api
-        */
-       const PROVIDER_CLASS                            = 'providerClass';
-
-}
\ No newline at end of file
diff --git a/Classes/Hooks/DataHandlerHook.php b/Classes/Hooks/DataHandlerHook.php
new file mode 100644 (file)
index 0000000..062af20
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+namespace Maroschik\Identity\Hooks;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Hooks for TYPO3 TCEMain.
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ */
+class DataHandlerHook {
+
+       /**
+        * Commit the changes to the identity map after all database operations
+        *
+        * @param $parent
+        */
+       public function processDatamap_afterAllOperations() {
+               /** @var $identityMap \Maroschik\Identity\IdentityMap */
+               $identityMap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Maroschik\Identity\IdentityMap');
+               $identityMap->commit();
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/Hooks/DatabasePreProcessQueryHook.php b/Classes/Hooks/DatabasePreProcessQueryHook.php
new file mode 100644 (file)
index 0000000..1a7dcfd
--- /dev/null
@@ -0,0 +1,141 @@
+<?php
+namespace Maroschik\Identity\Hooks;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Hooks for TYPO3 DB Preprocessing.
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ */
+class DatabasePreProcessQueryHook implements \TYPO3\CMS\Core\Database\PreProcessQueryHookInterface {
+
+       /**
+        * @var \Maroschik\Identity\IdentityMap
+        */
+       protected $identityMap;
+
+       /**
+        * Constructor method for the t3lib_DB posprocess hook
+        */
+       public function __construct() {
+               $this->identityMap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Maroschik\Identity\IdentityMap');
+       }
+
+       /**
+        * 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 \TYPO3\CMS\Core\Database\DatabaseConnection $parentObject
+        * @return void
+        */
+       public function INSERTquery_preProcessAction(&$table, array &$fieldsValues, &$noQuoteFields, \TYPO3\CMS\Core\Database\DatabaseConnection $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 \TYPO3\CMS\Core\Database\DatabaseConnection $parentObject
+        * @return void
+        */
+       public function INSERTmultipleRows_preProcessAction(&$table, array &$fields, array &$rows, &$noQuoteFields, \TYPO3\CMS\Core\Database\DatabaseConnection $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 SELECTquery method.
+        *
+        * @param string $select_fields Fields to be selected
+        * @param string $from_table Table to select data from
+        * @param string $where_clause Where clause
+        * @param string $groupBy Group by statement
+        * @param string $orderBy Order by statement
+        * @param integer $limit Database return limit
+        * @param \TYPO3\CMS\Core\Database\DatabaseConnection $parentObject
+        * @return void
+        */
+       public function SELECTquery_preProcessAction(&$select_fields, &$from_table, &$where_clause, &$groupBy, &$orderBy, &$limit, \TYPO3\CMS\Core\Database\DatabaseConnection $parentObject) {
+               // TODO: Implement SELECTquery_preProcessAction() method.
+       }
+
+       /**
+        * 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 \TYPO3\CMS\Core\Database\DatabaseConnection $parentObject
+        * @return void
+        */
+       public function UPDATEquery_preProcessAction(&$table, &$where, array &$fieldsValues, &$noQuoteFields, \TYPO3\CMS\Core\Database\DatabaseConnection $parentObject) {
+               // TODO: Implement UPDATEquery_preProcessAction() method.
+       }
+
+       /**
+        * Pre-processor for the DELETEquery method.
+        *
+        * @param string $table Database table name
+        * @param string $where WHERE clause
+        * @param \TYPO3\CMS\Core\Database\DatabaseConnection $parentObject
+        * @return void
+        */
+       public function DELETEquery_preProcessAction(&$table, &$where, \TYPO3\CMS\Core\Database\DatabaseConnection $parentObject) {
+               // TODO: Implement DELETEquery_preProcessAction() method.
+       }
+
+       /**
+        * Pre-processor for the TRUNCATEquery method.
+        *
+        * @param string $table Database table name
+        * @param \TYPO3\CMS\Core\Database\DatabaseConnection $parentObject
+        * @return void
+        */
+       public function TRUNCATEquery_preProcessAction(&$table, \TYPO3\CMS\Core\Database\DatabaseConnection $parentObject) {
+               // TODO: Implement TRUNCATEquery_preProcessAction() method.
+       }
+}
\ No newline at end of file
diff --git a/Classes/Hooks/class.tx_identity_em_hook.php b/Classes/Hooks/class.tx_identity_em_hook.php
deleted file mode 100644 (file)
index 3692676..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Xavier Perseguers <xavier@typo3.org>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Hooks for TYPO3 Extension Manager.
- *
- * @author Xavier Perseguers <xavier@typo3.org>
- *
- * @package TYPO3
- * @subpackage identity
- */
-class tx_identity_em_hook implements tx_em_Index_CheckDatabaseUpdatesHook, Tx_Install_Interfaces_CheckTheDatabaseHook {
-
-       /**
-        * Contains tcaIncluded
-        *
-        * @var bool
-        */
-       protected $tcaIncluded = FALSE;
-
-       /**
-        * Hook that allows pre-processing of database structure modifications.
-        * The hook implementation may return a user form that will temporarily
-        * replace the standard database update form. This allows additional
-        * operations to be performed before the database structure gets updated.
-        *
-        * @param string $extKey: Extension key
-        * @param array $extInfo: Extension information array
-        * @param array $diff: Database differences
-        * @param t3lib_install $instObj: Instance of the installer
-        * @param tx_em_Install $parent: The calling parent object
-        * @return string Either empty string or a pre-processing user form
-        */
-       public function preProcessDatabaseUpdates($extKey, array $extInfo, array $diff, t3lib_install $instObj, tx_em_Install $parent) {
-               // Do nothing here as we don't need to
-               return;
-       }
-
-       /**
-        * Hook that allows to dynamically extend the table definitions for e.g. custom caches.
-        * The hook implementation may return table create strings that will be respected by
-        * the extension manager during installation of an extension.
-        *
-        * @param string $extKey
-        * @param array $extInfo
-        * @param t3lib_install $instObj
-        * @param t3lib_install_Sql $instSqlObj
-        * @param tx_em_Install $parent
-        * @return string
-        */
-       public function appendTableDefinitions($extKey, array $extInfo, $fileContent, t3lib_install $instObj, t3lib_install_Sql $instSqlObj, tx_em_Install $parent) {
-               if ($extKey === 'identity') {
-                       // Proceed over all TCA tables if in ext:identity database update dialog
-                       $fieldDefinitions = $GLOBALS['TCA'];
-                       $fieldDefinitions['sys_identity'] = Array();
-               } else {
-                       $fieldDefinitions = $instSqlObj->getFieldDefinitions_fileContent($fileContent);
-               }
-               /** @var Tx_Identity_Utility_FieldDefinitions $fieldDefinitionsUtility */
-               $fieldDefinitionsUtility = t3lib_div::makeInstance('Tx_Identity_Utility_FieldDefinitions');
-               // Ignore TCA upon extension installation, things get corrected afterwards if tca is available
-               if (!$extInfo['installed']) {
-                       $fieldDefinitionsUtility->setIgnoreTCA(TRUE);
-               }
-               return $fieldDefinitionsUtility->getInsertIdentityColumnSql($fieldDefinitions);
-       }
-
-       /**
-        *
-        * @param string $extKey
-        * @param array $loadedExtConf
-        * @param string $extensionSqlContent
-        * @param tx_em_Install $parent
-        * @return string
-        */
-       public function appendExtensionTableDefinitions($extKey, array $loadedExtConf, $extensionSqlContent, t3lib_install_Sql $instSqlObj, tx_install $parent) {
-               if (!$this->tcaIncluded) {
-                       $parent->includeTCA();
-                       $this->tcaIncluded = TRUE;
-               }
-               $fieldDefinitions = $instSqlObj->getFieldDefinitions_fileContent($extensionSqlContent);
-               /** @var Tx_Identity_Utility_FieldDefinitions $fieldDefinitionsUtility */
-               $fieldDefinitionsUtility = t3lib_div::makeInstance('Tx_Identity_Utility_FieldDefinitions');
-               return $fieldDefinitionsUtility->getInsertIdentityColumnSql($fieldDefinitions);
-       }
-
-       /**
-        *
-        * @param string $allSqlContent: The content of all relevant sql files
-        * @param t3lib_install_Sql $instSqlObj: Instance of the installer sql object
-        * @param tx_em_Install $parent: The calling parent object
-        * @return string
-        */
-       public function appendGlobalTableDefinitions($allSqlContent, t3lib_install_Sql $instSqlObj, tx_install $parent) {
-               // Do nothing here as we don't need to
-               return;
-       }
-
-}
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/identity/Classes/Hooks/class.tx_identity_em_hook.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/identity/Classes/Hooks/class.tx_identity_em_hook.php']);
-}
\ 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
deleted file mode 100644 (file)
index 2b29e41..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Hooks for TYPO3 DB Preprocessing.
- *
- * @author Thomas Maroschik <tmaroschik@dfau.de>
- *
- * @package TYPO3
- * @subpackage identity
- */
-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
diff --git a/Classes/Hooks/class.tx_identity_tcemain_hook.php b/Classes/Hooks/class.tx_identity_tcemain_hook.php
deleted file mode 100644 (file)
index c13ff0f..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Hooks for TYPO3 TCEMain.
- *
- * @author Thomas Maroschik <tmaroschik@dfau.de>
- *
- * @package TYPO3
- * @subpackage identity
- */
-class tx_identity_tcemain_hook {
-
-       public function processDatamap_afterAllOperations($parent) {
-               /** @var $identityMap Tx_Identity_Map */
-               $identityMap = t3lib_div::makeInstance('Tx_Identity_Map');
-               $identityMap->commit();
-       }
-
-}
\ No newline at end of file
diff --git a/Classes/IdentityMap.php b/Classes/IdentityMap.php
new file mode 100644 (file)
index 0000000..94531e7
--- /dev/null
@@ -0,0 +1,270 @@
+<?php
+namespace Maroschik\Identity;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use Maroschik\Identity\Configuration\IdentityProviderConfigurationInterface as ProviderConfiguration;
+
+/**
+ * This is the base of the identity extension.
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ * @api
+ */
+class IdentityMap implements \TYPO3\CMS\Core\SingletonInterface {
+
+       /**
+        * @var bool
+        */
+       protected $isInitialized = FALSE;
+
+       /**
+        * @var Provider\ProviderInterface
+        */
+       protected $defaultIdentityProvider;
+
+       /**
+        * @var array
+        */
+       protected $identityProviders = array();
+
+       /**
+        * @var array
+        */
+       protected $tableSpecificIdentityProviders = array();
+
+       /**
+        * Constructor method for the identifier registry
+        *
+        * @api
+        */
+       public function initializeObject() {
+               if (!$this->isInitialized) {
+                       $this->initializeIdentityProviders();
+                       $this->initializeDefaultIdentityProvider();
+                       $this->initializeTableSpecificIdentityProviders();
+                       $this->isInitialized = TRUE;
+               }
+       }
+
+       /**
+        * Initialize all defined identity providers
+        */
+       protected function initializeIdentityProviders() {
+               /** @var $identityConfigurationCheck \Maroschik\Identity\Configuration\ConfigurationCheck */
+               $identityConfigurationCheck = GeneralUtility::makeInstance('Maroschik\Identity\Configuration\ConfigurationCheck');
+               $identityConfiguration = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'];
+               $identityProviders = $identityConfiguration[ProviderConfiguration::PROVIDERS_LIST];
+               foreach ($identityProviders as $identityProviderKey => $identityProviderConfiguration) {
+                       $identityConfigurationCheck->checkIdentityProviderConfiguration($identityProviderKey);
+                       /** @var $identityProvider Provider\ProviderInterface */
+                       $identityProvider = GeneralUtility::makeInstance($identityProviderConfiguration[ProviderConfiguration::PROVIDER_CLASS], $identityProviderKey);
+                       if (!$identityProvider) {
+                               throw new \InvalidArgumentException('The provider class "' . $identityProviderConfiguration[ProviderConfiguration::PROVIDER_CLASS] . '" could not be loaded.', 1300109265);
+                       }
+                       if (!$identityProvider instanceof Provider\ProviderInterface) {
+                               throw new \InvalidArgumentException('The provider class "' . $identityProviderConfiguration[ProviderConfiguration::PROVIDER_CLASS] . '" does not implement the "ProviderInterface".', 1300110062);
+                       }
+                       if (method_exists($identityProvider, 'injectDatabaseConnection')) {
+                               $identityProvider->injectDatabaseConnection($GLOBALS['TYPO3_DB']);
+                       }
+                       if (method_exists($identityProvider, 'injectConfiguration')) {
+                               $identityProvider->injectConfiguration($identityProviderConfiguration);
+                       }
+                       $this->identityProviders[$identityProviderKey] = array(
+                               'field' => $identityProviderConfiguration[ProviderConfiguration::IDENTITY_FIELD],
+                               'provider' => $identityProvider,
+                       );
+               }
+       }
+
+       /**
+        * Initialize the default provider
+        */
+       protected function initializeDefaultIdentityProvider() {
+               /** @var $identityConfigurationCheck \Maroschik\Identity\Configuration\ConfigurationCheck */
+               $identityConfigurationCheck = GeneralUtility::makeInstance('Maroschik\Identity\Configuration\ConfigurationCheck');
+               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][ProviderConfiguration::DEFAULT_PROVIDER])) {
+                       throw new \InvalidArgumentException(
+                               'There is no default identity provider defined in ' .
+                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::DEFAULT_PROVIDER]',
+                               1300104461
+                       );
+               }
+               $defaultProviderKey = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][ProviderConfiguration::DEFAULT_PROVIDER];
+               $identityConfigurationCheck->checkDefaultIdentityProviderConfiguration($defaultProviderKey);
+               $this->defaultIdentityProvider = $this->identityProviders[$defaultProviderKey];
+       }
+
+       /**
+        * Initialize the table specific providers
+        */
+       protected function initializeTableSpecificIdentityProviders() {
+               /** @var $identityConfigurationCheck \Maroschik\Identity\Configuration\ConfigurationCheck */
+               $identityConfigurationCheck = GeneralUtility::makeInstance('Maroschik\Identity\Configuration\ConfigurationCheck');
+               if (isset($GLOBALS['TCA'])) {
+                       foreach ($GLOBALS['TCA'] as $table => $configuration) {
+                               if (isset($GLOBALS['TCA'][$table]['ctrl']['EXT']['identity'][ProviderConfiguration::KEY])) {
+                                       $identityProviderKey = $GLOBALS['TCA'][$table]['ctrl']['EXT']['identity'][ProviderConfiguration::KEY];;
+                                       $identityConfigurationCheck->checkTableSpecificIdentityProviderConfiguration($table, $identityProviderKey);
+                                       $this->tableSpecificIdentityProviders[$table] = $this->identityProviders[$identityProviderKey];
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Returns the identifier field for a resource location
+        *
+        * @param string $tablename
+        * @return string
+        */
+       public function getIdentifierFieldForResourceLocation($tablename) {
+               $this->initializeObject();
+               return isset($this->tableSpecificIdentityProviders[$tablename])
+                       ? $this->tableSpecificIdentityProviders[$tablename]['field']
+                       : $this->defaultIdentityProvider['field'];
+       }
+
+       /**
+        * Returns a unique identifier for a resource location
+        *
+        * @param string $tablename
+        * @param int $uid
+        * @return mixed the unique identifier
+        * @api
+        */
+       public function getIdentifierForResourceLocation($tablename, $uid) {
+               if (!$this->isApplicable($tablename)) {
+                       return NULL;
+               }
+               /** @var Provider\ProviderInterface $provider */
+               $provider = isset($this->tableSpecificIdentityProviders[$tablename])
+                               ? $this->tableSpecificIdentityProviders[$tablename]['provider']
+                               : $this->defaultIdentityProvider['provider'];
+               return $provider->getIdentifierForResourceLocation($tablename, $uid);
+       }
+
+       /**
+        * Requests a new identifier for a resource location
+        *
+        * @param string $tablename
+        * @return mixed
+        */
+       public function getIdentifierForNewResourceLocation($tablename) {
+               if (!$this->isApplicable($tablename)) {
+                       return NULL;
+               }
+               /** @var Provider\ProviderInterface $provider */
+               $provider = isset($this->tableSpecificIdentityProviders[$tablename])
+                               ? $this->tableSpecificIdentityProviders[$tablename]['provider']
+                               : $this->defaultIdentityProvider['provider'];
+               return $provider->getIdentifierForNewResourceLocation($tablename);
+       }
+
+       /**
+        * Returns a resource location for an identifier
+        *
+        * @param mixed $identifier
+        * @return array [tablename, uid] the resource location
+        * @api
+        */
+       public function getResourceLocationForIdentifier($identifier) {
+               $this->initializeObject();
+               // Ask each table specific provider first
+               foreach ($this->tableSpecificIdentityProviders as $providerArray) {
+                       try {
+                               /** @var Provider\ProviderInterface $provider */
+                               $provider = $providerArray['provider'];
+                               if ($provider->validateIdentifier($identifier)) {
+                                       $resouceLocation = $provider->getResourceLocationForIdentifier($identifier);
+                                       if ($resouceLocation) {
+                                               return $resouceLocation;
+                                       }
+                               }
+                       }
+                       catch (\Exception $e) {
+                               //@TODO implement logging
+                       }
+               }
+               // else the default provider
+               /** @var Provider\ProviderInterface $defaultProvider */
+               $defaultProvider = $this->defaultIdentityProvider['provider'];
+               return $defaultProvider->getResourceLocationForIdentifier($identifier);
+       }
+
+       /**
+        * Returns if the tablename can have an identifier
+        *
+        * @param string $tablename
+        * @return bool
+        * @api
+        */
+       public function isApplicable($tablename) {
+               $this->initializeObject();
+               /** @var Provider\ProviderInterface $provider */
+               $provider = isset($this->tableSpecificIdentityProviders[$tablename])
+                               ? $this->tableSpecificIdentityProviders[$tablename]['provider']
+                               : $this->defaultIdentityProvider['provider'];
+               return $provider->isApplicable($tablename);
+       }
+
+       /**
+        * Give all providers the chance to perform some kind of rebuild
+        *
+        * @api
+        */
+       public function rebuild() {
+               $this->initializeObject();
+               foreach ($this->identityProviders as $providerArray) {
+                       /** @var Provider\ProviderInterface $provider */
+                       $provider = $providerArray['provider'];
+                       if (method_exists($provider, 'rebuild')) {
+                               $provider->rebuild();
+                       }
+               }
+       }
+
+       /**
+        * Give all providers the chance to perform some kind of persistence
+        *
+        * @api
+        */
+       public function commit() {
+               $this->initializeObject();
+               foreach ($this->identityProviders as $providerArray) {
+                       /** @var Provider\ProviderInterface $provider */
+                       $provider = $providerArray['provider'];
+                       if (method_exists($provider, 'commit')) {
+                               $provider->commit();
+                       }
+               }
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/Install/Installer.php b/Classes/Install/Installer.php
deleted file mode 100644 (file)
index c5b6f00..0000000
+++ /dev/null
@@ -1,831 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * This Class groups together useful methods stolen from the Installer
- *
- * @author Fabien Udriot <fabien.udriot@ecodev.ch>
- *
- * @package TYPO3
- * @subpackage identity
- */
-class Tx_Identity_Install_Installer implements t3lib_Singleton {
-
-       /**
-        * Caching ou tput of $GLOBALS['TYPO3_DB']->admin_get_charsets()
-        *
-        * @var array
-        */
-       protected $character_sets = array();
-
-       /**
-        * Prefix used for tables/fields when deleted/renamed.
-        *
-        * @var string
-        */
-       protected $deletedPrefixKey = 'zzz_deleted_';
-
-       /**
-        * Returns an array where every entry is a single SQL-statement. Input must be formatted like an ordinary MySQL-dump files.
-        *
-        * @param       string          The SQL-file content. Provided that 1) every query in the input is ended with ';' and that a line in the file contains only one query or a part of a query.
-        * @param       boolean         If set, non-SQL content (like comments and blank lines) is not included in the final output
-        * @param       string          Regex to filter SQL lines to include
-        * @return      array           Array of SQL statements
-        */
-       function getStatementArray($sqlcode, $removeNonSQL = 0, $query_regex = '') {
-               $sqlcodeArr = explode(LF, $sqlcode);
-               // Based on the assumption that the sql-dump has
-               $statementArray = array();
-               $statementArrayPointer = 0;
-               foreach ($sqlcodeArr as $line => $lineContent) {
-                       $is_set = 0;
-                               // auto_increment fields cannot have a default value!
-                       if (stristr($lineContent, 'auto_increment')) {
-                               $lineContent = preg_replace('/ default \'0\'/i', '', $lineContent);
-                       }
-                       if (!$removeNonSQL || (strcmp(trim($lineContent), '') && substr(trim($lineContent), 0, 1) != '#' && substr(trim($lineContent), 0, 2) != '--')) { // '--' is seen as mysqldump comments from server version 3.23.49
-                               $statementArray[$statementArrayPointer] .= $lineContent;
-                               $is_set = 1;
-                       }
-                       if (substr(trim($lineContent), -1) === ';') {
-                               if (isset($statementArray[$statementArrayPointer])) {
-                                       if (!trim($statementArray[$statementArrayPointer]) || ($query_regex && !preg_match('/' . $query_regex . '/i', trim($statementArray[$statementArrayPointer])))) {
-                                               unset($statementArray[$statementArrayPointer]);
-                                       }
-                               }
-                               $statementArrayPointer++;
-                       } elseif ($is_set) {
-                               $statementArray[$statementArrayPointer] .= LF;
-                       }
-               }
-               return $statementArray;
-       }
-
-
-       /*************************************
-        *
-        * SQL
-        *
-        *************************************/
-
-       /**
-        * Reads the field definitions for the input SQL-file string
-        *
-        * @param       string          Should be a string read from an SQL-file made with 'mysqldump [database_name] -d'
-        * @return      array           Array with information about table.
-        */
-       function getFieldDefinitions_fileContent($fileContent) {
-               $lines = t3lib_div::trimExplode(LF, $fileContent, 1);
-               $table = '';
-               $total = array();
-               foreach ($lines as $value) {
-                       if (substr($value, 0, 1) === '#') {
-                               continue; // Ignore comments
-                       }
-                       if (!strlen($table)) {
-                               $parts = t3lib_div::trimExplode(' ', $value, TRUE);
-                               if (strtoupper($parts[0]) === 'CREATE' && strtoupper($parts[1]) === 'TABLE') {
-                                       $table = str_replace('`', '', $parts[2]);
-                                       if (TYPO3_OS === 'WIN') { // tablenames are always lowercase on windows!
-                                               $table = strtolower($table);
-                                       }
-                               }
-                       } else {
-                               if (substr($value, 0, 1) === ')' && substr($value, -1) === ';') {
-                                       $ttype = array();
-                                       if (preg_match('/(ENGINE|TYPE)[ ]*=[ ]*([a-zA-Z]*)/', $value, $ttype)) {
-                                               $total[$table]['extra']['ENGINE'] = $ttype[2];
-                                       } // Otherwise, just do nothing: If table engine is not defined, just accept the system default.
-                                       // Set the collation, if specified
-                                       if (preg_match('/(COLLATE)[ ]*=[ ]*([a-zA-z0-9_-]+)/', $value, $tcollation)) {
-                                               $total[$table]['extra']['COLLATE'] = $tcollation[2];
-                                       } else {
-                                                       // Otherwise, get the CHARACTER SET and try to find the default collation for it as returned by "SHOW CHARACTER SET" query (for details, see http://dev.mysql.com/doc/refman/5.1/en/charset-table.html)
-                                               if (preg_match('/(CHARSET|CHARACTER SET)[ ]*=[ ]*([a-zA-z0-9_-]+)/', $value, $tcharset)) { // Note: Keywords "DEFAULT CHARSET" and "CHARSET" are the same, so "DEFAULT" can just be ignored
-                                                       $charset = $tcharset[2];
-                                               } else {
-                                                       $charset = $GLOBALS['TYPO3_DB']->default_charset; // Fallback to default charset
-                                               }
-                                               $total[$table]['extra']['COLLATE'] = $this->getCollationForCharset($charset);
-                                       }
-                                       $table = ''; // Remove table marker and start looking for the next "CREATE TABLE" statement
-                               } else {
-                                       $lineV = preg_replace('/,$/', '', $value); // Strip trailing commas
-                                       $lineV = str_replace('`', '', $lineV);
-                                       $lineV = str_replace('  ', ' ', $lineV); // Remove double blanks
-                                       $parts = explode(' ', $lineV, 2);
-                                       if (!preg_match('/(PRIMARY|UNIQUE|FULLTEXT|INDEX|KEY)/', $parts[0])) { // Field definition
-                                                       // Make sure there is no default value when auto_increment is set
-                                               if (stristr($parts[1], 'auto_increment')) {
-                                                       $parts[1] = preg_replace('/ default \'0\'/i', '', $parts[1]);
-                                               }
-                                                       // "default" is always lower-case
-                                               if (stristr($parts[1], ' DEFAULT ')) {
-                                                       $parts[1] = str_ireplace(' DEFAULT ', ' default ', $parts[1]);
-                                               }
-                                                       // Change order of "default" and "null" statements
-                                               $parts[1] = preg_replace('/(.*) (default .*) (NOT NULL)/', '$1 $3 $2', $parts[1]);
-                                               $parts[1] = preg_replace('/(.*) (default .*) (NULL)/', '$1 $3 $2', $parts[1]);
-                                               $key = $parts[0];
-                                               $total[$table]['fields'][$key] = $parts[1];
-                                       } else { // Key definition
-                                               $search = array('/UNIQUE (INDEX|KEY)/', '/FULLTEXT (INDEX|KEY)/', '/INDEX/');
-                                               $replace = array('UNIQUE', 'FULLTEXT', 'KEY');
-                                               $lineV = preg_replace($search, $replace, $lineV);
-                                               if (preg_match('/PRIMARY|UNIQUE|FULLTEXT/', $parts[0])) {
-                                                       $parts[1] = preg_replace('/^(KEY|INDEX) /', '', $parts[1]);
-                                               }
-                                               $newParts = explode(' ', $parts[1], 2);
-                                               $key = $parts[0] == 'PRIMARY' ? $parts[0] : $newParts[0];
-                                               $total[$table]['keys'][$key] = $lineV;
-                                                       // This is a protection against doing something stupid: Only allow clearing of cache_* and index_* tables.
-                                               if (preg_match('/^(cache|index)_/', $table)) {
-                                                               // Suggest to truncate (clear) this table
-                                                       $total[$table]['extra']['CLEAR'] = 1;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               $this->getFieldDefinitions_sqlContent_parseTypes($total);
-               return $total;
-       }
-
-       /**
-        * Look up the default collation for specified character set based on "SHOW CHARACTER SET" output
-        *
-        * @param       string          Character set
-        * @return      string          Corresponding default collation
-        */
-       function getCollationForCharset($charset) {
-                       // Load character sets, if not cached already
-               if (!count($this->character_sets)) {
-                       if (method_exists($GLOBALS['TYPO3_DB'], 'admin_get_charsets')) {
-                               $this->character_sets = $GLOBALS['TYPO3_DB']->admin_get_charsets();
-                       } else {
-                               $this->character_sets[$charset] = array(); // Add empty element to avoid that the check will be repeated
-                       }
-               }
-               $collation = '';
-               if (isset($this->character_sets[$charset]['Default collation'])) {
-                       $collation = $this->character_sets[$charset]['Default collation'];
-               }
-               return $collation;
-       }
-
-
-       /**
-        * Multiplies varchars/tinytext fields in size according to $this->multiplySize
-        * Useful if you want to use UTF-8 in the database and needs to extend the field sizes in the database so UTF-8 chars are not discarded. For most charsets available as single byte sets, multiplication with 2 should be enough. For chinese, use 3.
-        *
-        * @param       array           Total array (from getFieldDefinitions_fileContent())
-        * @return      void
-        * @access private
-        * @see getFieldDefinitions_fileContent()
-        */
-       function getFieldDefinitions_sqlContent_parseTypes(array &$total) {
-               if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['multiplyDBfieldSize'] >= 1 && $GLOBALS['TYPO3_CONF_VARS']['SYS']['multiplyDBfieldSize'] <= 5) {
-                       $this->multiplySize = (double) $GLOBALS['TYPO3_CONF_VARS']['SYS']['multiplyDBfieldSize'];
-               }
-               $mSize = (double) $this->multiplySize;
-               if ($mSize > 1) {
-                               // Init SQL parser:
-                       $sqlParser = t3lib_div::makeInstance('t3lib_sqlparser');
-                       foreach ($total as $table => $cfg) {
-                               if (is_array($cfg['fields'])) {
-                                       foreach ($cfg['fields'] as $fN => $fType) {
-                                               $orig_fType = $fType;
-                                               $fInfo = $sqlParser->parseFieldDef($fType);
-                                               switch ($fInfo['fieldType']) {
-                                                       case 'char':
-                                                       case 'varchar':
-                                                               $newSize = round($fInfo['value'] * $mSize);
-                                                               if ($newSize <= 255) {
-                                                                       $fInfo['value'] = $newSize;
-                                                               } else {
-                                                                       $fInfo = array(
-                                                                               'fieldType' => 'text',
-                                                                               'featureIndex' => array(
-                                                                                       'NOTNULL' => array(
-                                                                                               'keyword' => 'NOT NULL'
-                                                                                       )
-                                                                               )
-                                                                       );
-                                                                               // Change key definition if necessary (must use "prefix" on TEXT columns)
-                                                                       if (is_array($cfg['keys'])) {
-                                                                               foreach ($cfg['keys'] as $kN => $kType) {
-                                                                                       $match = array();
-                                                                                       preg_match('/^([^(]*)\(([^)]+)\)(.*)/', $kType, $match);
-                                                                                       $keys = array();
-                                                                                       foreach (t3lib_div::trimExplode(',', $match[2]) as $kfN) {
-                                                                                               if ($fN == $kfN) {
-                                                                                                       $kfN .= '(' . $newSize . ')';
-                                                                                               }
-                                                                                               $keys[] = $kfN;
-                                                                                       }
-                                                                                       $total[$table]['keys'][$kN] = $match[1] . '(' . implode(',', $keys) . ')' . $match[3];
-                                                                               }
-                                                                       }
-                                                               }
-                                                       break;
-                                                       case 'tinytext':
-                                                               $fInfo['fieldType'] = 'text';
-                                                       break;
-                                               }
-                                               $total[$table]['fields'][$fN] = $sqlParser->compileFieldCfg($fInfo);
-                                               if ($sqlParser->parse_error) {
-                                                       throw new RuntimeException(
-                                                               'TYPO3 Fatal Error: ' . $sqlParser->parse_error,
-                                                               1270853961
-                                                       );
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Reads the field definitions for the current database
-        *
-        * @return      array           Array with information about table.
-        */
-       function getFieldDefinitions_database() {
-               $total = array();
-               $tempKeys = array();
-               $tempKeysPrefix = array();
-               $GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db);
-               echo $GLOBALS['TYPO3_DB']->sql_error();
-               $tables = $GLOBALS['TYPO3_DB']->admin_get_tables(TYPO3_db);
-               foreach ($tables as $tableName => $tableStatus) {
-                       // Fields:
-                       $fieldInformation = $GLOBALS['TYPO3_DB']->admin_get_fields($tableName);
-                       foreach ($fieldInformation as $fN => $fieldRow) {
-                               $total[$tableName]['fields'][$fN] = $this->assembleFieldDefinition($fieldRow);
-                       }
-                       // Keys:
-                       $keyInformation = $GLOBALS['TYPO3_DB']->admin_get_keys($tableName);
-                       foreach ($keyInformation as $keyRow) {
-                               $keyName = $keyRow['Key_name'];
-                               $colName = $keyRow['Column_name'];
-                               if ($keyRow['Sub_part']) {
-                                       $colName .= '(' . $keyRow['Sub_part'] . ')';
-                               }
-                               $tempKeys[$tableName][$keyName][$keyRow['Seq_in_index']] = $colName;
-                               if ($keyName == 'PRIMARY') {
-                                       $prefix = 'PRIMARY KEY';
-                               } else {
-                                       if ($keyRow['Index_type'] == 'FULLTEXT') {
-                                               $prefix = 'FULLTEXT';
-                                       } elseif ($keyRow['Non_unique']) {
-                                               $prefix = 'KEY';
-                                       } else {
-                                               $prefix = 'UNIQUE';
-                                       }
-                                       $prefix .= ' ' . $keyName;
-                               }
-                               $tempKeysPrefix[$tableName][$keyName] = $prefix;
-                       }
-                       // Table status (storage engine, collaction, etc.)
-                       if (is_array($tableStatus)) {
-                               $tableExtraFields = array(
-                                       'Engine' => 'ENGINE',
-                                       'Collation' => 'COLLATE',
-                               );
-                               foreach ($tableExtraFields as $mysqlKey => $internalKey) {
-                                       if (isset($tableStatus[$mysqlKey])) {
-                                               $total[$tableName]['extra'][$internalKey] = $tableStatus[$mysqlKey];
-                                       }
-                               }
-                       }
-               }
-               // Compile key information:
-               if (count($tempKeys)) {
-                       foreach ($tempKeys as $table => $keyInf) {
-                               foreach ($keyInf as $kName => $index) {
-                                       ksort($index);
-                                       $total[$table]['keys'][$kName] = $tempKeysPrefix[$table][$kName] . ' (' . implode(',', $index) . ')';
-                               }
-                       }
-               }
-               return $total;
-       }
-
-       /**
-        * Converts a result row with field information into the SQL field definition string
-        *
-        * @param       array           MySQL result row
-        * @return      string          Field definition
-        */
-       function assembleFieldDefinition(array $row) {
-               $field = array($row['Type']);
-               if ($row['Null'] == 'NO') {
-                       $field[] = 'NOT NULL';
-               }
-               if (!strstr($row['Type'], 'blob') && !strstr($row['Type'], 'text')) {
-                               // Add a default value if the field is not auto-incremented (these fields never have a default definition)
-                       if (!stristr($row['Extra'], 'auto_increment')) {
-                               $field[] = 'default \'' . addslashes($row['Default']) . '\'';
-                       }
-               }
-               if ($row['Extra']) {
-                       $field[] = $row['Extra'];
-               }
-               return implode(' ', $field);
-       }
-
-
-       /**
-        * Compares two arrays with field information and returns information about fields that are MISSING and fields that have CHANGED.
-        * FDsrc and FDcomp can be switched if you want the list of stuff to remove rather than update.
-        *
-        * @param       array           Field definitions, source (from getFieldDefinitions_fileContent())
-        * @param       array           Field definitions, comparison. (from getFieldDefinitions_database())
-        * @param       string          Table names (in list) which is the ONLY one observed.
-        * @param       boolean         If set, this function ignores NOT NULL statements of the SQL file field definition when comparing current field definition from database with field definition from SQL file. This way, NOT NULL statements will be executed when the field is initially created, but the SQL parser will never complain about missing NOT NULL statements afterwards.
-        * @return      array           Returns an array with 1) all elements from $FDsrc that is not in $FDcomp (in key 'extra') and 2) all elements from $FDsrc that is different from the ones in $FDcomp
-        */
-       function getDatabaseExtra(array $FDsrc, array $FDcomp, $onlyTableList = '', $ignoreNotNullWhenComparing = TRUE) {
-               $extraArr = array();
-               $diffArr = array();
-               if (is_array($FDsrc)) {
-                       foreach ($FDsrc as $table => $info) {
-                               if (!strlen($onlyTableList) || t3lib_div::inList($onlyTableList, $table)) {
-                                       if (!isset($FDcomp[$table])) {
-                                               $extraArr[$table] = $info; // If the table was not in the FDcomp-array, the result array is loaded with that table.
-                                               $extraArr[$table]['whole_table'] = 1;
-                                       } else {
-                                               $keyTypes = explode(',', 'extra,fields,keys');
-                                               foreach ($keyTypes as $theKey) {
-                                                       if (is_array($info[$theKey])) {
-                                                               foreach ($info[$theKey] as $fieldN => $fieldC) {
-                                                                       $fieldN = str_replace('`', '', $fieldN);
-                                                                       if ($fieldN === 'COLLATE') {
-                                                                               continue; // TODO: collation support is currently disabled (needs more testing)
-                                                                       }
-
-                                                                       if (!isset($FDcomp[$table][$theKey][$fieldN])) {
-                                                                               $extraArr[$table][$theKey][$fieldN] = $fieldC;
-                                                                       } else {
-                                                                               $fieldC = trim($fieldC);
-                                                                               if ($ignoreNotNullWhenComparing) {
-                                                                                       $fieldC = str_replace(' NOT NULL', '', $fieldC);
-                                                                                       $FDcomp[$table][$theKey][$fieldN] = str_replace(' NOT NULL', '', $FDcomp[$table][$theKey][$fieldN]);
-                                                                               }
-                                                                               if ($fieldC !== $FDcomp[$table][$theKey][$fieldN]) {
-                                                                                       $diffArr[$table][$theKey][$fieldN] = $fieldC;
-                                                                                       $diffArr_cur[$table][$theKey][$fieldN] = $FDcomp[$table][$theKey][$fieldN];
-                                                                               }
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-               $output = array(
-                       'extra' => $extraArr,
-                       'diff' => $diffArr,
-                       'diff_currentValues' => $diffArr_cur
-               );
-               return $output;
-       }
-
-
-       /**
-        * Returns an array with SQL-statements that is needed to update according to the diff-array
-        *
-        * @param       array           Array with differences of current and needed DB settings. (from getDatabaseExtra())
-        * @param       string          List of fields in diff array to take notice of.
-        * @return      array           Array of SQL statements (organized in keys depending on type)
-        */
-       function getUpdateSuggestions(array $diffArr, $keyList = 'extra,diff') {
-               $statements = array();
-               $deletedPrefixKey = $this->deletedPrefixKey;
-               $remove = 0;
-               if ($keyList === 'remove') {
-                       $remove = 1;
-                       $keyList = 'extra';
-               }
-               $keyList = explode(',', $keyList);
-               foreach ($keyList as $theKey) {
-                       if (is_array($diffArr[$theKey])) {
-                               foreach ($diffArr[$theKey] as $table => $info) {
-                                       $whole_table = array();
-                                       if (is_array($info['fields'])) {
-                                               foreach ($info['fields'] as $fN => $fV) {
-                                                       if ($info['whole_table']) {
-                                                               $whole_table[] = $fN . ' ' . $fV;
-                                                       } else {
-                                                                       // Special case to work around MySQL problems when adding auto_increment fields:
-                                                               if (stristr($fV, 'auto_increment')) {
-                                                                               // The field can only be set "auto_increment" if there exists a PRIMARY key of that field already.
-                                                                               // The check does not look up which field is primary but just assumes it must be the field with the auto_increment value...
-                                                                       if (isset($diffArr['extra'][$table]['keys']['PRIMARY'])) {
-                                                                                       // Remove "auto_increment" from the statement - it will be suggested in a 2nd step after the primary key was created
-                                                                               $fV = str_replace(' auto_increment', '', $fV);
-                                                                       } else {
-                                                                                       // In the next step, attempt to clear the table once again (2 = force)
-                                                                               $info['extra']['CLEAR'] = 2;
-                                                                       }
-                                                               }
-                                                               if ($theKey === 'extra') {
-                                                                       if ($remove) {
-                                                                               if (substr($fN, 0, strlen($deletedPrefixKey)) != $deletedPrefixKey) {
-                                                                                       $statement = 'ALTER TABLE ' . $table . ' CHANGE ' . $fN . ' ' . $deletedPrefixKey . $fN . ' ' . $fV . ';';
-                                                                                       $statements['change'][md5($statement)] = $statement;
-                                                                               } else {
-                                                                                       $statement = 'ALTER TABLE ' . $table . ' DROP ' . $fN . ';';
-                                                                                       $statements['drop'][md5($statement)] = $statement;
-                                                                               }
-                                                                       } else {
-                                                                               $statement = 'ALTER TABLE ' . $table . ' ADD ' . $fN . ' ' . $fV . ';';
-                                                                               $statements['add'][md5($statement)] = $statement;
-                                                                       }
-                                                               } elseif ($theKey == 'diff') {
-                                                                       $statement = 'ALTER TABLE ' . $table . ' CHANGE ' . $fN . ' ' . $fN . ' ' . $fV . ';';
-                                                                       $statements['change'][md5($statement)] = $statement;
-                                                                       $statements['change_currentValue'][md5($statement)] = $diffArr['diff_currentValues'][$table]['fields'][$fN];
-                                                               }
-                                                       }
-                                               }
-                                       }
-                                       if (is_array($info['keys'])) {
-                                               foreach ($info['keys'] as $fN => $fV) {
-                                                       if ($info['whole_table']) {
-                                                               $whole_table[] = $fV;
-                                                       } else {
-                                                               if ($theKey == 'extra') {
-                                                                       if ($remove) {
-                                                                               $statement = 'ALTER TABLE ' . $table . ($fN == 'PRIMARY' ? ' DROP PRIMARY KEY' : ' DROP KEY ' . $fN) . ';';
-                                                                               $statements['drop'][md5($statement)] = $statement;
-                                                                       } else {
-                                                                               $statement = 'ALTER TABLE ' . $table . ' ADD ' . $fV . ';';
-                                                                               $statements['add'][md5($statement)] = $statement;
-                                                                       }
-                                                               } elseif ($theKey == 'diff') {
-                                                                       $statement = 'ALTER TABLE ' . $table . ($fN == 'PRIMARY' ? ' DROP PRIMARY KEY' : ' DROP KEY ' . $fN) . ';';
-                                                                       $statements['change'][md5($statement)] = $statement;
-                                                                       $statement = 'ALTER TABLE ' . $table . ' ADD ' . $fV . ';';
-                                                                       $statements['change'][md5($statement)] = $statement;
-                                                               }
-                                                       }
-                                               }
-                                       }
-                                       if (is_array($info['extra'])) {
-                                               $extras = array();
-                                               $extras_currentValue = array();
-                                               $clear_table = FALSE;
-                                               foreach ($info['extra'] as $fN => $fV) {
-                                                               // Only consider statements which are missing in the database but don't remove existing properties
-                                                       if (!$remove) {
-                                                               if (!$info['whole_table']) { // If the whole table is created at once, we take care of this later by imploding all elements of $info['extra']
-                                                                       if ($fN === 'CLEAR') {
-                                                                                       // Truncate table must happen later, not now
-                                                                                       // Valid values for CLEAR: 1=only clear if keys are missing, 2=clear anyway (force)
-                                                                               if (count($info['keys']) || $fV == 2) {
-                                                                                       $clear_table = TRUE;
-                                                                               }
-                                                                               continue;
-                                                                       } else {
-                                                                               $extras[] = $fN . '=' . $fV;
-                                                                               $extras_currentValue[] = $fN . '=' . $diffArr['diff_currentValues'][$table]['extra'][$fN];
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-                                               if ($clear_table) {
-                                                       $statement = 'TRUNCATE TABLE ' . $table . ';';
-                                                       $statements['clear_table'][md5($statement)] = $statement;
-                                               }
-                                               if (count($extras)) {
-                                                       $statement = 'ALTER TABLE ' . $table . ' ' . implode(' ', $extras) . ';';
-                                                       $statements['change'][md5($statement)] = $statement;
-                                                       $statements['change_currentValue'][md5($statement)] = implode(' ', $extras_currentValue);
-                                               }
-                                       }
-                                       if ($info['whole_table']) {
-                                               if ($remove) {
-                                                       if (substr($table, 0, strlen($deletedPrefixKey)) != $deletedPrefixKey) {
-                                                               $statement = 'ALTER TABLE ' . $table . ' RENAME ' . $deletedPrefixKey . $table . ';';
-                                                               $statements['change_table'][md5($statement)] = $statement;
-                                                       } else {
-                                                               $statement = 'DROP TABLE ' . $table . ';';
-                                                               $statements['drop_table'][md5($statement)] = $statement;
-                                                       }
-                                                               // count:
-                                                       $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', $table);
-                                                       $statements['tables_count'][md5($statement)] = $count ? 'Records in table: ' . $count : '';
-                                               } else {
-                                                       $statement = 'CREATE TABLE ' . $table . " (\n" . implode(",\n", $whole_table) . "\n)";
-                                                       if ($info['extra']) {
-                                                               foreach ($info['extra'] as $k => $v) {
-                                                                       if ($k == 'COLLATE' || $k == 'CLEAR') {
-                                                                               continue; // Skip these special statements. TODO: collation support is currently disabled (needs more testing)
-                                                                       }
-                                                                       $statement .= ' ' . $k . '=' . $v; // Add extra attributes like ENGINE, CHARSET, etc.
-                                                               }
-                                                       }
-                                                       $statement .= ';';
-                                                       $statements['create_table'][md5($statement)] = $statement;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               return $statements;
-       }
-
-       /**
-        * Remove statements that contains not a uuid statement
-        *
-        * @param array $statements
-        * @return array
-        */
-       public function filterByIdentityField(array $statements) {
-               $identityConfiguration = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'];
-               $identityProviders = $identityConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST];
-               $identityField = $identityProviders['recordUuid'][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-               $result = array();
-               foreach ($statements as $key => $statement) {
-                       if (strpos($statement, 'ADD ' . $identityField . ' ') !== FALSE ||
-                                       strpos($statement, 'ADD KEY ' . $identityField . ' ') !== FALSE ) {
-                               $result[$key] = $statement;
-                       }
-               }
-               return $result;
-       }
-
-
-       protected $templateFilePath = 'typo3/sysext/install/Resources/Private/Templates/';
-
-       protected $dbUpdateCheckboxPrefix = 'TYPO3_INSTALL[database_update]'; // Prefix for checkbox fields when updating database.
-
-       protected $backPath = '../'; // Backpath (used for icons etc.)
-
-       /**
-        * Creates a table which checkboxes for updating database.
-        *
-        * @param array $arr Array of statements (key / value pairs where key is used for the checkboxes)
-        * @param string $label Label for the table.
-        * @param boolean $checked If set, then checkboxes are set by default.
-        * @param boolean $iconDis If set, then icons are shown.
-        * @param array $currentValue Array of "current values" for each key/value pair in $arr. Shown if given.
-        * @param boolean $cVfullMsg If set, will show the prefix "Current value" if $currentValue is given.
-        * @return string HTML table with checkboxes for update. Must be wrapped in a form.
-        */
-       function generateUpdateDatabaseForm_checkboxes(array $arr,$label,$checked=1,$iconDis=0,$currentValue=array(),$cVfullMsg=0) {
-               $out = array();
-               $tableId = uniqid('table');
-               $templateMarkers = array();
-               if (is_array($arr)) {
-                               // Get the template file
-                       $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'GenerateUpdateDatabaseFormCheckboxes.html');
-                               // Get the template part from the file
-                       $content = t3lib_parsehtml::getSubpart($templateFile, '###TEMPLATE###');
-                               // Define the markers content
-                       $templateMarkers = array(
-                               'label' => $label,
-                               'tableId' => $tableId
-                       );
-                               // Select/Deselect All
-                       if (count($arr) > 1) {
-                                       // Get the subpart for multiple tables
-                               $multipleTablesSubpart = t3lib_parsehtml::getSubpart($content, '###MULTIPLETABLES###');
-                                       // Define the markers content
-                               $multipleTablesMarkers = array(
-                                       'label' => $label,
-                                       'tableId' => $tableId,
-                                       'checked' => ($checked ? ' checked="checked"' : ''),
-                                       'selectAllId' => 't3-install-' . $tableId . '-checkbox',
-                                       'selectDeselectAll' => 'select/deselect all'
-                               );
-                                       // Fill the markers in the subpart
-                               $multipleTablesSubpart = t3lib_parsehtml::substituteMarkerArray(
-                                       $multipleTablesSubpart,
-                                       $multipleTablesMarkers,
-                                       '###|###',
-                                       TRUE,
-                                       FALSE
-                               );
-                       }
-                               // Substitute the subpart for multiple tables
-                       $content = t3lib_parsehtml::substituteSubpart(
-                               $content,
-                               '###MULTIPLETABLES###',
-                               $multipleTablesSubpart
-                       );
-                               // Rows
-                       foreach ($arr as $key => $string) {
-                                       // Get the subpart for rows
-                               $rowsSubpart = t3lib_parsehtml::getSubpart($content, '###ROWS###');
-                               $currentSubpart = '';
-                               $ico = '';
-                               $warnings = array();
-                                       // Define the markers content
-                               $rowsMarkers = array(
-                                       'checkboxId' => 't3-install-db-' . $key,
-                                       'name' => $this->dbUpdateCheckboxPrefix . '[' . $key . ']',
-                                       'checked' => ($checked ? 'checked="checked"' : ''),
-                                       'string' => htmlspecialchars($string)
-                               );
-                               if ($iconDis) {
-                                       $iconMarkers['backPath'] = $this->backPath;
-                                       if (preg_match('/^TRUNCATE/i', $string)) {
-                                               $iconMarkers['iconText'] = '';
-                                               $warnings['clear_table_info'] = 'Clearing the table is sometimes neccessary when adding new keys. In case of cache_* tables this should not hurt at all. However, use it with care.';
-                                       } elseif (stristr($string,' user_')) {
-                                               $iconMarkers['iconText'] = '(USER)';
-                                       } elseif (stristr($string,' app_')) {
-                                               $iconMarkers['iconText'] = '(APP)';
-                                       } elseif (stristr($string,' ttx_') || stristr($string,' tx_')) {
-                                               $iconMarkers['iconText'] = '(EXT)';
-                                       }
-
-                                       if (!empty($iconMarkers)) {
-                                                       // Get the subpart for icons
-                                               $iconSubpart = t3lib_parsehtml::getSubpart($content, '###ICONAVAILABLE###');
-                                                       // Fill the markers in the subpart
-                                               $iconSubpart = t3lib_parsehtml::substituteMarkerArray(
-                                                       $iconSubpart,
-                                                       $iconMarkers,
-                                                       '###|###',
-                                                       TRUE,
-                                                       TRUE
-                                               );
-                                       }
-                               }
-                                       // Substitute the subpart for icons
-                               $rowsSubpart = t3lib_parsehtml::substituteSubpart(
-                                       $rowsSubpart,
-                                       '###ICONAVAILABLE###',
-                                       $iconSubpart
-                               );
-                               if (isset($currentValue[$key])) {
-                                               // Get the subpart for current
-                                       $currentSubpart = t3lib_parsehtml::getSubpart($rowsSubpart, '###CURRENT###');
-                                               // Define the markers content
-                                       $currentMarkers = array (
-                                               'message' => (!$cVfullMsg ? 'Current value:': ''),
-                                               'value' => $currentValue[$key]
-                                       );
-                                               // Fill the markers in the subpart
-                                       $currentSubpart = t3lib_parsehtml::substituteMarkerArray(
-                                               $currentSubpart,
-                                               $currentMarkers,
-                                               '###|###',
-                                               TRUE,
-                                               FALSE
-                                       );
-                               }
-                                       // Substitute the subpart for current
-                               $rowsSubpart = t3lib_parsehtml::substituteSubpart(
-                                       $rowsSubpart,
-                                       '###CURRENT###',
-                                       $currentSubpart
-                               );
-                               $errorSubpart = '';
-                               if (isset($this->databaseUpdateErrorMessages[$key])) {
-                                               // Get the subpart for current
-                                       $errorSubpart = t3lib_parsehtml::getSubpart($rowsSubpart, '###ERROR###');
-                                               // Define the markers content
-                                       $currentMarkers = array (
-                                               'errorMessage' => $this->databaseUpdateErrorMessages[$key],
-                                       );
-                                               // Fill the markers in the subpart
-                                       $errorSubpart = t3lib_parsehtml::substituteMarkerArray(
-                                               $errorSubpart,
-                                               $currentMarkers,
-                                               '###|###',
-                                               TRUE,
-                                               FALSE
-                                       );
-                               }
-                                       // Substitute the subpart for error messages
-                               $rowsSubpart = t3lib_parsehtml::substituteSubpart(
-                                       $rowsSubpart,
-                                       '###ERROR###',
-                                       $errorSubpart
-                               );
-                                       // Fill the markers in the subpart
-                               $rowsSubpart = t3lib_parsehtml::substituteMarkerArray(
-                                       $rowsSubpart,
-                                       $rowsMarkers,
-                                       '###|###',
-                                       TRUE,
-                                       FALSE
-                               );
-                               $rows[] = $rowsSubpart;
-                       }
-                               // Substitute the subpart for rows
-                       $content = t3lib_parsehtml::substituteSubpart(
-                               $content,
-                               '###ROWS###',
-                               implode(LF, $rows)
-                       );
-                       if (count($warnings)) {
-                                       // Get the subpart for warnings
-                               $warningsSubpart = t3lib_parsehtml::getSubpart($content, '###WARNINGS###');
-                               $warningItems = array();
-                               foreach ($warnings as $warning) {
-                                               // Get the subpart for single warning items
-                                       $warningItemSubpart = t3lib_parsehtml::getSubpart($warningsSubpart, '###WARNINGITEM###');
-                                               // Define the markers content
-                                       $warningItemMarker['warning'] = $warning;
-                                               // Fill the markers in the subpart
-                                       $warningItems[] = t3lib_parsehtml::substituteMarkerArray(
-                                               $warningItemSubpart,
-                                               $warningItemMarker,
-                                               '###|###',
-                                               TRUE,
-                                               FALSE
-                                       );
-                               }
-                                       // Substitute the subpart for single warning items
-                               $warningsSubpart = t3lib_parsehtml::substituteSubpart(
-                                       $warningsSubpart,
-                                       '###WARNINGITEM###',
-                                       implode(LF, $warningItems)
-                               );
-                       }
-                               // Substitute the subpart for warnings
-                       $content = t3lib_parsehtml::substituteSubpart(
-                               $content,
-                               '###WARNINGS###',
-                               $warningsSubpart
-                       );
-               }
-                       // Fill the markers
-               $content = t3lib_parsehtml::substituteMarkerArray(
-                       $content,
-                       $templateMarkers,
-                       '###|###',
-                       TRUE,
-                       FALSE
-               );
-
-               return $content;
-       }
-
-       /**
-        * Performs the queries passed from the input array.
-        *
-        * @param       array           Array of SQL queries to execute.
-        * @param       array           Array with keys that must match keys in $arr. Only where a key in this array is set and TRUE will the query be executed (meant to be passed from a form checkbox)
-        * @return      mixed           Array with error message from database if any occured. Otherwise TRUE if everything was executed successfully.
-        */
-       function performUpdateQueries(array $arr, array $keyArr) {
-               $result = array();
-               if (is_array($arr)) {
-                       foreach ($arr as $key => $string) {
-                               if (isset($keyArr[$key]) && $keyArr[$key]) {
-                                       $res = $GLOBALS['TYPO3_DB']->admin_query($string);
-                                       if ($res === FALSE) {
-                                               $result[$key] = $GLOBALS['TYPO3_DB']->sql_error();
-                                       } elseif (is_resource($res)) {
-                                               $GLOBALS['TYPO3_DB']->sql_free_result($res);
-                                       }
-                               }
-                       }
-               }
-               if (count($result) > 0) {
-                       return $result;
-               } else {
-                       return TRUE;
-               }
-       }
-}
-
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['EXT:uuid/Class/Registry.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['EXT:uuid/Class/Registry.php']);
-}
-
-?>
\ No newline at end of file
diff --git a/Classes/Map.php b/Classes/Map.php
deleted file mode 100644 (file)
index b1eafde..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * This is the base of the identity extension.
- *
- * @author Thomas Maroschik <tmaroschik@dfau.de>
- * @api
- * @package TYPO3
- * @subpackage identity
- */
-class Tx_Identity_Map implements t3lib_Singleton {
-
-       /**
-        * @var bool
-        */
-       protected $isInitialized = false;
-
-       /**
-        * @var Tx_Identity_ProviderInterface
-        */
-       protected $defaultIdentityProvider;
-
-       /**
-        * @var array
-        */
-       protected $identityProviders = array();
-
-       /**
-        * @var array
-        */
-       protected $tableSpecificIdentityProviders = array();
-
-       /**
-        * Constructor method for the identifier registry
-        *
-        * @api
-        */
-       public function initializeObject() {
-               if (!$this->isInitialized) {
-                       $this->initializeIdentityProviders();
-                       $this->initializeDefaultIdentityProvider();
-                       $this->initializeTableSpecificIdentityProviders();
-                       $this->isInitialized = true;
-               }
-       }
-
-       /**
-        * Initialize all defined identity providers
-        */
-       protected function initializeIdentityProviders() {
-               /** @var $identityConfigurationCheck Tx_Identity_Configuration_Check */
-               $identityConfigurationCheck = t3lib_div::makeInstance('Tx_Identity_Configuration_Check');
-               $identityConfiguration = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'];
-               $identityProviders = $identityConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST];
-               foreach ($identityProviders as $identityProviderKey=>$identityProviderConfiguration) {
-                       $identityConfigurationCheck->checkIdentityProviderConfiguration($identityProviderKey);
-                       /** @var $identityProvider Tx_Identity_ProviderInterface */
-                       $identityProvider = t3lib_div::makeInstance($identityProviderConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::PROVIDER_CLASS], $identityProviderKey);
-                       if (!$identityProvider) {
-                               throw new InvalidArgumentException('The provider class "' . $identityProviderConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::PROVIDER_CLASS] . '" could not be loaded.', 1300109265);
-                       }
-                       if (!$identityProvider instanceof Tx_Identity_ProviderInterface) {
-                               throw new InvalidDataType('The provider class "' . $identityProviderConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::PROVIDER_CLASS] . '" does not implement the "Tx_Identity_ProviderInterface".' , 1300110062);
-                       }
-                       if (method_exists($identityProvider, 'injectDb')) {
-                               $identityProvider->injectDb($GLOBALS['TYPO3_DB']);
-                       }
-                       if (method_exists($identityProvider, 'injectConfiguration')) {
-                               $identityProvider->injectConfiguration($identityProviderConfiguration);
-                       }
-                       $this->identityProviders[$identityProviderKey] = array(
-                               'field'         => $identityProviderConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD],
-                               'provider'      =>      $identityProvider,
-                       );
-               }
-       }
-
-       /**
-        * Initialize the default provider
-        */
-       protected function initializeDefaultIdentityProvider() {
-               $identityConfigurationCheck = t3lib_div::makeInstance('Tx_Identity_Configuration_Check');
-               /** @var $identityConfigurationCheck Tx_Identity_Configuration_Check */
-               if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::DEFAULT_PROVIDER])) {
-                       throw new InvalidArgumentException(
-                               'There is no default identity provider defined in ' .
-                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::DEFAULT_PROVIDER]',
-                               1300104461
-                       );
-               }
-               $defaultProviderKey = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::DEFAULT_PROVIDER];
-               $identityConfigurationCheck->checkDefaultIdentityProviderConfiguration($defaultProviderKey);
-               $this->defaultIdentityProvider = $this->identityProviders[$defaultProviderKey];
-       }
-
-       /**
-        * Initialize the table specific providers
-        */
-       protected function initializeTableSpecificIdentityProviders() {
-               /** @var $identityConfigurationCheck Tx_Identity_Configuration_Check */
-               $identityConfigurationCheck = t3lib_div::makeInstance('Tx_Identity_Configuration_Check');
-               if (isset($GLOBALS['TCA'])) {
-                       foreach ($GLOBALS['TCA'] as $table=>$configuration) {
-                               t3lib_div::loadTCA($table);
-                               if (isset($GLOBALS['TCA'][$table]['ctrl']['EXT']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::KEY])) {
-                                       $identityProviderKey = $GLOBALS['TCA'][$table]['ctrl']['EXT']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::KEY];;
-                                       $identityConfigurationCheck->checkTableSpecificIdentityProviderConfiguration($table, $identityProviderKey);
-                                       $this->tableSpecificIdentityProviders[$table] = $this->identityProviders[$identityProviderKey];
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Returns the identifier field for a resource location
-        *
-        * @param string $tablename
-        * @return string
-        */
-       public function getIdentifierFieldForResourceLocation($tablename) {
-               $this->initializeObject();
-               if (isset($this->tableSpecificIdentityProviders[$tablename])) {
-                       // Look for a more specific identity provider first
-                       return $this->tableSpecificIdentityProviders[$tablename]['field'];
-               } else {
-                       // else take the default provider
-                       return $this->defaultIdentityProvider['field'];
-               }
-       }
-
-       /**
-        * Returns a unique identifier for a resource location
-        *
-        * @param string $tablename
-        * @param int $uid
-        * @return mixed the unique identifier
-        * @api
-        */
-       public function getIdentifierForResourceLocation($tablename, $uid) {
-               if (!$this->isApplicable($tablename)) {
-                       return NULL;
-               }
-               if (isset($this->tableSpecificIdentityProviders[$tablename])) {
-                       // Look for a more specific identity provider first
-                       return $this->tableSpecificIdentityProviders[$tablename]['provider']->getIdentifierForResourceLocation($tablename, $uid);
-               } else {
-                       // else take the default provider
-                       return $this->defaultIdentityProvider['provider']->getIdentifierForResourceLocation($tablename, $uid);
-               }
-       }
-
-       /**
-        * Requests a new identifier for a resource location
-        *
-        * @param string $tablename
-        * @return mixed
-        */
-       public function getIdentifierForNewResourceLocation($tablename) {
-               if (!$this->isApplicable($tablename)) {
-                       return NULL;
-               }
-               if (isset($this->tableSpecificIdentityProviders[$tablename])) {
-                       return $this->tableSpecificIdentityProviders[$tablename]['provider']->getIdentifierForNewResourceLocation($tablename);
-               } else {
-                       return $this->defaultIdentityProvider['provider']->getIdentifierForNewResourceLocation($tablename);
-               }
-       }
-
-       /**
-        * Returns a resource location for an identifier
-        *
-        * @param mixed $identifier
-        * @return array [tablename, uid] the resource location
-        * @api
-        */
-       public function getResourceLocationForIdentifier($identifier) {
-               $this->initializeObject();
-               // Ask each table specific provider first
-               foreach ($this->tableSpecificIdentityProviders as $tablename=>$providerArray) {
-                       try {
-                               if ($providerArray['provider']->validateIdentifier($identifier)) {
-                                       $resouceLocation = $providerArray['provider']->getResourceLocationForIdentifier($identifier);
-                                       if ($resouceLocation) {
-                                               return $resouceLocation;
-                                       }
-                               }
-                       } catch (Exception $e) {
-                               // TODO implement logging
-                       }
-               }
-               // else the default provider
-               return $this->defaultIdentityProvider['provider']->getResourceLocationForIdentifier($identifier);
-       }
-
-       /**
-        * Returns if the tablename can have an identifier
-        *
-        * @param string $tablename
-        * @return bool
-        * @api
-        */
-       public function isApplicable($tablename) {
-               $this->initializeObject();
-               if (isset($this->tableSpecificIdentityProviders[$tablename])) {
-                       // Look for a more specific identity provider first
-                       return $this->tableSpecificIdentityProviders[$tablename]['provider']->isApplicable($tablename);
-               } else {
-                       // else take the default provider
-                       return $this->defaultIdentityProvider['provider']->isApplicable($tablename);
-               }
-       }
-
-       /**
-        * Give all providers the chance to perform some kind of rebuild
-        *
-        * @api
-        */
-       public function rebuild() {
-               $this->initializeObject();
-               foreach ($this->identityProviders as $providerArray) {
-                       if (method_exists($providerArray['provider'], 'rebuild')) {
-                               $providerArray['provider']->rebuild();
-                       }
-               }
-       }
-
-       /**
-        * Give all providers the chance to perform some kind of persistence
-        *
-        * @api
-        */
-       public function commit() {
-               $this->initializeObject();
-               foreach ($this->identityProviders as $providerArray) {
-                       if (method_exists($providerArray['provider'], 'commit')) {
-                               $providerArray['provider']->commit();
-                       }
-               }
-       }
-
-}
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['EXT:identity/Classes/Map.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['EXT:identity/Classes/Map.php']);
-}
\ No newline at end of file
diff --git a/Classes/Provider/AbstractUuid.php b/Classes/Provider/AbstractUuid.php
deleted file mode 100644 (file)
index 62c3d48..0000000
+++ /dev/null
@@ -1,511 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class is the abstract implementation for a uuid identity provide
- *
- * @author Thomas Maroschik <tmaroschik@dfau.de>
- *
- * @package TYPO3
- * @subpackage identity
- */
-class Tx_Identity_Provider_AbstractUuid implements Tx_Identity_ProviderInterface {
-
-       /**
-        * @var string
-        */
-       protected $providerKey;
-
-       /**
-        * @var string
-        */
-       protected $identityTable = 'sys_identity';
-
-       /**
-        * @var array
-        */
-       protected $configuration = array();
-
-       /**
-        * @var array
-        */
-       protected $isApplicableCache = array();
-
-       /**
-        * @var t3lib_DB
-        */
-       protected $db;
-
-       /**
-        * @var array
-        */
-       protected $uuidMap = array();
-
-       /**
-        * @var array
-        */
-       protected $tablenameUidMap = array();
-
-       /**
-        * @var array
-        */
-       protected $insertQueue = array();
-
-       /**
-        * @var array
-        */
-       protected $deleteQueue = array();
-
-       /**
-        * @var integer
-        */
-       protected $version;
-
-       /**
-        * Sets the provider key
-        * @param string $providerKey
-        */
-       public function __construct($providerKey) {
-               $this->providerKey = $providerKey;
-
-               $this->version = class_exists('t3lib_utility_VersionNumber')
-                       ? t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version)
-                       : t3lib_div::int_from_ver(TYPO3_version);
-       }
-
-       /**
-        * Injector method for the providers configuration
-        *
-        * @param array $configuration
-        */
-       public function injectConfiguration(array $configuration) {
-               $this->configuration = $configuration;
-       }
-
-       /**
-        * Injector method for a t3lib_DB
-        *
-        * @param t3lib_DB $db
-        */
-       public function injectDb(t3lib_DB $db) {
-               $this->db = $db;
-       }
-
-       /**
-        * Checks the given UUID. If it does not have a valid format an
-        * exception is thrown.
-        *
-        * @param       string  UUID.
-        * @return      bool
-        * @throws      InvalidArgumentException        Throws an exception if the given uuid is not valid
-        */
-       public function validateIdentifier($identifier) {
-               if (!strlen($identifier)) {
-                       throw new InvalidArgumentException('Empty UUID given.', 1299013185);
-               }
-               if (function_exists('uuid_is_valid') && !uuid_is_valid($identifier)) {
-                       throw new InvalidArgumentException('Given UUID does not match the UUID pattern.', 1299013329);
-               }
-               if (strlen($identifier) !== 36) {
-                       throw new InvalidArgumentException('Lenghth of UUID has to be 36 characters.', 1299013335);
-               }
-               $pattern = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i';
-               if (!preg_match($pattern, $identifier)) {
-                       throw new InvalidArgumentException('Given UUID does not match the UUID pattern.', 1299013339);
-               }
-               return TRUE;
-       }
-
-       /**
-        * @param string $tablename
-        * @return bool
-        */
-       public function isApplicable($tablename) {
-               if (isset($this->isApplicableCache[$tablename])) {
-                       return $this->isApplicableCache[$tablename];
-               }
-               if (isset($GLOBALS['TCA']) && is_array($GLOBALS['TCA']) && in_array($tablename, array_keys($GLOBALS['TCA']))) {
-                       $identityField = $this->configuration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-                       if ($identityField) {
-                               // It is necessary to check if the table contains the identity field.
-                               // During the installation of ext:identity there could occur sql errors until the
-                               // extension manager/install tool hook kicks in and the tables are supplied with the identifier field.
-                               $fields = $this->db->admin_get_fields($tablename);
-                               $fieldNames = array_keys($fields);
-                               if ($fields && in_array($identityField, $fieldNames)) {
-                                       $this->isApplicableCache[$tablename] = TRUE;
-                                       return $this->isApplicableCache[$tablename];
-                               }
-                       }
-               }
-               $this->isApplicableCache[$tablename] = FALSE;
-               return $this->isApplicableCache[$tablename];
-       }
-
-       /**
-        * Returns a resource location for an identifier
-        *
-        * @param mixed $identifier
-        * @return array [tablename, uid] the resource location
-        */
-       public function getResourceLocationForIdentifier($uuid) {
-               if (!isset($this->uuidMap[$uuid])) {
-                       $this->loadEntryByUUID($uuid);
-               }
-               return $this->uuidMap[$uuid];
-       }
-
-       /**
-        * Returns a unique identifier for a resource location
-        *
-        * @param string $tablename
-        * @param int $uid
-        * @return mixed the unique identifier
-        */
-       public function getIdentifierForResourceLocation($tablename, $uid) {
-               $hash = $tablename . '_' . $uid;
-               if (!isset($this->tablenameUidMap[$hash])) {
-                       $this->loadEntryByTablenameAndUid($tablename, $uid);
-               }
-               return $this->tablenameUidMap[$hash];
-       }
-
-       /**
-        * Loads an entry for a given uuid
-        *
-        * @param       string  identifier
-        * @return      void
-        * @throws      InvalidArgumentException        Throws an exception if the given namespace is not valid
-        */
-       protected function loadEntryByUUID($uuid) {
-               $identityField = $this->configuration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-               $this->validateIdentifier($uuid);
-               $row = $this->db->exec_SELECTgetSingleRow(
-                       'foreign_tablename, foreign_uid',
-                       $this->identityTable,
-                       $identityField . ' = ' . $this->db->fullQuoteStr($uuid, $this->identityTable)
-               );
-               if ($row) {
-                       $this->addToCache($uuid, $row['foreign_tablename'], $row['foreign_uid']);
-               }
-       }
-
-       /**
-        * Loads an entry for a given uuid
-        *
-        * @param       string  identifier
-        * @return      void
-        * @throws      InvalidArgumentException        Throws an exception if the given tablename or uid is not valid
-        */
-       protected function loadEntryByTablenameAndUid($tablename, $uid) {
-               $identityField = $this->configuration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-               t3lib_div::loadTCA($tablename);
-               if (!isset($GLOBALS['TCA'][$tablename])) {
-                       throw new InvalidArgumentException('The tablename "' . $tablename . '" is not defined in the TCA.', 1299082184);
-               }
-               if ($this->version < 4006000) {
-                       $invalidUid = !t3lib_div::testInt($uid);
-               } else {
-                       $invalidUid = !t3lib_utility_Math::canBeInterpretedAsInteger($uid);
-               }
-               if ($invalidUid) {
-                       throw new InvalidArgumentException('The uid "' . $uid . '" is not an integer.', 1299082236);
-               }
-               $row = $this->db->exec_SELECTgetSingleRow(
-                       $identityField,
-                       $this->identityTable,
-                               'foreign_tablename = ' . $this->db->fullQuoteStr($tablename, $this->identityTable) . 'AND' .
-                               'foreign_uid = ' . $this->db->fullQuoteStr($uid, $this->identityTable)
-               );
-               if (!$row) {
-                       // Fallback if not in identity table
-                       $row = $this->db->exec_SELECTgetSingleRow(
-                               $identityField,
-                               $tablename,
-                                       'uid = ' . $this->db->fullQuoteStr($uid, $tablename)
-                       );
-                       if ($row) {
-                               $this->insertQueue[$row[$identityField]] = array(
-                                       $identityField => $row[$identityField],
-                                       'foreign_tablename' => $tablename,
-                                       'foreign_uid' => $uid
-                               );
-                       }
-               }
-               if ($row) {
-                       $this->addToCache($row[$identityField], $tablename, $uid);
-               }
-       }
-
-       /**
-        * Requests a new identifier for a resource location
-        *
-        * @param string $tablename
-        * @return mixed
-        */
-       public function getIdentifierForNewResourceLocation($tablename) {
-               $identityField = $this->configuration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-               $uuid = Tx_Identity_Utility_Algorithms::generateUUID();
-               t3lib_div::loadTCA($tablename);
-               if (isset($GLOBALS['TCA'][$tablename])) {
-                       $this->insertQueue[$uuid] = array(
-                               $identityField => $uuid,
-                               'foreign_tablename' => $tablename,
-                       );
-                       return $uuid;
-               }
-               return null;
-       }
-
-       /**
-        * Adds a uuid, tablename, uid triple to the local object cache
-        *
-        * @param string $uuid
-        * @param string $tablename
-        * @param int $uid
-        * @return void
-        */
-       protected function addToCache($uuid, $tablename, $uid) {
-               if ($uuid && $tablename && $uid) {
-                       $this->uuidMap[$uuid] = array(
-                               'tablename' => $tablename,
-                               'uid' => $uid,
-                       );
-                       $hash = $tablename . '_' . $uid;
-                       $this->tablenameUidMap[$hash] = $uuid;
-               }
-       }
-
-       /**
-        * Removes a uuid, tablename, uid triple from the local object cache
-        *
-        * @param string $uuid
-        * @param string $tablename
-        * @param int $uid
-        * @return void
-        */
-       protected function removeFromCache($uuid, $tablename, $uid) {
-               if ($uuid && $tablename && $uid) {
-                       unset($this->uuidMap[$uuid]);
-                       $hash = $tablename . '_' . $uid;
-                       unset($this->tablenameUidMap[$hash]);
-               }
-       }
-
-       /**
-        * Flushes the internal uuid caches and frees memory
-        */
-       protected function flushCache() {
-               $this->uuidMap = array();
-               $this->tablenameUidMap = array();
-       }
-
-       /**
-        * Unregisters an uuid triple
-        *
-        * @param       string  identifier
-        * @param       string  The key of the entry to unset.
-        * @return      void
-        * @throws      InvalidArgumentException        Throws an exception if the given namespace is not valid
-        */
-       protected function unregisterUUID($uuid, $tablename, $uid) {
-               $identityField = $this->configuration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-               $this->validateIdentifier($uuid);
-               t3lib_div::loadTCA($tablename);
-               if ($this->version < 4006000) {
-                       $validUid = t3lib_div::testInt($uid);
-               } else {
-                       $validUid = t3lib_utility_Math::canBeInterpretedAsInteger($uid);
-               }
-               if ($validUid) {
-                       if (isset($this->insertQueue[$uuid])) {
-                               unset($this->insertQueue[$uuid]);
-                       }
-                       $this->deleteQueue[$uuid] = array(
-                               $identityField => $uuid,
-                               'foreign_tablename' => $tablename,
-                               'foreign_uid' => $uid
-                       );
-                       $this->removeFromCache($uuid, $tablename, $uid);
-               }
-       }
-
-       /**
-        * Rebuilds the registry
-        */
-       public function rebuild() {
-               $this->insertMissingUUIDs();
-               $this->removeNeedlessUUIDs();
-               $this->registerUnregisteredUUIDs();
-       }
-
-       /**
-        * Walks through all tables and inserts an uuid to a record that has any
-        */
-       protected function insertMissingUUIDs() {
-               $identityField = $this->configuration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-               foreach ($GLOBALS['TCA'] as $tablename => $configuration) {
-                       $rows = $this->db->exec_SELECTgetRows('uid', $tablename, $identityField . " LIKE ''");
-                       if (count($rows)) {
-                               foreach ($rows as &$row) {
-                                       $uuid = Tx_Identity_Utility_Algorithms::generateUUID();
-                                       $this->db->exec_UPDATEquery($tablename, 'uid = ' . $row['uid'], array($identityField => $uuid));
-                                       $this->insertQueue[$uuid] = array(
-                                               $identityField => $uuid,
-                                               'foreign_tablename' => $tablename,
-                                               'foreign_uid' => $row['uid']
-                                       );
-                                       $this->addToCache($uuid, $tablename, $row['uid']);
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Walks through all tables and registers uuids of records with uuid not stored in the registry
-        */
-       protected function registerUnregisteredUUIDs() {
-               $identityField = $this->configuration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-               foreach ($GLOBALS['TCA'] as $tablename => $configuration) {
-                       $rows = $this->db->exec_SELECTgetRows(
-                               $tablename . '.' . $identityField . ', ' . $tablename . '.uid',
-                                       $this->identityTable . ' RIGHT JOIN ' . $tablename . ' ON ' . $this->identityTable . '.' . $identityField . ' = ' . $tablename . '.' . $identityField,
-                                       $this->identityTable . '.uid IS NULL'
-                       );
-                       foreach ($rows as $row) {
-                               $this->insertQueue[$row[$identityField]] = array(
-                                       $identityField => $row[$identityField],
-                                       'foreign_tablename' => $tablename,
-                                       'foreign_uid' => $row['uid']
-                               );
-                               $this->addToCache($row[$identityField], $tablename, $row['uid']);
-                       }
-               }
-       }
-
-       /**
-        * Walks through all tables and unregisters all uuid mappings that have no target
-        */
-       protected function removeNeedlessUUIDs() {
-               $identityField = $this->configuration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-               $tablenames = $this->db->exec_SELECTgetRows(
-                       $this->identityTable . '.foreign_tablename',
-                       $this->identityTable,
-                       '',
-                       $this->identityTable . '.foreign_tablename',
-                       '',
-                       '',
-                       'foreign_tablename'
-               );
-               if (is_array($tablenames) && !empty($tablenames)) {
-                       foreach (array_keys($tablenames) as $tablename) {
-                               if ($this->isApplicable($tablename)) {
-                                       $rows = $this->db->exec_SELECTgetRows(
-                                               $this->identityTable . '.' . $identityField . ', ' . $this->identityTable . '.foreign_uid',
-                                               $tablename . ' RIGHT JOIN ' . $this->identityTable . ' ON ' .
-                                               $this->identityTable . '.' . $identityField .
-                                               ' = ' .
-                                               $tablename . '.' . $identityField . ' AND ' . $this->identityTable . '.foreign_uid = ' . $tablename . '.uid',
-                                               'foreign_tablename LIKE \'' . $tablename . '\' AND ' . $tablename . '.uid IS NULL'
-                                       );
-                               } else {
-                                       // Not applicable means, delete all in registry regarding this tablename
-                                       $rows = $this->db->exec_SELECTgetRows(
-                                               $this->identityTable . '.' . $identityField . ', ' . $this->identityTable . '.foreign_uid',
-                                               $this->identityTable,
-                                               'foreign_tablename LIKE \'' . $tablename . '\''
-                                       );
-                               }
-                               if (is_array($rows)) {
-                                       foreach ($rows as $row) {
-                                               $this->unregisterUUID($row[$identityField], $tablename, $row['foreign_uid']);
-                                       }
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Check the insert queue for incomplete record locations (lastInsertId for example)
-        */
-       protected function completeInsertQueue() {
-               $identityField = $this->configuration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-               foreach ($this->insertQueue as $uuid => $recordLocation) {
-                       $newRecordLocation = array();
-                       if (isset($recordLocation[$identityField])) {
-                               $newRecordLocation[$identityField] = $recordLocation[$identityField];
-                       }
-                       if (isset($recordLocation['foreign_tablename'])) {
-                               $newRecordLocation['foreign_tablename'] = $recordLocation['foreign_tablename'];
-                       }
-                       if (!isset($recordLocation['foreign_uid'])) {
-                               $foreignUidRecord = $this->db->exec_SELECTgetSingleRow('uid', $recordLocation['foreign_tablename'], $identityField . ' LIKE \'' . $recordLocation[$identityField] . '\'');
-                               if (isset($foreignUidRecord['uid'])) {
-                                       $newRecordLocation['foreign_uid'] = $foreignUidRecord['uid'];
-                               }
-                       } else {
-                               $newRecordLocation['foreign_uid'] = $recordLocation['foreign_uid'];
-                       }
-                       if (isset($newRecordLocation[$identityField]) && isset($newRecordLocation['foreign_tablename']) && isset($newRecordLocation['foreign_uid'])) {
-                               $this->insertQueue[$uuid] = $newRecordLocation;
-                       } else {
-                               unset($this->insertQueue[$uuid]);
-                       }
-               }
-       }
-
-       /**
-        * Persist the registry to the database
-        */
-       public function commit() {
-               $identityField = $this->configuration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-               $this->completeInsertQueue();
-               if (count($this->insertQueue)) {
-                       $this->db->exec_INSERTmultipleRows(
-                               $this->identityTable,
-                               array_keys(current($this->insertQueue)),
-                               $this->insertQueue
-                       );
-                       $this->insertQueue = array();
-               }
-               if (count($this->deleteQueue)) {
-                       if (count($this->deleteQueue)) {
-                               foreach ($this->deleteQueue as $deletableEntries) {
-                                       $this->db->exec_DELETEquery(
-                                               $this->identityTable,
-                                               $identityField . ' = ' . $this->db->fullQuoteStr($deletableEntries[$identityField], $this->identityTable)
-                                               . ' OR ( foreign_tablename = ' . $this->db->fullQuoteStr($deletableEntries['tablename'], $this->identityTable) . ' AND '
-                                               . ' foreign_uid = ' . $this->db->fullQuoteStr($deletableEntries['uid'], $this->identityTable) . ')'
-                                       );
-                               }
-                               $this->deleteQueue = array();
-                       }
-               }
-               $this->flushCache();
-       }
-
-}
\ No newline at end of file
diff --git a/Classes/Provider/AbstractUuidProvider.php b/Classes/Provider/AbstractUuidProvider.php
new file mode 100644 (file)
index 0000000..142f73a
--- /dev/null
@@ -0,0 +1,481 @@
+<?php
+namespace Maroschik\Identity\Provider;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+use Maroschik\Identity\Configuration\IdentityProviderConfigurationInterface as ProviderConfiguration;
+
+/**
+ * This class is the abstract implementation for a uuid identity provide
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ */
+class AbstractUuidProvider implements \Maroschik\Identity\Provider\ProviderInterface {
+
+       /**
+        * @var string
+        */
+       protected $providerKey;
+
+       /**
+        * @var string
+        */
+       protected $identityTable = 'sys_identity';
+
+       /**
+        * @var array
+        */
+       protected $configuration = array();
+
+       /**
+        * @var array
+        */
+       protected $isApplicableCache = array();
+
+       /**
+        * @var \TYPO3\CMS\Core\Database\DatabaseConnection
+        */
+       protected $db;
+
+       /**
+        * @var    array
+        */
+       protected $uuidMap = array();
+
+       /**
+        * @var    array
+        */
+       protected $tablenameUidMap = array();
+
+       /**
+        * @var array
+        */
+       protected $insertQueue = array();
+
+       /**
+        * @var array
+        */
+       protected $deleteQueue = array();
+
+       /**
+        * Sets the provider key
+        * @param string $providerKey
+        */
+       public function __construct($providerKey) {
+               $this->providerKey = $providerKey;
+       }
+
+       /**
+        * Injector method for the providers configuration
+        *
+        * @param array $configuration
+        */
+       public function injectConfiguration(array $configuration) {
+               $this->configuration = $configuration;
+       }
+
+       /**
+        * Injector method for a \TYPO3\CMS\Dbal\Database\DatabaseConnection
+        *
+        * @param \TYPO3\CMS\Dbal\Database\DatabaseConnection $databaseConnection
+        */
+       public function injectDatabaseConnection(\TYPO3\CMS\Core\Database\DatabaseConnection $databaseConnection) {
+               $this->db = $databaseConnection;
+       }
+
+       /**
+        * Checks the given UUID. If it does not have a valid format an
+        * exception is thrown.
+        *
+        * @param string $identifier
+        * @return bool
+        * @throws \InvalidArgumentException    Throws an exception if the given uuid is not valid
+        */
+       public function validateIdentifier($identifier) {
+               if (!strlen($identifier)) {
+                       throw new \InvalidArgumentException('Empty UUID given.', 1299013185);
+               }
+               if (function_exists('uuid_is_valid') && !uuid_is_valid($identifier)) {
+                       throw new \InvalidArgumentException('Given UUID does not match the UUID pattern.', 1299013329);
+               }
+               if (strlen($identifier) !== 36) {
+                       throw new \InvalidArgumentException('Lenghth of UUID has to be 36 characters.', 1299013335);
+               }
+               $pattern = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i';
+               if (!preg_match($pattern, $identifier)) {
+                       throw new \InvalidArgumentException('Given UUID does not match the UUID pattern.', 1299013339);
+               }
+               return TRUE;
+       }
+
+       /**
+        * @param string $tablename
+        * @return bool
+        */
+       public function isApplicable($tablename) {
+               if (isset($this->isApplicableCache[$tablename])) {
+                       return $this->isApplicableCache[$tablename];
+               }
+               if (isset($GLOBALS['TCA']) && is_array($GLOBALS['TCA']) && in_array($tablename, array_keys($GLOBALS['TCA']))) {
+                       $identityField = $this->configuration[ProviderConfiguration::IDENTITY_FIELD];
+                       if ($identityField) {
+                               $this->isApplicableCache[$tablename] = TRUE;
+                               return $this->isApplicableCache[$tablename];
+                       }
+               }
+               $this->isApplicableCache[$tablename] = FALSE;
+               return $this->isApplicableCache[$tablename];
+       }
+
+       /**
+        * Returns a resource location for an identifier
+        *
+        * @param mixed $identifier
+        * @return array [tablename, uid] the resource location
+        */
+       public function getResourceLocationForIdentifier($uuid) {
+               if (!isset($this->uuidMap[$uuid])) {
+                       $this->loadEntryByUUID($uuid);
+               }
+               return $this->uuidMap[$uuid];
+       }
+
+       /**
+        * Returns a unique identifier for a resource location
+        *
+        * @param string $tablename
+        * @param int $uid
+        * @return mixed the unique identifier
+        */
+       public function getIdentifierForResourceLocation($tablename, $uid) {
+               $hash = $tablename . '_' . $uid;
+               if (!isset($this->tablenameUidMap[$hash])) {
+                       $this->loadEntryByTablenameAndUid($tablename, $uid);
+               }
+               return $this->tablenameUidMap[$hash];
+       }
+
+       /**
+        * Loads an entry for a given uuid
+        *
+        * @param string $$uuid
+        */
+       protected function loadEntryByUUID($uuid) {
+               $identityField = $this->configuration[ProviderConfiguration::IDENTITY_FIELD];
+               $this->validateIdentifier($uuid);
+               $row = $this->db->exec_SELECTgetSingleRow(
+                       'foreign_tablename, foreign_uid',
+                       $this->identityTable,
+                               $identityField . ' = ' . $this->db->fullQuoteStr($uuid, $this->identityTable)
+               );
+               if ($row) {
+                       $this->addToCache($uuid, $row['foreign_tablename'], $row['foreign_uid']);
+               }
+       }
+
+       /**
+        * Loads an entry for a given uuid
+        *
+        * @param string $tablename
+        * @param mixed $uid
+        * @throws \InvalidArgumentException Throws an exception if the given tablename or uid is not valid
+        */
+       protected function loadEntryByTablenameAndUid($tablename, $uid) {
+               $identityField = $this->configuration[ProviderConfiguration::IDENTITY_FIELD];
+               if (!isset($GLOBALS['TCA'][$tablename])) {
+                       throw new \InvalidArgumentException('The tablename "' . $tablename . '" is not defined in the TCA.', 1299082184);
+               }
+
+               if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($uid)) {
+                       throw new \InvalidArgumentException('The uid "' . $uid . '" is not an integer.', 1299082236);
+               }
+               $row = $this->db->exec_SELECTgetSingleRow(
+                       $identityField,
+                       $this->identityTable,
+                               'foreign_tablename = ' . $this->db->fullQuoteStr($tablename, $this->identityTable) . 'AND' .
+                               'foreign_uid = ' . $this->db->fullQuoteStr($uid, $this->identityTable)
+               );
+               if (!$row) {
+                       // Fallback if not in identity table
+                       $row = $this->db->exec_SELECTgetSingleRow(
+                               $identityField,
+                               $tablename,
+                                       'uid = ' . $this->db->fullQuoteStr($uid, $tablename)
+                       );
+                       if ($row) {
+                               $this->insertQueue[$row[$identityField]] = array(
+                                       $identityField => $row[$identityField],
+                                       'foreign_tablename' => $tablename,
+                                       'foreign_uid' => $uid
+                               );
+                       }
+               }
+               if ($row) {
+                       $this->addToCache($row[$identityField], $tablename, $uid);
+               }
+       }
+
+       /**
+        * Requests a new identifier for a resource location
+        *
+        * @param string $tablename
+        * @return mixed
+        */
+       public function getIdentifierForNewResourceLocation($tablename) {
+               $identityField = $this->configuration[ProviderConfiguration::IDENTITY_FIELD];
+               $uuid = \Maroschik\Identity\Utility\Algorithms::generateUUID();
+               if (isset($GLOBALS['TCA'][$tablename])) {
+                       $this->insertQueue[$uuid] = array(
+                               $identityField => $uuid,
+                               'foreign_tablename' => $tablename,
+                       );
+                       return $uuid;
+               }
+               return NULL;
+       }
+
+       /**
+        * Adds a uuid, tablename, uid triple to the local object cache
+        *
+        * @param string $uuid
+        * @param string $tablename
+        * @param int $uid
+        */
+       protected function addToCache($uuid, $tablename, $uid) {
+               if ($uuid && $tablename && $uid) {
+                       $this->uuidMap[$uuid] = array(
+                               'tablename' => $tablename,
+                               'uid' => $uid,
+                       );
+                       $hash = $tablename . '_' . $uid;
+                       $this->tablenameUidMap[$hash] = $uuid;
+               }
+       }
+
+       /**
+        * Removes a uuid, tablename, uid triple from the local object cache
+        *
+        * @param string $uuid
+        * @param string $tablename
+        * @param int $uid
+        */
+       protected function removeFromCache($uuid, $tablename, $uid) {
+               if ($uuid && $tablename && $uid) {
+                       unset($this->uuidMap[$uuid]);
+                       $hash = $tablename . '_' . $uid;
+                       unset($this->tablenameUidMap[$hash]);
+               }
+       }
+
+       /**
+        * Flushes the internal uuid caches and frees memory
+        */
+       protected function flushCache() {
+               $this->uuidMap = array();
+               $this->tablenameUidMap = array();
+       }
+
+       /**
+        * Unregisters an uuid triple
+        *
+        * @param string $uuid
+        * @param string $tablename
+        * @param mixed $uid
+        */
+       protected function unregisterUUID($uuid, $tablename, $uid) {
+               $identityField = $this->configuration[ProviderConfiguration::IDENTITY_FIELD];
+               $this->validateIdentifier($uuid);
+               $validUid = \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($uid);
+               if ($validUid) {
+                       if (isset($this->insertQueue[$uuid])) {
+                               unset($this->insertQueue[$uuid]);
+                       }
+                       $this->deleteQueue[$uuid] = array(
+                               $identityField => $uuid,
+                               'foreign_tablename' => $tablename,
+                               'foreign_uid' => $uid
+                       );
+                       $this->removeFromCache($uuid, $tablename, $uid);
+               }
+       }
+
+       /**
+        * Rebuilds the registry
+        */
+       public function rebuild() {
+               $this->insertMissingUUIDs();
+               $this->removeNeedlessUUIDs();
+               $this->registerUnregisteredUUIDs();
+       }
+
+       /**
+        * Walks through all tables and inserts an uuid to a record that has any
+        */
+       protected function insertMissingUUIDs() {
+               $identityField = $this->configuration[ProviderConfiguration::IDENTITY_FIELD];
+               foreach ($GLOBALS['TCA'] as $tablename => $configuration) {
+                       $rows = $this->db->exec_SELECTgetRows('uid', $tablename, $identityField . " LIKE ''");
+                       if (count($rows)) {
+                               foreach ($rows as &$row) {
+                                       $uuid = \Maroschik\Identity\Utility\Algorithms::generateUUID();
+                                       $this->db->exec_UPDATEquery($tablename, 'uid = ' . $row['uid'], array($identityField => $uuid));
+                                       $this->insertQueue[$uuid] = array(
+                                               $identityField => $uuid,
+                                               'foreign_tablename' => $tablename,
+                                               'foreign_uid' => $row['uid']
+                                       );
+                                       $this->addToCache($uuid, $tablename, $row['uid']);
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Walks through all tables and registers uuids of records with uuid not stored in the registry
+        */
+       protected function registerUnregisteredUUIDs() {
+               $identityField = $this->configuration[ProviderConfiguration::IDENTITY_FIELD];
+               foreach ($GLOBALS['TCA'] as $tablename => $configuration) {
+                       $rows = $this->db->exec_SELECTgetRows(
+                               $tablename . '.' . $identityField . ', ' . $tablename . '.uid',
+                                       $this->identityTable . ' RIGHT JOIN ' . $tablename . ' ON ' . $this->identityTable . '.' . $identityField . ' = ' . $tablename . '.' . $identityField,
+                                       $this->identityTable . '.uid IS NULL'
+                       );
+                       foreach ($rows as $row) {
+                               $this->insertQueue[$row[$identityField]] = array(
+                                       $identityField => $row[$identityField],
+                                       'foreign_tablename' => $tablename,
+                                       'foreign_uid' => $row['uid']
+                               );
+                               $this->addToCache($row[$identityField], $tablename, $row['uid']);
+                       }
+               }
+       }
+
+       /**
+        * Walks through all tables and unregisters all uuid mappings that have no target
+        */
+       protected function removeNeedlessUUIDs() {
+               $identityField = $this->configuration[ProviderConfiguration::IDENTITY_FIELD];
+               $tablenames = $this->db->exec_SELECTgetRows(
+                       $this->identityTable . '.foreign_tablename',
+                       $this->identityTable,
+                       '',
+                               $this->identityTable . '.foreign_tablename',
+                       '',
+                       '',
+                       'foreign_tablename'
+               );
+               if (is_array($tablenames) && !empty($tablenames)) {
+                       foreach (array_keys($tablenames) as $tablename) {
+                               if ($this->isApplicable($tablename)) {
+                                       $rows = $this->db->exec_SELECTgetRows(
+                                               $this->identityTable . '.' . $identityField . ', ' . $this->identityTable . '.foreign_uid',
+                                                       $tablename . ' RIGHT JOIN ' . $this->identityTable . ' ON ' .
+                                                       $this->identityTable . '.' . $identityField .
+                                                       ' = ' .
+                                                       $tablename . '.' . $identityField . ' AND ' . $this->identityTable . '.foreign_uid = ' . $tablename . '.uid',
+                                                       'foreign_tablename LIKE \'' . $tablename . '\' AND ' . $tablename . '.uid IS NULL'
+                                       );
+                               } else {
+                                       // Not applicable means, delete all in registry regarding this tablename
+                                       $rows = $this->db->exec_SELECTgetRows(
+                                               $this->identityTable . '.' . $identityField . ', ' . $this->identityTable . '.foreign_uid',
+                                               $this->identityTable,
+                                                       'foreign_tablename LIKE \'' . $tablename . '\''
+                                       );
+                               }
+                               if (is_array($rows)) {
+                                       foreach ($rows as $row) {
+                                               $this->unregisterUUID($row[$identityField], $tablename, $row['foreign_uid']);
+                                       }
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Check the insert queue for incomplete record locations (lastInsertId for example)
+        */
+       protected function completeInsertQueue() {
+               $identityField = $this->configuration[ProviderConfiguration::IDENTITY_FIELD];
+               foreach ($this->insertQueue as $uuid => $recordLocation) {
+                       $newRecordLocation = array();
+                       if (isset($recordLocation[$identityField])) {
+                               $newRecordLocation[$identityField] = $recordLocation[$identityField];
+                       }
+                       if (isset($recordLocation['foreign_tablename'])) {
+                               $newRecordLocation['foreign_tablename'] = $recordLocation['foreign_tablename'];
+                       }
+                       if (!isset($recordLocation['foreign_uid'])) {
+                               $foreignUidRecord = $this->db->exec_SELECTgetSingleRow('uid', $recordLocation['foreign_tablename'], $identityField . ' LIKE \'' . $recordLocation[$identityField] . '\'');
+                               if (isset($foreignUidRecord['uid'])) {
+                                       $newRecordLocation['foreign_uid'] = $foreignUidRecord['uid'];
+                               }
+                       } else {
+                               $newRecordLocation['foreign_uid'] = $recordLocation['foreign_uid'];
+                       }
+                       if (isset($newRecordLocation[$identityField]) && isset($newRecordLocation['foreign_tablename']) && isset($newRecordLocation['foreign_uid'])) {
+                               $this->insertQueue[$uuid] = $newRecordLocation;
+                       } else {
+                               unset($this->insertQueue[$uuid]);
+                       }
+               }
+       }
+
+       /**
+        * Persist the registry to the database
+        */
+       public function commit() {
+               $identityField = $this->configuration[ProviderConfiguration::IDENTITY_FIELD];
+               $this->completeInsertQueue();
+               if (count($this->insertQueue)) {
+                       $this->db->exec_INSERTmultipleRows(
+                               $this->identityTable,
+                               array_keys(current($this->insertQueue)),
+                               $this->insertQueue
+                       );
+                       $this->insertQueue = array();
+               }
+               if (count($this->deleteQueue)) {
+                       if (count($this->deleteQueue)) {
+                               foreach ($this->deleteQueue as $deletableEntries) {
+                                       $this->db->exec_DELETEquery(
+                                               $this->identityTable,
+                                                       $identityField . ' = ' . $this->db->fullQuoteStr($deletableEntries[$identityField], $this->identityTable)
+                                                       . ' OR ( foreign_tablename = ' . $this->db->fullQuoteStr($deletableEntries['tablename'], $this->identityTable) . ' AND '
+                                                       . ' foreign_uid = ' . $this->db->fullQuoteStr($deletableEntries['uid'], $this->identityTable) . ')'
+                                       );
+                               }
+                               $this->deleteQueue = array();
+                       }
+               }
+               $this->flushCache();
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/Provider/ProviderInterface.php b/Classes/Provider/ProviderInterface.php
new file mode 100644 (file)
index 0000000..965f4f8
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+namespace Maroschik\Identity\Provider;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * This interface has to be implemented by every identity provider
+ * @api
+ */
+interface ProviderInterface {
+
+       /**
+        * Sets the provider key on the provider
+        *
+        * @param string $providerKey
+        */
+       public function __construct($providerKey);
+
+       /**
+        * Validates the identifier
+        *
+        * @param mixed $identifier
+        */
+       public function validateIdentifier($identifier);
+
+       /**
+        * Checks if this provider is applicable to the table
+        *
+        * @param string $tablename
+        * @return bool
+        */
+       public function isApplicable($tablename);
+
+       /**
+        * Returns a unique identifier for a resource location
+        *
+        * @param string $tablename
+        * @param int $uid
+        * @return mixed the unique identifier
+        */
+       public function getIdentifierForResourceLocation($tablename, $uid);
+
+       /**
+        * Requests a new identifier for a resource location
+        *
+        * @param string $tablename
+        * @return mixed
+        */
+       public function getIdentifierForNewResourceLocation($tablename);
+
+       /**
+        * Returns a resource location for an identifier
+        *
+        * @param mixed $identifier
+        * @return array [tablename, uid] the resource location
+        */
+       public function getResourceLocationForIdentifier($identifier);
+
+}
\ No newline at end of file
diff --git a/Classes/Provider/RecordUuid.php b/Classes/Provider/RecordUuid.php
deleted file mode 100644 (file)
index 2ea486f..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class is the concrete implementation of the abstract uuid class for all non static records
- *
- * @author Thomas Maroschik <tmaroschik@dfau.de>
- *
- * @package TYPO3
- * @subpackage identity
- */
-class Tx_Identity_Provider_RecordUuid extends Tx_Identity_Provider_AbstractUuid {
-
-}
\ No newline at end of file
diff --git a/Classes/Provider/RecordUuidProvider.php b/Classes/Provider/RecordUuidProvider.php
new file mode 100644 (file)
index 0000000..3f3ce7f
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+namespace Maroschik\Identity\Provider;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * This class is the concrete implementation of the abstract uuid class for all non static records
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ */
+class RecordUuidProvider extends AbstractUuidProvider {
+
+}
\ No newline at end of file
diff --git a/Classes/Provider/StaticRecordUuid.php b/Classes/Provider/StaticRecordUuid.php
deleted file mode 100644 (file)
index d8542d0..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class is the concrete implementation of the abstract uuid class for all static records
- *
- * @author Thomas Maroschik <tmaroschik@dfau.de>
- *
- * @package TYPO3
- * @subpackage identity
- */
-class Tx_Identity_Provider_StaticRecordUuid extends Tx_Identity_Provider_AbstractUuid {
-
-       /**
-        * Rebuilds the registry
-        */
-       public function rebuild() {
-               $this->insertMissingUUIDs();
-       }
-
-       /**
-        * Walks through all tables and inserts an uuid to a record that has any
-        */
-       protected function insertMissingUUIDs() {
-               $identityField =  $this->configuration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-               foreach ($GLOBALS['TCA'] as $tablename=>$configuration) {
-                       $rows = $this->db->exec_SELECTgetRows('uid', $tablename, $identityField . " LIKE ''");
-                       if (count($rows)) {
-                               foreach ($rows as &$row) {
-                                       $uuid = Tx_Identity_Utility_Algorithms::generateUUIDforStaticTable($tablename, $row['uid']);
-                                       $this->db->exec_UPDATEquery($tablename, 'uid = ' .$row['uid'], array($identityField => $uuid));
-                                       $this->insertQueue[$uuid] = array(
-                                                $identityField => $uuid,
-                                                'foreign_tablename' => $tablename,
-                                                'foreign_uid' => $row['uid']
-                                       );
-                                       $this->addToCache($uuid, $tablename, $row['uid']);
-                               }
-                       }
-               }
-       }
-
-}
\ No newline at end of file
diff --git a/Classes/Provider/StaticRecordUuidProvider.php b/Classes/Provider/StaticRecordUuidProvider.php
new file mode 100644 (file)
index 0000000..bcc0584
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+namespace Maroschik\Identity\Provider;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+use Maroschik\Identity\Configuration\IdentityProviderConfigurationInterface as ProviderConfiguration;
+
+/**
+ * This class is the concrete implementation of the abstract uuid class for all static records
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ */
+class StaticRecordUuidProvider extends AbstractUuidProvider {
+
+       /**
+        * Rebuilds the registry
+        */
+       public function rebuild() {
+               $this->insertMissingUUIDs();
+       }
+
+       /**
+        * Walks through all tables and inserts an uuid to a record that has any
+        */
+       protected function insertMissingUUIDs() {
+               $identityField =  $this->configuration[ProviderConfiguration::IDENTITY_FIELD];
+               foreach ($GLOBALS['TCA'] as $tablename=>$configuration) {
+                       $rows = $this->db->exec_SELECTgetRows('uid', $tablename, $identityField . " LIKE ''");
+                       if (count($rows)) {
+                               foreach ($rows as &$row) {
+                                       $uuid = \Maroschik\Identity\Utility\Algorithms::generateUUIDforStaticTable($tablename, $row['uid']);
+                                       $this->db->exec_UPDATEquery($tablename, 'uid = ' .$row['uid'], array($identityField => $uuid));
+                                       $this->insertQueue[$uuid] = array(
+                                                $identityField => $uuid,
+                                                'foreign_tablename' => $tablename,
+                                                'foreign_uid' => $row['uid']
+                                       );
+                                       $this->addToCache($uuid, $tablename, $row['uid']);
+                               }
+                       }
+               }
+       }
+
+}
\ No newline at end of file
diff --git a/Classes/ProviderInterface.php b/Classes/ProviderInterface.php
deleted file mode 100644 (file)
index c613030..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
- *
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * This interface has to be implemented by every identity provider
- * @api
- */
-interface Tx_Identity_ProviderInterface {
-
-       /**
-        * Sets the provider key on the provider
-        *
-        * @param string $providerKey
-        */
-       public function __construct($providerKey);
-
-       /**
-        * Validates the identifier
-        *
-        * @param mixed $identifier
-        */
-       public function validateIdentifier($identifier);
-
-       /**
-        * Checks if this provider is applicable to the table
-        *
-        * @param string $tablename
-        * @return bool
-        */
-       public function isApplicable($tablename);
-
-       /**
-        * Returns a unique identifier for a resource location
-        *
-        * @param string $tablename
-        * @param int $uid
-        * @return mixed the unique identifier
-        */
-       public function getIdentifierForResourceLocation($tablename, $uid);
-
-       /**
-        * Requests a new identifier for a resource location
-        *
-        * @param string $tablename
-        * @return mixed
-        */
-       public function getIdentifierForNewResourceLocation($tablename);
-
-       /**
-        * Returns a resource location for an identifier
-        *
-        * @param mixed $identifier
-        * @return array [tablename, uid] the resource location
-        */
-       public function getResourceLocationForIdentifier($identifier);
-
-}
\ No newline at end of file
index 13fa549..b33091d 100644 (file)
@@ -1,8 +1,10 @@
 <?php
+namespace Maroschik\Identity\Tasks;
+
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2010 Christian Kuhn <lolli@schwarzbu.ch>
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
  * Rebuilds the identity map
  *
  * @author Thomas Maroschik <tmaroschik@dfau.de>
- *
- * @package TYPO3
- * @subpackage identity
  */
-class Tx_Identity_Tasks_RebuildTask extends tx_scheduler_Task {
+class RebuildTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask {
 
        /**
         * Public method, usually called by scheduler.
@@ -38,8 +37,8 @@ class Tx_Identity_Tasks_RebuildTask extends tx_scheduler_Task {
         * @return boolean TRUE on success
         */
        public function execute() {
-               /** @var $identityMap Tx_Identity_Map */
-               $identityMap = t3lib_div::makeInstance('Tx_Identity_Map');
+               /** @var $identityMap \Maroschik\Identity\IdentityMap */
+               $identityMap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Maroschik\Identity\IdentityMap');
                $identityMap->rebuild();
                $identityMap->commit();
                return (TRUE);
index 813e03a..5120292 100644 (file)
@@ -1,8 +1,10 @@
 <?php
+namespace Maroschik\Identity\Utility;
+
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
  *  All rights reserved
  *
  *  This class is a backport of the corresponding class of FLOW3.
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * A utility class for various algorithms.
  *
  * @author Thomas Maroschik <tmaroschik@dfau.de>
- *
- * @package TYPO3
- * @subpackage identity
  */
-class Tx_Identity_Utility_Algorithms {
+class Algorithms {
 
        const TYPO3ORG_UUID = 'c4e6860b-3993-54a9-9c8b-f9bf558b0a77';
 
@@ -60,26 +60,27 @@ class Tx_Identity_Utility_Algorithms {
 
        /**
         * Generates a universally unique identifier (UUID) according to RFC 4122 for static tables.
+        *
         * @param string $tablename
-        * @param int $uid
-        * @return string The universally unique id
-        * @author Thomas Maroschik <tmaroschik@dfau.de>
-        * @throws
+        * @param mixed $uid
+        * @return string
+        * @throws \InvalidArgumentException
         */
        static public function generateUUIDforStaticTable($tablename, $uid) {
                if (!isset($GLOBALS['TCA'][$tablename]['ctrl']['is_static']) && !$GLOBALS['TCA'][$tablename]['ctrl']['is_static']) {
-                       throw new InvalidArgumentException('The given tablename "' . $tablename . '" is not defined as is_static in TCA.', 1299074512);
+                       throw new \InvalidArgumentException('The given tablename "' . $tablename . '" is not defined as is_static in TCA.', 1299074512);
                }
                return self::generateUUIDv5(self::TYPO3ORG_UUID, $tablename . '_' . $uid);
        }
 
        /**
         * Generate an universally unique identifier (UUID) according to RFC 4122 v5.
+        *
         * @param string $namespace
         * @param string $name
         * @author ranskills.com
         * @return string The unversally unique id
-        * @throws InvalidArgumentException Throws an invalid argument exception, if the given namespace is not an uuid
+        * @throws \InvalidArgumentException Throws an invalid argument exception, if the given namespace is not an uuid
         */
        static public function generateUUIDv5($namespace, $name) {
                // Get hexadecimal components of namespace
diff --git a/Classes/Utility/ExtensionManager.php b/Classes/Utility/ExtensionManager.php
deleted file mode 100644 (file)
index 74b8cc7..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Fabien Udriot <fabien.udriot@ecodev.ch>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class is responsible for the update message in extension manager.
- *
- * @author Fabien Udriot <fabien.udriot@ecodev.ch>
- *
- * @package TYPO3
- * @subpackage identity
- */
-class Tx_Identity_Utility_ExtensionManager {
-
-       /**
-        * Display a message to the Extension Manager whether the database needs to be updated or not.
-        *
-        * @return string the HTML message
-        */
-       public function displayMessage(&$params, &$tsObj) {
-               $out = '';
-               if ($this->needsUpdate()) {
-                       $out .= '
-                       <div style="">
-                               <div class="typo3-message message-warning">
-                                       <div class="message-header">'
-                                               . $GLOBALS['LANG']->sL('LLL:EXT:identity/Resources/Private/Language/locallang.xml:updater_header') .
-                                       '</div>
-                                       <div class="message-body">
-                                               ' . $GLOBALS['LANG']->sL('LLL:EXT:identity/Resources/Private/Language/locallang.xml:updater_message') . '
-                                               <a target="_blank"
-                                                       style="text-decoration:underline;"
-                                                       href="mod.php?&amp;id=0&amp;M=tools_em&amp;CMD[showExt]=identity&amp;SET[singleDetails]=updateModule">
-                                               ' . $GLOBALS['LANG']->sL('LLL:EXT:identity/Resources/Private/Language/locallang.xml:open_updater') . '</a>.
-                                       </div>
-                               </div>
-                       </div>
-                       ';
-               }
-               else {
-                       $out .= '
-                       <div style="">
-                               <div class="typo3-message message-ok">
-                                       <div class="message-header">'
-                                               . $GLOBALS['LANG']->sL('LLL:EXT:identity/Resources/Private/Language/locallang.xml:ok_header') .
-                                       '</div>
-                                       <div class="message-body">
-                                               ' . $GLOBALS['LANG']->sL('LLL:EXT:identity/Resources/Private/Language/locallang.xml:ok_message') . '
-                                       </div>
-                               </div>
-                       </div>
-                       ';
-               }
-               return $out;
-       }
-
-       /**
-        * Check the database and tells whether it needs update
-        *
-        * @return boolean
-        */
-       protected function needsUpdate() {
-               // instantiate a light installer
-               /* @var $installer Tx_Identity_Install_Installer */
-               $installer = t3lib_div::makeInstance('Tx_Identity_Install_Installer');
-               // load the SQL files
-               $tblFileContent = t3lib_div::getUrl(PATH_t3lib . 'stddb/tables.sql');
-               foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $loadedExtConf) {
-                       if (is_array($loadedExtConf) && $loadedExtConf['ext_tables.sql']) {
-                               $tblFileContent .= LF . LF . LF . LF . t3lib_div::getUrl($loadedExtConf['ext_tables.sql']);
-                       }
-               }
-               $fileContent = implode(LF, $installer->getStatementArray($tblFileContent, 1, '^CREATE TABLE '));
-               // get the table definitions
-               $tableDefinitions = $installer->getFieldDefinitions_fileContent($fileContent);
-               /** @var $fieldDefinitionsUtility Tx_Identity_Utility_FieldDefinitions */
-               $fieldDefinitionsUtility = t3lib_div::makeInstance('Tx_Identity_Utility_FieldDefinitions');
-               $tableDefinitions = $fieldDefinitionsUtility->insertIdentityColumn($tableDefinitions);
-               if (!count($tableDefinitions)) {
-                       die("Error: There were no 'CREATE TABLE' definitions in the provided file");
-               }
-               // get the current database definition
-               $FDdb = $installer->getFieldDefinitions_database();
-               // get a diff and check if a field uuid is missing somewhere
-               $diff = $installer->getDatabaseExtra($tableDefinitions, $FDdb);
-               $update_statements = $installer->getUpdateSuggestions($diff);
-               if (!isset($update_statements['add'])) {
-                       return FALSE;
-               }
-               $update_statements['add'] = $installer->filterByIdentityField($update_statements['add']);
-               return !empty($update_statements['add']);
-       }
-
-       /**
-        * Remove statements that contains not a uuid statement
-        *
-        * @return boolean
-        */
-       protected function cleanUp($statements) {
-               $result = array();
-               foreach ($statements as $key => $statement) {
-                       if (strpos($statement, 'ADD uuid ') !== FALSE) {
-                               $result[$key] = $statement;
-                       }
-               }
-               return $result;
-       }
-
-}
\ No newline at end of file
index 6e5c5c2..a3a0d06 100644 (file)
@@ -1,8 +1,10 @@
 <?php
+namespace Maroschik\Identity\Utility;
+
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2011 Xavier Perseguers <xavier@typo3.org>
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use Maroschik\Identity\Configuration\IdentityProviderConfigurationInterface as ProviderConfiguration;
+
 /**
  * A utility class for the field defintions
  *
  * @author Thomas Maroschik <tmaroschik@dfau.de>
- *
- * @package TYPO3
- * @subpackage identity
  */
-class Tx_Identity_Utility_FieldDefinitions {
-
-       /**
-        * Contains ignoreTCA
-        *
-        * @var bool
-        */
-       protected $ignoreTCA = FALSE;
-
-       /**
-        * Sets $ignoreTCA
-        *
-        * @param bool $ignoreTCA
-        */
-       public function setIgnoreTCA($ignoreTCA) {
-               $this->ignoreTCA = $ignoreTCA;
-       }
-
-       /**
-        * Returns $ignoreTCA
-        *
-        * @return bool
-        */
-       public function getIgnoreTCA() {
-               return $this->ignoreTCA;
-       }
+class FieldDefinitions {
 
        /**
-        * Check if a table definition contains an uid and a pid, and insert a uuid column
-        * Returns a modified table definition
+        * Create SQL for identity fields
         *
-        * @param array $tableDefinitions
-        * @return array
-        */
-       public function insertIdentityColumn(array $tableDefinitions) {
-               $identityFieldDefinitions = $this->getIdentityFieldDefintions($tableDefinitions);
-               foreach ($identityFieldDefinitions as $table => $defintion) {
-                       foreach ($defintion['fields'] as $fieldName => $createString) {
-                               $tableDefinitions[$table]['fields'][$fieldName] = $createString;
-                       }
-                       foreach ($defintion['keys'] as $keyName => $createString) {
-                               $tableDefinitions[$table]['keys'][$keyName] = $createString;
-                       }
-               }
-               return $tableDefinitions;
-       }
-
-       /**
-        * Check if a table definition contains an uid and a pid, and insert a uuid column
-        * Returns a sql string that inserts the needed indentity fields
-        *
-        * @param array $tableDefinitions
         * @return string
         */
-       public function getInsertIdentityColumnSql(array $tableDefinitions) {
+       protected function getInsertIdentityColumnSql() {
                $sqlContent = LF . LF . LF;
-               $identityFieldDefinitions = $this->getIdentityFieldDefintions($tableDefinitions);
+               $identityFieldDefinitions = $this->getIdentityFieldDefintions();
                foreach ($identityFieldDefinitions as $table => $defintion) {
                        $sqlRows = array();
                        foreach ($defintion['fields'] as $fieldName => $createString) {
@@ -106,62 +60,74 @@ class Tx_Identity_Utility_FieldDefinitions {
        }
 
        /**
-        * @throws InvalidArgumentException
-        * @param array $tableDefinitions
+        * @throws \InvalidArgumentException
         * @return array
         */
-       protected function getIdentityFieldDefintions(array $tableDefinitions) {
+       protected function getIdentityFieldDefintions() {
                $identityFieldDefintions = array();
-               /** @var $identityConfigurationCheck Tx_Identity_Configuration_Check */
-               $identityConfigurationCheck = t3lib_div::makeInstance('Tx_Identity_Configuration_Check');
-               /** @var $identityMap Tx_Identity_Map */
-               $identityMap = t3lib_div::makeInstance('Tx_Identity_Map');
+               /** @var $identityConfigurationCheck \Maroschik\Identity\Configuration\ConfigurationCheck */
+               $identityConfigurationCheck = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Maroschik\Identity\Configuration\ConfigurationCheck');
+               /** @var $identityMap \Maroschik\Identity\IdentityMap */
+               $identityMap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Maroschik\Identity\IdentityMap');
                $identityConfiguration = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'];
-               $identityProviders = $identityConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST];
-               foreach ($tableDefinitions as $table => $definition) {
-                       t3lib_div::loadTCA($table);
-                       if (
-                               isset($GLOBALS['TCA'][$table])
-                               || $identityMap->isApplicable($table)
-                               || (
-                                       // During installation of an extension, the extensions tca is not available
-                                       // In this case ignoreTCA is set and we look only for a uid and pid column.
-                                       // If this isn't right, it gets corrected afterwards anyways.
-                                       $this->ignoreTCA
-                                       && in_array('uid', array_keys($definition['fields']))
-                                       && in_array('pid', array_keys($definition['fields']))
-                               )
-                       ) {
-                               if (isset($GLOBALS['TCA'][$table]['ctrl']['EXT']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::KEY])) {
-                                       $identityProviderKey = $GLOBALS['TCA'][$table]['ctrl']['EXT']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::KEY];
-                                       $identityProviderField = $identityProviders[$identityProviderKey][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
+               $identityProviders = $identityConfiguration[ProviderConfiguration::PROVIDERS_LIST];
+               foreach ($GLOBALS['TCA'] as $table => $definition) {
+                       if ($identityMap->isApplicable($table)) {
+                               if (isset($definition['ctrl']['EXT']['identity'][ProviderConfiguration::KEY])) {
+                                       $identityProviderKey = $definition['ctrl']['EXT']['identity'][ProviderConfiguration::KEY];
+                                       $identityProviderField = $identityProviders[$identityProviderKey][ProviderConfiguration::IDENTITY_FIELD];
                                        $identityConfigurationCheck->checkTableSpecificIdentityProviderConfiguration($table, $identityProviderKey);
-                               } elseif (isset($identityConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::DEFAULT_PROVIDER])) {
-                                       $identityProviderKey = $identityConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::DEFAULT_PROVIDER];
-                                       $identityProviderField = $identityProviders[$identityProviderKey][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
+                               } elseif (isset($identityConfiguration[ProviderConfiguration::DEFAULT_PROVIDER])) {
+                                       $identityProviderKey = $identityConfiguration[ProviderConfiguration::DEFAULT_PROVIDER];
+                                       $identityProviderField = $identityProviders[$identityProviderKey][ProviderConfiguration::IDENTITY_FIELD];
                                        $identityConfigurationCheck->checkDefaultIdentityProviderConfiguration($identityProviderKey);
                                } else {
-                                       throw new InvalidArgumentException(
+                                       throw new \InvalidArgumentException(
                                                'There is no default identity provider defined in ' .
-                                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::DEFAULT_PROVIDER]',
+                                               '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][ProviderConfiguration::DEFAULT_PROVIDER]',
                                                1300104461
                                        );
                                }
                                // Adds field + index definition
-                               $identityFieldDefintions[$table]['fields'][$identityProviderField] = $identityProviders[$identityProviderKey][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD_CREATE_CLAUSE];
+                               $identityFieldDefintions[$table]['fields'][$identityProviderField] = $identityProviders[$identityProviderKey][ProviderConfiguration::IDENTITY_FIELD_CREATE_CLAUSE];
                                $identityFieldDefintions[$table]['keys'][$identityProviderField] = 'KEY ' . $identityProviderField . ' (' . $identityProviderField . ')';
-                       } elseif ($table === 'sys_identity') {
-                               foreach ($identityProviders as $identityProviderKey=>$identityProviderConfiguration) {
-                                       $identityConfigurationCheck->checkIdentityProviderConfiguration($identityProviderKey);
-                                       $identityField = $identityProviderConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-                                       $identityFieldCreateClause = $identityProviderConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD_CREATE_CLAUSE];
-                                       // Adds field + index definition
-                                       $identityFieldDefintions[$table]['fields'][$identityField] = $identityFieldCreateClause;
-                                       $identityFieldDefintions[$table]['keys'][$identityField] = 'KEY ' . $identityField . ' (' . $identityField . ')';
-                               }
                        }
                }
+               foreach ($identityProviders as $identityProviderKey=>$identityProviderConfiguration) {
+                       $identityConfigurationCheck->checkIdentityProviderConfiguration($identityProviderKey);
+                       $identityField = $identityProviderConfiguration[ProviderConfiguration::IDENTITY_FIELD];
+                       $identityFieldCreateClause = $identityProviderConfiguration[ProviderConfiguration::IDENTITY_FIELD_CREATE_CLAUSE];
+                       // Adds field + index definition
+                       $identityFieldDefintions['sys_identity']['fields'][$identityField] = $identityFieldCreateClause;
+                       $identityFieldDefintions['sys_identity']['keys'][$identityField] = 'KEY ' . $identityField . ' (' . $identityField . ')';
+               }
                return $identityFieldDefintions;
        }
 
+
+       /**
+        * A slot method to inject the identity database fields to the
+        * tables defintion string
+        *
+        * @param array $sqlString
+        * @return array
+        */
+       public function addIdentityFieldsToTablesDefintion(array $sqlString) {
+               $sqlString[] = $this->getInsertIdentityColumnSql();
+               return array('sqlString' => $sqlString);
+       }
+
+       /**
+        * A slot method to inject the identity database fields of an
+        * extension to the tables defintion string
+        *
+        * @param array $sqlString
+        * @param string $extensionKey
+        * @return array
+        */
+       public function addExtensionIdentityFieldsToTablesDefintion(array $sqlString, $extensionKey) {
+               $sqlString[] = $this->getInsertIdentityColumnSql($extensionKey);
+               return array('sqlString' => $sqlString, 'extensionKey' => $extensionKey);
+       }
+
 }
\ No newline at end of file
diff --git a/class.ext_update.php b/class.ext_update.php
deleted file mode 100644 (file)
index c85053b..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-<?php
-
-/* * *************************************************************
- *  Copyright notice
- *
- *  (c) 2010 Fabien Udriot <fabien.udriot@ecodev.ch>
- *  All rights reserved
- *
- *  This script is part of the Typo3 project. The Typo3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- * ************************************************************* */
-if (t3lib_extMgm::isLoaded('identity')) {
-       require_once(t3lib_extMgm::extPath('identity') . 'Classes/Install/Installer.php');
-}
-/**
- * Class for updating identity
- *
- * @author Fabien Udriot <fabien.udriot@ecodev.ch>
- *
- * @package TYPO3
- * @subpackage identity
- */
-class ext_update {
-
-       /** @var Tx_Identity_Install_Installer */
-       protected $installer;
-
-       /** @var Tx_Identity_Map */
-       protected $identityMap;
-
-       /**
-        * Defines whether the UPDATE! menu should be displayed or not.
-        *
-        * @return boolean
-        */
-       public function access() {
-               return TRUE;
-       }
-
-       /**
-        * Constructor
-        *
-        */
-       public function __construct() {
-               if (t3lib_extMgm::isLoaded('identity')) {
-                               // instantiate a light installer
-                       $this->installer = t3lib_div::makeInstance('Tx_Identity_Install_Installer');
-                       $this->identityMap = t3lib_div::makeInstance('Tx_Identity_Map');
-               }
-       }
-
-       /**
-        * Main function, returning the HTML content of the update wizard
-        *
-        * @return      string  HTML to display
-        */
-       public function main() {
-               if (!t3lib_extMgm::isLoaded('identity')) {
-                       return '';
-               }
-
-               $statements = $this->getStatements();
-
-               if (!empty($statements['add'])) {
-                       $content = $this->renderForm($statements);
-
-               }
-               else {
-                       $content = $this->renderMessageOk();
-               }
-
-                       // display a notification also if missing table are found
-               if (!empty($statements['create_table'])) {
-                       $content .= $this->renderMessageTable();
-
-               }
-
-                       // Update UUID values
-               $this->identityMap->rebuild();
-               $this->identityMap->commit();
-
-               return $content;
-       }
-
-       /**
-        * Main function, returning the HTML content of the update wizard
-        *
-        * @return      string  HTML to display
-        */
-       protected function getStatements() {
-
-                       // load the SQL files
-               $tblFileContent = t3lib_div::getUrl(PATH_t3lib . 'stddb/tables.sql');
-               foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $loadedExtConf) {
-                       if (is_array($loadedExtConf) && $loadedExtConf['ext_tables.sql']) {
-                               $tblFileContent .= LF . LF . LF . LF . t3lib_div::getUrl($loadedExtConf['ext_tables.sql']);
-                       }
-               }
-
-               $fileContent = implode(
-                               LF, $this->installer->getStatementArray($tblFileContent, 1, '^CREATE TABLE ')
-               );
-
-                       // get the table definitions
-               $tableDefinitions = $this->installer->getFieldDefinitions_fileContent($fileContent);
-               /** @var $fieldDefinitionsUtility Tx_Identity_Utility_FieldDefinitions */
-               $fieldDefinitionsUtility = t3lib_div::makeInstance('Tx_Identity_Utility_FieldDefinitions');
-               $tableDefinitions = $fieldDefinitionsUtility->insertIdentityColumn($tableDefinitions);
-               if (!count($tableDefinitions)) {
-                       die("Error: There were no 'CREATE TABLE' definitions in the provided file");
-               }
-
-                       // Execute the statement if button submit has been pressed
-               if (t3lib_div::_GP('update') === 'doUpdate') {
-
-                       $parameters = t3lib_div::_GP('TYPO3_INSTALL');
-                       if (is_array($parameters['database_update'])) {
-                               $FDdb = $this->installer->getFieldDefinitions_database();
-                               $diff = $this->installer->getDatabaseExtra($tableDefinitions, $FDdb);
-                               $statements = $this->installer->getUpdateSuggestions($diff);
-
-                               $results = array();
-                               $results[] = $this->installer->performUpdateQueries($statements['add'], $parameters['database_update']);
-                       }
-               }
-
-                       // get the current database definition
-               $FDdb = $this->installer->getFieldDefinitions_database();
-
-                       // get a diff and check if a field uuid is missing somewhere
-               $diff = $this->installer->getDatabaseExtra($tableDefinitions, $FDdb);
-               $statements = $this->installer->getUpdateSuggestions($diff);
-               if (isset($statements['add'])) {
-                       $statements['add'] = $this->installer->filterByIdentityField($statements['add']);
-               }
-
-               return $statements;
-       }
-
-       /**
-        * Render message UUID OK
-        *
-        * @return      string  HTML to display
-        */
-       protected function renderMessageOk() {
-               $content = '
-                       <div style="width: 600px; margin-top: 20px">
-                               <div class="typo3-message message-ok">
-                                       <div class="message-header">
-                                               ' . $GLOBALS['LANG']->sL('LLL:EXT:identity/Resources/Private/Language/locallang.xml:ok_table_header') . '.
-                                       </div>
-                                       <div class="message-body">
-                               </div>
-                       </div>
-                       ';
-               return $content;
-       }
-
-       /**
-        * Render message about missing table
-        *
-        * @return      string  HTML to display
-        */
-       protected function renderMessageTable() {
-               $content = '
-                       <div style="width: 600px; margin-top: 20px">
-                               <div class="typo3-message message-information">
-                                       <div class="message-header">'
-                                               . $GLOBALS['LANG']->sL('LLL:EXT:identity/Resources/Private/Language/locallang.xml:information_table_header') .
-                                       '</div>
-                                       <div class="message-body">
-                                               ' . $GLOBALS['LANG']->sL('LLL:EXT:identity/Resources/Private/Language/locallang.xml:information_table_message') .
-                               '</div>
-                       </div>
-                       ';
-               return $content;
-       }
-
-       /**
-        * Render the update statement form
-        *
-        * @param array $statements
-        * @return      string  HTML to display
-        */
-       protected function renderForm($statements) {
-
-               $content = '
-                       <style>
-                               fieldset {
-                                       border: 0;
-                               }
-                               legend {
-                                       font-weight: bold;
-                                       margin-left: 1em;
-                               }
-                               fieldset li {
-                                       clear: left;
-                                       float: left;
-                                       margin-bottom: 0.5em;
-                                       width: 100%;
-                               }
-                               .t3-install-form-label-after label {
-                                       padding-left: 1em;
-                               }
-                               .t3-install-form-label-after label, .t3-install-form-label-above label {
-                                       display: block;
-                                       float: none;
-                                       margin-right: 0;
-                                       width: auto;
-                               }
-                       </style>
-               ';
-               $content .= '
-                       <p style="margin-bottom: 10px">
-                               There seems to be a number of differencies
-                               between the database and the selected
-                               SQL-file.
-                               <br />
-                               Please select which statements you want to
-                               execute in order to update your database:
-                       </p>
-                       ';
-               $content .=     '<form action="mod.php?&id=0&M=tools_em&CMD[showExt]=identity&SET[singleDetails]=updateModule" method="post">';
-               $content .= $this->installer->generateUpdateDatabaseForm_checkboxes($statements['add'],'Add fields');
-               $content .= '<input type="hidden" name="update" value ="doUpdate">';
-               $content .= '<p><input type="submit" name="submitButton" value ="Update"></p>';
-               $content .= '</form>';
-               return $content;
-       }
-}
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/identity/class.ext_update.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/identity/class.ext_update.php']);
-}
-?>
diff --git a/ext_autoload.php b/ext_autoload.php
deleted file mode 100644 (file)
index 94f0b2f..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-/*
- * Register necessary class names with autoloader
- */
-return array(
-       't3lib_db_preprocessqueryhook' => PATH_t3lib . 'interfaces/interface.t3lib_db_preprocessqueryhook.php',
-       't3lib_db_postprocessqueryhook' => PATH_t3lib . 'interfaces/interface.t3lib_db_postprocessqueryhook.php',
-       'tx_identity_map' =>  t3lib_extMgm::extPath('identity', 'Classes/Map.php'),
-       'tx_identity_configuration_check' => t3lib_extMgm::extPath('identity', 'Classes/Configuration/Check.php'),
-       'tx_identity_configuration_identityproviderinterface' => t3lib_extMgm::extPath('identity', 'Classes/Configuration/IdentityProviderInterface.php'),
-       'tx_identity_providerinterface' => t3lib_extMgm::extPath('identity', 'Classes/ProviderInterface.php'),
-       'tx_identity_provider_abstractuuid' => t3lib_extMgm::extPath('identity', 'Classes/Provider/AbstractUuid.php'),
-       'tx_identity_provider_recorduuid' => t3lib_extMgm::extPath('identity', 'Classes/Provider/RecordUuid.php'),
-       'tx_identity_provider_staticrecorduuid' => t3lib_extMgm::extPath('identity', 'Classes/Provider/StaticRecordUuid.php'),
-       'tx_identity_utility_fielddefinitions' => t3lib_extMgm::extPath('identity', 'Classes/Utility/FieldDefinitions.php'),
-       'tx_identity_utility_algorithms' => t3lib_extMgm::extPath('identity', 'Classes/Utility/Algorithms.php'),
-       'tx_identity_tasks_rebuildtask' => t3lib_extMgm::extPath('identity', 'Classes/Tasks/RebuildTask.php'),
-);
-?>
diff --git a/ext_conf_template.txt b/ext_conf_template.txt
deleted file mode 100644 (file)
index 3876ea0..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# cat=basic/dev/1000; type=user[EXT:identity/Classes/Utility/ExtensionManager.php:Tx_Identity_Utility_ExtensionManager->displayMessage]; label=Message
-updateMessage=0
\ No newline at end of file
index e774954..fa10bb4 100644 (file)
@@ -32,7 +32,7 @@ $EM_CONF[$_EXTKEY] = array(
        'version' => '0.2.0',
        'constraints' => array(
                'depends' => array(
-                       'typo3' => '4.6.0-4.7.99',
+                       'typo3' => '6.2.0-6.2.99',
                ),
                'conflicts' => array(
                ),
@@ -41,7 +41,7 @@ $EM_CONF[$_EXTKEY] = array(
        ),
        'suggests' => array(
        ),
-       '_md5_values_when_last_written' => 'a:23:{s:20:"class.ext_update.php";s:4:"9073";s:16:"ext_autoload.php";s:4:"0935";s:21:"ext_conf_template.txt";s:4:"a36c";s:17:"ext_localconf.php";s:4:"34fa";s:14:"ext_tables.php";s:4:"ab1d";s:14:"ext_tables.sql";s:4:"da8f";s:15:"Classes/Map.php";s:4:"6faf";s:29:"Classes/ProviderInterface.php";s:4:"530b";s:31:"Classes/Configuration/Check.php";s:4:"df54";s:51:"Classes/Configuration/IdentityProviderInterface.php";s:4:"8be3";s:43:"Classes/Hooks/class.tx_identity_em_hook.php";s:4:"4ad1";s:55:"Classes/Hooks/class.tx_identity_t3lib_db_preprocess.php";s:4:"6790";s:48:"Classes/Hooks/class.tx_identity_tcemain_hook.php";s:4:"dc3c";s:29:"Classes/Install/Installer.php";s:4:"6be5";s:33:"Classes/Provider/AbstractUuid.php";s:4:"3605";s:31:"Classes/Provider/RecordUuid.php";s:4:"af00";s:37:"Classes/Provider/StaticRecordUuid.php";s:4:"9ce8";s:29:"Classes/Tasks/RebuildTask.php";s:4:"a1c1";s:30:"Classes/Utility/Algorithms.php";s:4:"8b96";s:36:"Classes/Utility/ExtensionManager.php";s:4:"2187";s:36:"Classes/Utility/FieldDefinitions.php";s:4:"a73f";s:40:"Resources/Private/Language/locallang.xml";s:4:"4128";s:14:"doc/manual.sxw";s:4:"32d0";}',
+       '_md5_values_when_last_written' => 'a:23:{s:20:"class.ext_update.php";s:4:"9073";s:16:"ext_autoload.php";s:4:"0935";s:21:"ext_conf_template.txt";s:4:"a36c";s:17:"ext_localconf.php";s:4:"34fa";s:14:"ext_tables.php";s:4:"ab1d";s:14:"ext_tables.sql";s:4:"da8f";s:15:"Classes/Map.php";s:4:"6faf";s:29:"Classes/ProviderInterface.php";s:4:"530b";s:31:"Classes/Configuration/Check.php";s:4:"df54";s:51:"Classes/Configuration/IdentityProviderConfigurationInterface.phpInterface.php";s:4:"8be3";s:43:"Classes/Hooks/class.tx_identity_em_hook.php";s:4:"4ad1";s:55:"Classes/Hooks/class.tx_identity_t3lib_db_preprocess.php";s:4:"6790";s:48:"Classes/Hooks/class.tx_identity_tcemain_hook.php";s:4:"dc3c";s:29:"Classes/Install/Installer.php";s:4:"6be5";s:33:"Classes/Provider/AbstractUuid.php";s:4:"3605";s:31:"Classes/Provider/RecordUuid.php";s:4:"af00";s:37:"Classes/Provider/StaticRecordUuid.php";s:4:"9ce8";s:29:"Classes/Tasks/RebuildTask.php";s:4:"a1c1";s:30:"Classes/Utility/Algorithms.php";s:4:"8b96";s:36:"Classes/Utility/ExtensionManager.php";s:4:"2187";s:36:"Classes/Utility/FieldDefinitions.php";s:4:"a73f";s:40:"Resources/Private/Language/locallang.xml";s:4:"4128";s:14:"doc/manual.sxw";s:4:"32d0";}',
 );
 
 ?>
index 5753744..b40f4cb 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
  *
  *  All rights reserved
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-if (!defined ('TYPO3_MODE')) {
+if (!defined('TYPO3_MODE')) {
        die ('Access denied.');
 }
 
+use Maroschik\Identity\Configuration\IdentityProviderConfigurationInterface as ProviderConfiguration;
+
 // Configure the default identity providers.
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY] = array(
-       Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST     => array(
-               'recordUuid'    => array(
-                       Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD                                     =>      'uuid',
-                       Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD_CREATE_CLAUSE       =>      'char(36) NOT NULL default \'\'',
-                       Tx_Identity_Configuration_IdentityProviderInterface::PROVIDER_CLASS                                     =>      'Tx_Identity_Provider_RecordUuid',
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'] = array(
+       ProviderConfiguration::PROVIDERS_LIST => array(
+               'recordUuid' => array(
+                       ProviderConfiguration::IDENTITY_FIELD => 'uuid',
+                       ProviderConfiguration::IDENTITY_FIELD_CREATE_CLAUSE => 'char(36) NOT NULL default \'\'',
+                       ProviderConfiguration::PROVIDER_CLASS => 'Maroschik\Identity\Provider\RecordUuidProvider',
                ),
-               'staticRecordUuid'      => array(
-                       Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD                                     =>      'uuid',
-                       Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD_CREATE_CLAUSE       =>      'char(36) NOT NULL default \'\'',
-                       Tx_Identity_Configuration_IdentityProviderInterface::PROVIDER_CLASS                                     =>      'Tx_Identity_Provider_StaticRecordUuid',
+               'staticRecordUuid' => array(
+                       ProviderConfiguration::IDENTITY_FIELD => 'uuid',
+                       ProviderConfiguration::IDENTITY_FIELD_CREATE_CLAUSE => 'char(36) NOT NULL default \'\'',
+                       ProviderConfiguration::PROVIDER_CLASS => 'Maroschik\Identity\Provider\StaticRecordUuidProvider',
                ),
        ),
-       Tx_Identity_Configuration_IdentityProviderInterface::DEFAULT_PROVIDER   => 'recordUuid',
+       ProviderConfiguration::DEFAULT_PROVIDER => 'recordUuid',
 );
 
-// Register a hook for tce main
-$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';
-
-//Register a hook for DB
-$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';
-
-// Register a hook for the extension manager
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/tools/em/index.php']['checkDBupdates'][] = 'EXT:identity/Classes/Hooks/class.tx_identity_em_hook.php:tx_identity_em_hook';
-
-// Register a hook for the install tool
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['checkTheDatabase'][] = 'EXT:identity/Classes/Hooks/class.tx_identity_em_hook.php:tx_identity_em_hook';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['identity'] = 'Maroschik\\Identity\\Hooks\\DataHandlerHook';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_db.php']['queryProcessors']['identity'] = 'Maroschik\\Identity\\Hooks\\DatabasePreProcessQueryHook';
 
+$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
+$signalSlotDispatcher->connect(
+       'TYPO3\\CMS\\Install\\Service\\SqlExpectedSchemaService',
+       'tablesDefinitionIsBeingBuilt',
+       'Maroschik\\Identity\\Utility\\FieldDefinitions',
+       'addIdentityFieldsToTablesDefintion'
+);
+$signalSlotDispatcher->connect(
+       'TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility',
+       'tablesDefinitionIsBeingBuilt',
+       'Maroschik\\Identity\\Utility\\FieldDefinitions',
+       'addExtensionIdentityFieldsToTablesDefintion'
+);
 
+if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('scheduler')) {
        // Register extension list update task
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['Tx_Identity_Tasks_RebuildTask'] = array(
-       'extension'                     => $_EXTKEY,
-       'title'                         => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang.xml:tasks_rebuildTask.name',
-       'description'           => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang.xml:tasks_rebuildTask.description',
-       'additionalFields'      => '',
-);
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['Maroschik\\Identity\\Tasks\\RebuildTask'] = array(
+               'extension' => 'identity',
+               'title' => 'LLL:EXT:identity/Resources/Private/Language/locallang.xml:tasks_rebuildTask.name',
+               'description' => 'LLL:EXT:identity/Resources/Private/Language/locallang.xml:tasks_rebuildTask.description',
+               'additionalFields' => '',
+       );
+}
 
 ?>
\ No newline at end of file
index 85f7023..d576319 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
+ *  (c) 2011-2013 Thomas Maroschik <tmaroschik@dfau.de>
  *
  *  All rights reserved
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-if (!defined ('TYPO3_MODE')) {
+if (!defined('TYPO3_MODE')) {
        die ('Access denied.');
 }
 
-foreach ($GLOBALS['TCA'] as $tablename=>$configuration) {
-       t3lib_div::loadTCA($tablename);
+use Maroschik\Identity\Configuration\IdentityProviderConfigurationInterface as ProviderConfiguration;
+
+foreach ($GLOBALS['TCA'] as $tablename => $configuration) {
        if (isset($GLOBALS['TCA'][$tablename]['ctrl']['is_static']) && $GLOBALS['TCA'][$tablename]['ctrl']['is_static']) {
-               $GLOBALS['TCA'][$tablename]['ctrl']['EXT']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::KEY] = 'staticRecordUuid';
+               $GLOBALS['TCA'][$tablename]['ctrl']['EXT']['identity'][ProviderConfiguration::KEY] = 'staticRecordUuid';
        }
 }