25 protected $title =
'FlexForm Data from Media Element';
47 $mediaElements = $this->db->exec_SELECTcountRows(
'*',
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'contentTable'],
'CType = ' . $this->db->fullQuoteStr(
'media',
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'contentTable']) .
' AND pi_flexform LIKE ' . $this->db->fullQuoteStr(
'%<sheet index="sDEF">%',
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'contentTable']));
48 if ($mediaElements > 0) {
49 $description =
'You have media elements within your installation. As the structure of the flexform changed, your data needs to be migrated.';
52 $description =
'You currently have no media elements within your installation. Therefore nothing to be migrated';
55 return $showUpdate > 0;
65 public function performUpdate(array &$dbQueries, &$customMessages) {
66 $rows = $this->db->exec_SELECTgetRows(
68 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'contentTable'],
69 'CType = ' . $this->db->fullQuoteStr(
'media',
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'contentTable']) .
' AND pi_flexform LIKE ' . $this->db->fullQuoteStr(
'%<sheet index="sDEF">%',
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'contentTable'])
73 foreach ($rows as $row) {
74 $flexFormXML = $row[
'pi_flexform'];
76 $sDEF = $data[
'data'][
'sDEF'][
'lDEF'];
77 unset($data[
'data'][
'sDEF']);
78 $type = $sDEF[
'mmType'][
'vDEF'];
79 $data[
'data'][
'sGeneral'] = array(
81 'mmType' => array(
'vDEF' => $type)
84 $width = $sDEF[
'mmWidth'][
'vDEF'];
86 $data[
'data'][
'sGeneral'][
'lDEF'][
'mmWidth'] = array(
'vDEF' => (
int)$width);
88 $height = $sDEF[
'mmHeight'][
'vDEF'];
90 $data[
'data'][
'sGeneral'][
'lDEF'][
'mmHeight'] = array(
'vDEF' => (
int)$height);
94 $data[
'data'][
'sVideo'] = array(
'lDEF' => array(
'mmFile' => array(
'vDEF' => $sDEF[
'mmFile'][
'vDEF'])));
97 $data[
'data'][
'sAudio'] = array(
'lDEF' => array(
'mmAudioFallback' => array(
'vDEF' => $sDEF[
'mmFile'][
'vDEF'])));
102 $newXML = $flexformTools->flexArray2Xml($data, TRUE);
103 $newXML = str_replace(
'encoding=""',
'encoding="utf-8"', $newXML);
104 $this->db->exec_UPDATEquery(
105 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'contentTable'],
106 'uid = ' . $row[
'uid'],
107 array(
'pi_flexform' => $newXML)
performUpdate(array &$dbQueries, &$customMessages)
static makeInstance($className)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static xml2array($string, $NSprefix='', $reportDocTag=FALSE)