class tx_identity_tcemain_hook {
public function processDatamap_afterAllOperations($parent) {
+ /** @var $identityMap Tx_Identity_Map */
$identityMap = t3lib_div::makeInstance('Tx_Identity_Map');
// $identityMap->rebuild();
$identityMap->commit();
$statementArray[$statementArrayPointer] .= $lineContent;
$is_set = 1;
}
- if (substr(trim($lineContent), -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]);
$total = array();
foreach ($lines as $value) {
- if (substr($value, 0, 1) == '#') {
+ if (substr($value, 0, 1) === '#') {
continue; // Ignore comments
}
$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!
+ if (TYPO3_OS === 'WIN') { // tablenames are always lowercase on windows!
$table = strtolower($table);
}
}
} else {
- if (substr($value, 0, 1) == ')' && substr($value, -1) == ';') {
+ 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];
if (is_array($info[$theKey])) {
foreach ($info[$theKey] as $fieldN => $fieldC) {
$fieldN = str_replace('`', '', $fieldN);
- if ($fieldN == 'COLLATE') {
+ if ($fieldN === 'COLLATE') {
continue; // TODO: collation support is currently disabled (needs more testing)
}
$info['extra']['CLEAR'] = 2;
}
}
- if ($theKey == 'extra') {
+ if ($theKey === 'extra') {
if ($remove) {
if (substr($fN, 0, strlen($deletedPrefixKey)) != $deletedPrefixKey) {
$statement = 'ALTER TABLE ' . $table . ' CHANGE ' . $fN . ' ' . $deletedPrefixKey . $fN . ' ' . $fV . ';';
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);
}
/**
public function validateIdentifier($identifier) {
if (!strlen($identifier)) {
throw new InvalidArgumentException('Empty UUID given.', 1299013185);
- return false;
}
if (function_exists('uuid_is_valid') && !uuid_is_valid($identifier)) {
throw new InvalidArgumentException('Given UUID does not match the UUID pattern.', 1299013329);
- return false;
}
if (strlen($identifier) !== 36) {
throw new InvalidArgumentException('Lenghth of UUID has to be 36 characters.', 1299013335);
- return false;
}
$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 false;
}
- return true;
+ return TRUE;
}
/**
if (!isset($GLOBALS['TCA'][$tablename])) {
throw new InvalidArgumentException('The tablename "' . $tablename . '" is not defined in the TCA.', 1299082184);
}
- if (!t3lib_div::testInt($uid)) {
+ 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->configuration[Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
$this->validateIdentifier($uuid);
t3lib_div::loadTCA($tablename);
- if (isset($GLOBALS['TCA'][$tablename]) && t3lib_div::testInt($uid)) {
+ if ($this->version < 4006000) {
+ $validUid = t3lib_div::testInt($uid);
+ } else {
+ $validUid = t3lib_utility_Math::canBeInterpretedAsInteger($uid);
+ }
+ if (isset($GLOBALS['TCA'][$tablename]) && $validUid) {
if (isset($this->insertQueue[$uuid])) {
unset($this->insertQueue[$uuid]);
}
* @throws InvalidArgumentException Throws an invalid argument exception, if the given namespace is not an uuid
*/
static public function generateUUIDv5($namespace, $name) {
- self::validateUUID($namespace);
+ // self::validateUUID($namespace);
// Get hexadecimal components of namespace
$nhex = str_replace(array('-','{','}'), '', $namespace);
static public function generateRandomBytes($count) {
$bytes = '';
+ // TODO: use TYPO3's internal API to retrieve random bytes
if (file_exists('/dev/urandom')) {
$bytes = file_get_contents('/dev/urandom', NULL, NULL, NULL, $count);
}
t3lib_div::loadTCA($table);
if (isset($GLOBALS['TCA'][$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];
$identityProviderField = $identityProviders[$identityProviderKey][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
$identityConfigurationCheck->checkTableSpecificIdentityProviderConfiguration($table, $identityProviderKey);
-
+
// Adds field + index definition
$definition['fields'][$identityProviderField] = $identityProviders[$identityProviderKey][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD_CREATE_CLAUSE];
$definition['keys'][$identityProviderField] = 'KEY ' . $identityProviderField . ' (' . $identityProviderField . ')';
$defaultProviderKey = $identityConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::DEFAULT_PROVIDER];
$defaultProviderField = $identityProviders[$defaultProviderKey][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
$identityConfigurationCheck->checkDefaultIdentityProviderConfiguration($defaultProviderKey);
-
+
// Adds field + index definition
$definition['fields'][$defaultProviderField] = $identityProviders[$defaultProviderKey][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD_CREATE_CLAUSE];
$definition['keys'][$defaultProviderField] = 'KEY ' . $defaultProviderField . ' (' . $defaultProviderField . ')';
);
}
- } elseif ($table == 'sys_identity') {
+ } 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
$definition['fields'][$identityField] = $identityFieldCreateClause;
$definition['keys'][$identityField] = 'KEY ' . $identityField . ' (' . $identityField . ')';
-
+
}
}
*/
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.
*
public function __construct() {
if (t3lib_extMgm::isLoaded('identity')) {
// instantiate a light installer
- /* @var $this->installer Tx_Identity_Install_Installer */
$this->installer = t3lib_div::makeInstance('Tx_Identity_Install_Installer');
$this->identityMap = t3lib_div::makeInstance('Tx_Identity_Map');
}
}
else {
- $content .= $this->renderMessageOk();
+ $content = $this->renderMessageOk();
}
// display a notification also if missing table are found
// 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)) {
}
// Execute the statement if button submit has been pressed
- if (t3lib_div::_GP('update') == 'doUpdate') {
+ if (t3lib_div::_GP('update') === 'doUpdate') {
$parameters = t3lib_div::_GP('TYPO3_INSTALL');
if (is_array($parameters['database_update'])) {
* @return string HTML to display
*/
protected function renderMessageTable() {
- $content .= '
+ $content = '
<div style="width: 600px; margin-top: 20px">
<div class="typo3-message message-information">
<div class="message-header">'
.t3-install-form-label-after label {
padding-left: 1em;
}
- genera...1016810 (line 117)
.t3-install-form-label-after label, .t3-install-form-label-above label {
display: block;
float: none;
}
}
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/identity/class.ext_update.php']) {
- include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/identity/class.ext_update.php']);
+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']);
}
?>
'version' => '0.0.0',
'constraints' => array(
'depends' => array(
+ 'typo3' => '4.5.0-4.7.99',
),
'conflicts' => array(
),
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
-if (!defined ("TYPO3_MODE")) die ('Access denied.');
+if (!defined ('TYPO3_MODE')) {
+ die ('Access denied.');
+}
$GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_install.php'] = t3lib_extMgm::extPath($_EXTKEY) . 'Classes/Xclass/class.ux_t3lib_install.php';
$GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/install/mod/class.tx_install.php'] = t3lib_extMgm::extPath($_EXTKEY) . 'Classes/Xclass/class.ux_tx_install.php';
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
-if (!defined ("TYPO3_MODE")) die ('Access denied.');
+if (!defined ('TYPO3_MODE')) {
+ die ('Access denied.');
+}
foreach ($GLOBALS['TCA'] as $tablename=>$configuration) {
t3lib_div::loadTCA($tablename);