34 protected $title =
'Migrate file metadata from sys_file to an external metadata table';
45 $description =
'In TYPO3 CMS 6.2 LTS the metadata has been split off to an external table. This wizard will migrate the data. If you have extended the sys_file table manually your custom data will be included, too, if you create TCA and columns in sys_file_metadata before running this wizard.';
47 if (!array_key_exists($this->metaDataTable,
$GLOBALS[
'TYPO3_DB']->admin_get_tables())) {
50 $fields =
$GLOBALS[
'TYPO3_DB']->admin_get_fields(
'sys_file');
52 if (isset($fields[
'width']) && isset($fields[
'height'])) {
54 $sysFileCount =
$GLOBALS[
'TYPO3_DB']->exec_SELECTcountRows(
'uid',
'sys_file');
55 $sysFileMetaDataCount =
$GLOBALS[
'TYPO3_DB']->exec_SELECTcountRows(
'uid', $this->metaDataTable);
56 $result = $sysFileCount > $sysFileMetaDataCount;
74 if (!array_key_exists($this->metaDataTable,
$GLOBALS[
'TYPO3_DB']->admin_get_tables())) {
75 $customMessages =
'ERROR! Make sure you already created the table. If you added custom metadata to sys_file table add TCA ' .
76 'configuration as well as SQL definitions to sys_file_metadata, too.';
81 if (empty($fieldsToMigrate)) {
84 $fieldsToWrite = $fieldsToMigrate;
85 $fieldsToWrite[] =
'file';
86 $fieldsToSelect = $fieldsToMigrate;
87 $fieldsToSelect[] =
'uid AS file';
89 $resultObject =
$GLOBALS[
'TYPO3_DB']->sql_query(
90 'INSERT INTO ' . $this->metaDataTable .
' (' . implode(
',', $fieldsToWrite) .
')' .
91 ' SELECT ' . implode(
',', $fieldsToSelect) .
93 ' WHERE uid NOT IN (SELECT file FROM ' . $this->metaDataTable .
')');
95 return $resultObject !== FALSE;
105 $fieldsBlackListed = array(
'uid',
'deleted',
'sys_language_uid');
106 $fieldsInSysFile = array_keys(
$GLOBALS[
'TYPO3_DB']->admin_get_fields(
'sys_file'));
107 $fieldsInSysFileMetaData = array_keys(
$GLOBALS[
'TYPO3_DB']->admin_get_fields($this->metaDataTable));
109 $commonFields = array_intersect($fieldsInSysFileMetaData, $fieldsInSysFile);
110 $commonFields = array_diff($commonFields, $fieldsBlackListed);
112 return $commonFields;
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
checkForUpdate(&$description)
performUpdate(array &$dbQueries, &$customMessages)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]