/**
  * @param array $extensionInformation
  */
 public function setExtensionInformation(array $extensionInformation)
 {
     $this->registry->set(static::REGISTRY_NAMESPACE, static::REGISTRY_KEY, array_keys($extensionInformation));
     foreach ($extensionInformation as $extensionKey => $information) {
         $this->registry->set(static::REGISTRY_NAMESPACE, $extensionKey, $information);
     }
 }
 /**
  * Update version matrix from remote and store in registry
  *
  * @return void
  * @throws Exception\RemoteFetchException
  */
 public function updateVersionMatrix()
 {
     $versionArray = $this->fetchVersionMatrixFromRemote();
     // This is a 'hack' to keep the string stored in the registry small. We are usually only
     // interested in information from 7 and up and older releases do not matter in current
     // use cases. If this unset() is removed and everything is stored for some reason, the
     // table sys_file field entry_value needs to be extended from blob to longblob.
     unset($versionArray['6.2'], $versionArray['6.1'], $versionArray['6.0'], $versionArray['4.7'], $versionArray['4.6'], $versionArray['4.5'], $versionArray['4.4'], $versionArray['4.3'], $versionArray['4.2'], $versionArray['4.1'], $versionArray['4.0'], $versionArray['3.8'], $versionArray['3.7'], $versionArray['3.6'], $versionArray['3.5'], $versionArray['3.3']);
     $this->registry->set('TYPO3.CMS.Install', 'coreVersionMatrix', $versionArray);
 }
 /**
  * Update version matrix from remote and store in registry
  *
  * @return void
  * @throws Exception\RemoteFetchException
  */
 public function updateVersionMatrix()
 {
     $versionArray = $this->fetchVersionMatrixFromRemote();
     $installedMajorVersion = (int) $this->getInstalledMajorVersion();
     foreach ($versionArray as $versionNumber => $versionDetails) {
         if (is_array($versionDetails) && (int) $this->getMajorVersion($versionNumber) < $installedMajorVersion) {
             unset($versionArray[$versionNumber]);
         }
     }
     $this->registry->set('TYPO3.CMS.Install', 'coreVersionMatrix', $versionArray);
 }
 /**
  * Flush menu cache for pages that were automatically published
  * between two runs of this command
  *
  * @return void
  */
 public function clearMenuForPulishedPagesCommand()
 {
     $current = time();
     $last = $this->registry->get('tx_autoflush', self::REGISTRY_KEY, $current);
     $pages = $this->findPagesPublishedBetween($last, $current);
     $pids = array();
     if ($pages) {
         foreach ($pages as $page) {
             $pids[$page['pid']] = $page['pid'];
         }
     }
     foreach ($pids as $pid) {
         $this->cacheManager->flushCachesInGroupByTag('pages', 'menu_pid_' . $pid);
     }
     $this->registry->set('tx_autoflush', self::REGISTRY_KEY, $current);
 }
 /**
  * @test
  */
 public function setUpdatesExistingKeys()
 {
     $GLOBALS['TYPO3_DB']->expects($this->once())->method('exec_SELECTquery')->with('uid', 'sys_registry', 'entry_namespace = \'tx_phpunit\' AND entry_key = \'someKey\'')->will($this->returnValue('DBResource'));
     $GLOBALS['TYPO3_DB']->expects($this->once())->method('sql_num_rows')->with('DBResource')->will($this->returnValue(1));
     $GLOBALS['TYPO3_DB']->expects($this->once())->method('exec_UPDATEquery')->with('sys_registry', 'entry_namespace = \'tx_phpunit\' AND entry_key = \'someKey\'', array('entry_value' => serialize('someValue')));
     $GLOBALS['TYPO3_DB']->expects($this->never())->method('exec_INSERTquery');
     $this->registry->set('tx_phpunit', 'someKey', 'someValue');
 }
 /**
  * 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);
 }
 /**
  * Imports files from Initialisation/Files to fileadmin
  * via lowlevel copy directory method
  *
  * @param string $extensionSiteRelPath relative path to extension dir
  * @param string $extensionKey
  */
 protected function importInitialFiles($extensionSiteRelPath, $extensionKey)
 {
     $importRelFolder = $extensionSiteRelPath . 'Initialisation/Files';
     if (!$this->registry->get('extensionDataImport', $importRelFolder)) {
         $importFolder = PATH_site . $importRelFolder;
         if (file_exists($importFolder)) {
             $destinationRelPath = $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] . $extensionKey;
             $destinationAbsolutePath = PATH_site . $destinationRelPath;
             if (!file_exists($destinationAbsolutePath) && \TYPO3\CMS\Core\Utility\GeneralUtility::isAllowedAbsPath($destinationAbsolutePath)) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir($destinationAbsolutePath);
             }
             \TYPO3\CMS\Core\Utility\GeneralUtility::copyDirectory($importRelFolder, $destinationRelPath);
             $this->registry->set('extensionDataImport', $importRelFolder, 1);
             $this->emitAfterExtensionFileImportSignal($destinationAbsolutePath);
         }
     }
 }
Exemple #8
0
 /**
  * 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);
 }
Exemple #9
0
 protected function storeLastAccessedFalPath($falPath)
 {
     $this->registry->set('tx_yag', 'lastAccessedFalPath', $falPath);
 }
Exemple #10
0
 /**
  * Add / override registry entry
  *
  * @param string $name Registry entry name
  * @param mixed $value The value
  * @param string $namespace Optional namespace
  * @return void
  */
 public function set($name, $value, $namespace = null)
 {
     $namespace = is_string($namespace) ? $namespace : $this->namespaceIdentifier;
     $this->registry->set($namespace, $name, $value);
 }
 /**
  * Reset the expire date
  *
  * @return void
  */
 public function resetExpireDate()
 {
     $this->registry->set('tx_kdcalendar', 'eventsexpired_' . $this->calendar->getId(), time() + 24 * 60 * 60);
 }
 /**
  * @test
  * @expectedException \InvalidArgumentException
  */
 public function setThrowsAnExceptionOnWrongNamespace()
 {
     $this->registry->set('t', 'someKey', 'someValue');
 }
 /**
  * Reset the expire date
  *
  * @return void
  */
 public function resetExpireDate()
 {
     $this->registry->set('tx_kdcalendar', 'calendarexpired', time() + 24 * 60 * 60);
 }
 /**
  * Set the access token to the registry
  *
  * @param string $accessToken
  */
 public function setCredentials($accessToken)
 {
     $this->registry->set('tx_kdcalendar', 'accessToken', $accessToken);
 }
 /**
  * Stores the session token in the registry to have it
  * available during re-login of the user.
  *
  * @access private
  * @return void
  */
 public function storeSessionTokenInRegistry()
 {
     $this->registry->set('core', 'formProtectionSessionToken:' . $this->backendUser->user['uid'], $this->getSessionToken());
 }