/**
  * @return array
  */
 public function getExtensionInformation()
 {
     $extensionInformation = array();
     $extensionKeys = $this->registry->get(static::REGISTRY_NAMESPACE, static::REGISTRY_KEY, array());
     foreach ($extensionKeys as $extensionKey) {
         $extensionInformation[$extensionKey] = $this->registry->get(static::REGISTRY_NAMESPACE, $extensionKey, array());
     }
     return $extensionInformation;
 }
 /**
  * Initialize the storage repository.
  */
 public function init()
 {
     /** @var $storageRepository \TYPO3\CMS\Core\Resource\StorageRepository */
     $storageRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository');
     $storages = $storageRepository->findAll();
     $this->storage = $storages[0];
     $this->registry = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
     $this->recordOffset = $this->registry->get($this->registryNamespace, 'recordOffset', array());
 }
 /**
  * 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);
         }
     }
 }
 /**
  * Checks if the events have expired
  *
  * @return boolean
  */
 public function eventsExpired()
 {
     if ($this->registry->get('tx_kdcalendar', 'eventsexpired_' . $this->calendar->getId()) <= time()) {
         return TRUE;
     }
     return FALSE;
 }
 /**
  * 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);
 }
Exemple #6
0
 /**
  * Initialize the storage repository.
  */
 public function init()
 {
     $storages = GeneralUtility::makeInstance(StorageRepository::class)->findAll();
     $this->storage = $storages[0];
     $this->registry = GeneralUtility::makeInstance(Registry::class);
     $this->recordOffset = $this->registry->get($this->registryNamespace, 'recordOffset', []);
 }
 /**
  * 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;
 }
 /**
  * Sets the session token for the user from the registry
  * and returns it additionally.
  *
  * @access private
  * @return string
  * @throws \UnexpectedValueException
  */
 public function setSessionTokenFromRegistry()
 {
     $this->sessionToken = $this->registry->get('core', 'formProtectionSessionToken:' . $this->backendUser->user['uid']);
     if (empty($this->sessionToken)) {
         throw new \UnexpectedValueException('Failed to restore the session token from the registry.', 1301827270);
     }
     return $this->sessionToken;
 }
 /**
  * Get the access token to the calendar
  *
  * @return string
  *
  * @throws \KevinDitscheid\KdCalendar\Exception\NoCredentialsException
  */
 public function getCredentials()
 {
     $accessToken = $this->registry->get('tx_kdcalendar', 'accessToken');
     if (!$accessToken) {
         throw new \KevinDitscheid\KdCalendar\Exception\NoCredentialsException('No crendetials found!', 1460891865);
     }
     $this->client->setAccessToken($accessToken);
     if ($this->client->isAccessTokenExpired()) {
         $this->refreshToken();
     }
     return $this->client->getAccessToken();
 }
 /**
  * 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 #12
0
 protected function retrieveLastAccessedFalPath()
 {
     return $this->registry->get('tx_yag', 'lastAccessedFalPath');
 }
Exemple #13
0
 /**
  * Get registry entry
  *
  * @param string $name Registry entry name
  * @param string $namespace Optional namespace
  * @return mixed Registry content
  */
 public function get($name, $namespace = null)
 {
     $namespace = is_string($namespace) ? $namespace : $this->namespaceIdentifier;
     return $this->registry->get($namespace, $name);
 }
 /**
  * @test
  */
 public function getReturnsTheDefaultValueIfTheRequestedKeyWasNotFound()
 {
     $defaultValue = 'getReturnsTheDefaultValueIfTheRequestedKeyWasNotFound';
     $GLOBALS['TYPO3_DB']->expects($this->once())->method('exec_SELECTgetRows')->with('*', 'sys_registry', 'entry_namespace = \'tx_phpunit\'')->will($this->returnValue(array(array('entry_key' => 'foo', 'entry_value' => 'bar'))));
     $this->assertEquals($defaultValue, $this->registry->get('tx_phpunit', 'someNonExistingKey', $defaultValue), 'A value other than the default value was returned.');
 }
 /**
  *
  */
 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);
 }