/**
  * Executing the posted actions ...
  *
  * @return void
  * @todo Define visibility
  */
 public function main()
 {
     // LOAD TCEmain with data and cmd arrays:
     $this->tce->start($this->data, $this->cmd);
     if (is_array($this->mirror)) {
         $this->tce->setMirror($this->mirror);
     }
     // Checking referer / executing
     $refInfo = parse_url(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_REFERER'));
     $httpHost = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY');
     if ($httpHost != $refInfo['host'] && $this->vC != $GLOBALS['BE_USER']->veriCode() && !$GLOBALS['TYPO3_CONF_VARS']['SYS']['doNotCheckReferer']) {
         $this->tce->log('', 0, 0, 0, 1, 'Referer host "%s" and server host "%s" did not match and veriCode was not valid either!', 1, array($refInfo['host'], $httpHost));
     } else {
         // Register uploaded files
         $this->tce->process_uploads($_FILES);
         // Execute actions:
         $this->tce->process_datamap();
         $this->tce->process_cmdmap();
         // Clearing cache:
         $this->tce->clear_cacheCmd($this->cacheCmd);
         // Update page tree?
         if ($this->uPT && (isset($this->data['pages']) || isset($this->cmd['pages']))) {
             \TYPO3\CMS\Backend\Utility\BackendUtility::setUpdateSignal('updatePageTree');
         }
     }
 }
 /**
  * @param int $workspaceId
  */
 public function swapWorkspace($workspaceId)
 {
     $commandMap = $this->getWorkspaceService()->getCmdArrayForPublishWS($workspaceId, TRUE);
     $this->createDataHandler();
     $this->dataHandler->start(array(), $commandMap);
     $this->dataHandler->process_cmdmap();
 }
 /**
  * Deletes a specific record.
  *
  * @param string $table The table name for the record to delete.
  * @param integer $uid The UID for the record to delete.
  * @return void
  */
 public function doDelete($table, $uid)
 {
     $cmdData[$table][$uid]['delete'] = 1;
     if (count($cmdData)) {
         $this->initializeTceMain();
         $this->tce->start(array(), $cmdData);
         $this->tce->process_cmdmap();
     }
 }
 /**
  * @test
  */
 public function copyingNewContentFromLanguageIntoExistingLocalizationHasSameOrdering()
 {
     $params = ['pageId' => 1, 'srcLanguageId' => 0, 'destLanguageId' => 1, 'uidList' => [1, 2, 3], 'action' => LocalizationController::ACTION_COPY];
     $this->callInaccessibleMethod($this->subject, 'process', $params);
     // Create another content element in default language
     $data = ['tt_content' => ['NEW123456' => ['sys_language_uid' => 0, 'header' => 'Test content 2.5', 'pid' => -2]]];
     $dataHandler = new DataHandler();
     $dataHandler->start($data, []);
     $dataHandler->process_datamap();
     $dataHandler->process_cmdmap();
     $newContentElementUid = $dataHandler->substNEWwithIDs['NEW123456'];
     // Copy the new content element
     $params = ['pageId' => 1, 'srcLanguageId' => 0, 'destLanguageId' => 1, 'uidList' => [$newContentElementUid], 'action' => LocalizationController::ACTION_COPY];
     $this->callInaccessibleMethod($this->subject, 'process', $params);
     $expectedResults = [['pid' => '1', 'sys_language_uid' => '1', 'l18n_parent' => '0', 'header' => 'Test content 1 (copy 1)'], ['pid' => '1', 'sys_language_uid' => '1', 'l18n_parent' => '0', 'header' => 'Test content 2 (copy 1)'], ['pid' => '1', 'sys_language_uid' => '1', 'l18n_parent' => '0', 'header' => 'Test content 2.5 (copy 1)'], ['pid' => '1', 'sys_language_uid' => '1', 'l18n_parent' => '0', 'header' => 'Test content 3 (copy 1)']];
     $results = $this->getDatabaseConnection()->exec_SELECTgetRows('pid, sys_language_uid, l18n_parent, header', 'tt_content', 'pid = 1 AND sys_language_uid = 1', '', 'sorting ASC');
     $this->assertSame($expectedResults, $results);
 }