Esempio n. 1
0
 /**
  * @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);
     }
 }
 /**
  * If the installed extension is static_info_tables or a language pack, execute the update script
  *
  * @param string $extensionKey: the key of the extension that was installed
  * @param \TYPO3\CMS\Extensionmanager\Utility\InstallUtility $installUtility
  * @return void
  */
 public function executeUpdateScript($extensionKey, \TYPO3\CMS\Extensionmanager\Utility\InstallUtility $installUtility)
 {
     if (strpos($extensionKey, 'static_info_tables') === 0) {
         $extensionKeyParts = explode('_', $extensionKey);
         if (count($extensionKeyParts) === 3) {
             $extTablesStaticSqlRelFile = substr(ExtensionManagementUtility::extRelPath($extensionKey), 3) . 'ext_tables_static+adt.sql';
         }
         if (count($extensionKeyParts) === 3 && $this->registry->get('extensionDataImport', $extTablesStaticSqlRelFile) || count($extensionKeyParts) === 4 && strlen($extensionKeyParts[3]) === 2 || count($extensionKeyParts) === 5 && strlen($extensionKeyParts[3]) === 2 && strlen($extensionKeyParts[4]) === 2) {
             /** @var $updateScriptUtility \TYPO3\CMS\Extensionmanager\Utility\UpdateScriptUtility */
             $updateScriptUtility = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\UpdateScriptUtility');
             $updateScriptResult = $updateScriptUtility->executeUpdateIfNeeded($extensionKey);
         }
     }
 }
 /**
  * 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);
 }
 /**
  * Checks if the calendars have expired
  *
  * @return boolean
  */
 public function calendarsExpired()
 {
     if ($this->registry->get('tx_kdcalendar', 'calendarexpired') <= time()) {
         return TRUE;
     }
     return FALSE;
 }
 /**
  * Get version matrix from registry
  *
  * @return array
  * @throws Exception
  */
 protected function getVersionMatrix()
 {
     $versionMatrix = $this->registry->get('TYPO3.CMS.Install', 'coreVersionMatrix');
     if (empty($versionMatrix) || !is_array($versionMatrix)) {
         throw new Exception\CoreVersionServiceException('No version matrix found in registry, call updateVersionMatrix() first.', 1380898792);
     }
     return $versionMatrix;
 }
 /**
  * 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);
 }
Esempio n. 7
0
 /**
  * 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);
         }
     }
 }
Esempio n. 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);
 }
Esempio n. 9
0
 protected function retrieveLastAccessedFalPath()
 {
     return $this->registry->get('tx_yag', 'lastAccessedFalPath');
 }
Esempio n. 10
0
 /**
  * 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);
 }
Esempio n. 11
0
 /**
  * @test
  */
 public function removeAllByNamespaceReallyRemovesAllEntriesOfTheSpecifiedNamespaceFromTheDatabase()
 {
     $GLOBALS['TYPO3_DB']->expects($this->once())->method('exec_DELETEquery')->with('sys_registry', 'entry_namespace = \'tx_phpunit\'');
     $this->registry->removeAllByNamespace('tx_phpunit');
 }
Esempio n. 12
0
 /**
  * Reset the expire date
  *
  * @return void
  */
 public function resetExpireDate()
 {
     $this->registry->set('tx_kdcalendar', 'eventsexpired_' . $this->calendar->getId(), time() + 24 * 60 * 60);
 }
 /**
  *
  */
 public function startIndexingAction()
 {
     // make indexer instance and init
     /* @var $indexer tx_kesearch_indexer */
     $indexer = GeneralUtility::makeInstance('tx_kesearch_indexer');
     // get indexer configurations
     $indexerConfigurations = $indexer->getConfigurations();
     $content = '';
     // action: start indexer or remove lock
     if ($this->do == 'startindexer') {
         // start indexing in verbose mode with cleanup process
         $content .= $indexer->startIndexing(true, $this->extConf);
     } else {
         if ($this->do == 'rmLock') {
             // remove lock from registry - admin only!
             if ($this->getBackendUser()->user['admin']) {
                 $this->registry->removeAllByNamespace('tx_kesearch');
             } else {
                 $content .= '<p>' . LocalizationUtility::translate('LLL:EXT:ke_search/Resources/Private/Language/locallang_mod.xml:not_allowed_remove_indexer_lock', 'KeSearch') . '</p>';
             }
         }
     }
     // check for index process lock in registry
     // remove lock if older than 12 hours
     $lockTime = $this->registry->get('tx_kesearch', 'startTimeOfIndexer');
     $compareTime = time() - 60 * 60 * 12;
     if ($lockTime !== null && $lockTime < $compareTime) {
         // lock is older than 12 hours
         // remove lock and show "start index" button
         $this->registry->removeAllByNamespace('tx_kesearch');
         $lockTime = null;
     }
     // show information about indexer configurations and number of records
     // if action "start indexing" is not selected
     if ($this->do != 'startindexer') {
         $content .= $this->printNumberOfRecords();
         $content .= $this->printIndexerConfigurations($indexerConfigurations);
     }
     // show "start indexing" or "remove lock" button
     if ($lockTime !== null) {
         if (!$this->getBackendUser()->user['admin']) {
             // print warning message for non-admins
             $content .= '<br /><p style="color: red; font-weight: bold;">WARNING!</p>';
             $content .= '<p>The indexer is already running and can not be started twice.</p>';
         } else {
             // show 'remove lock' button for admins
             $content .= '<br /><p>The indexer is already running and can not be started twice.</p>';
             $content .= '<p>The indexing process was started at ' . strftime('%c', $lockTime) . '.</p>';
             $content .= '<p>You can remove the lock by clicking the following button.</p>';
             $moduleUrl = BackendUtility::getModuleUrl('web_KeSearchBackendModule', array('id' => $this->id, 'do' => 'rmLock'));
             $content .= '<br /><a class="lock-button" href="' . $moduleUrl . '">RemoveLock</a>';
         }
     } else {
         // no lock set - show "start indexer" link if indexer configurations have been found
         if ($indexerConfigurations) {
             $moduleUrl = BackendUtility::getModuleUrl('web_KeSearchBackendModule', array('id' => $this->id, 'do' => 'startindexer'));
             $content .= '<br /><a class="index-button" href="' . $moduleUrl . '">' . LocalizationUtility::translate('LLL:EXT:ke_search/Resources/Private/Language/locallang_mod.xml:start_indexer', 'KeSearch') . '</a>';
         } else {
             $content .= '<div class="alert alert-info">' . LocalizationUtility::translate('LLL:EXT:ke_search/Resources/Private/Language/locallang_mod.xml:no_indexer_configurations', 'KeSearch') . '</div>';
         }
     }
     $this->view->assign('content', $content);
 }
 /**
  * Set the access token to the registry
  *
  * @param string $accessToken
  */
 public function setCredentials($accessToken)
 {
     $this->registry->set('tx_kdcalendar', 'accessToken', $accessToken);
 }
 /**
  * Removes the session token for the user from the registry.
  *
  * @access private
  */
 public function removeSessionTokenFromRegistry()
 {
     $this->registry->remove('core', 'formProtectionSessionToken:' . $this->backendUser->user['uid']);
 }