/** * Performs the database update. * * @param array &$dbQueries Queries done in this update * @param mixed &$customMessages Custom messages * @return boolean TRUE on success, FALSE on error */ public function performUpdate(array &$dbQueries, &$customMessages) { $versionNumber = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version); if ($versionNumber < 6000000) { // Nothing to do return true; } try { $this->init(); $finishedFields = $this->getFinishedFields(); foreach ($this->tables as $table => $tableConfiguration) { // find all additional fields we should get from the database foreach ($tableConfiguration as $fieldToMigrate => $fieldConfiguration) { $fieldKey = $table . ':' . $fieldToMigrate; if (in_array($fieldKey, $finishedFields)) { // this field was already migrated continue; } $fieldsToGet = [$fieldToMigrate]; if (isset($fieldConfiguration['titleTexts'])) { $fieldsToGet[] = $fieldConfiguration['titleTexts']; } if (isset($fieldConfiguration['alternativeTexts'])) { $fieldsToGet[] = $fieldConfiguration['alternativeTexts']; } if (isset($fieldConfiguration['captions'])) { $fieldsToGet[] = $fieldConfiguration['captions']; } if (isset($fieldConfiguration['links'])) { $fieldsToGet[] = $fieldConfiguration['links']; } if (!isset($this->recordOffset[$table])) { $this->recordOffset[$table] = 0; } do { $limit = $this->recordOffset[$table] . ',' . self::RECORDS_PER_QUERY; $records = $this->getRecordsFromTable($table, $fieldToMigrate, $fieldsToGet, $limit); foreach ($records as $record) { $this->migrateField($table, $record, $fieldToMigrate, $fieldConfiguration, $customMessages); } $this->registry->set($this->registryNamespace, 'recordOffset', $this->recordOffset); } while (count($records) === self::RECORDS_PER_QUERY); // add the field to the "finished fields" if things didn't fail above if (is_array($records)) { $finishedFields[] = $fieldKey; } } } $this->markWizardAsDone(implode(',', $finishedFields)); $this->registry->remove($this->registryNamespace, 'recordOffset'); } catch (\Exception $e) { $customMessages .= PHP_EOL . $e->getMessage(); } return empty($customMessages); }
/** * Performs the database update. * * @param array &$dbQueries Queries done in this update * @param mixed &$customMessages Custom messages * * @return bool TRUE on success, FALSE on error */ public function performUpdate(array &$dbQueries, &$customMessages) { try { $this->init(); if (!isset($this->recordOffset[$this->table])) { $this->recordOffset[$this->table] = 0; } do { $limit = $this->recordOffset[$this->table] . ',' . self::RECORDS_PER_QUERY; $records = $this->getRecordsFromTable($limit, $dbQueries); foreach ($records as $record) { $this->migrateField($record, $customMessages, $dbQueries); } $this->registry->set($this->registryNamespace, 'recordOffset', $this->recordOffset); } while (count($records) === self::RECORDS_PER_QUERY); $this->markWizardAsDone(); $this->registry->remove($this->registryNamespace, 'recordOffset'); } catch (\Exception $e) { $customMessages .= PHP_EOL . $e->getMessage(); } return empty($customMessages); }
/** * Remove registry entry * * @param string $name Registry entry name * @param string $namespace Optional namespace * @return void */ public function remove($name, $namespace = null) { $namespace = is_string($namespace) ? $namespace : $this->namespaceIdentifier; $this->registry->remove($namespace, $name); }
/** * @test */ public function removeReallyRemovesTheEntryFromTheDatabase() { $GLOBALS['TYPO3_DB']->expects($this->once())->method('exec_DELETEquery')->with('sys_registry', 'entry_namespace = \'tx_phpunit\' AND entry_key = \'someKey\''); $this->registry->remove('tx_phpunit', 'someKey'); }
/** * Removes the session token for the user from the registry. * * @access private */ public function removeSessionTokenFromRegistry() { $this->registry->remove('core', 'formProtectionSessionToken:' . $this->backendUser->user['uid']); }