Esempio n. 1
0
 /**
  * Method updates TYPO3 database with up-to-date
  * extension version records.
  *
  * @return bool TRUE if the extension list was successfully update, FALSE if no update necessary
  * @throws ExtensionManagerException
  * @see isExtListUpdateNecessary()
  */
 public function updateExtList()
 {
     $updated = false;
     $updateNecessity = $this->isExtListUpdateNecessary();
     if ($updateNecessity !== 0) {
         // retrieval of file necessary
         $tmpBitmask = self::PROBLEM_EXTENSION_FILE_NOT_EXISTING | self::PROBLEM_EXTENSION_HASH_CHANGED;
         if (($tmpBitmask & $updateNecessity) > 0) {
             $this->fetchExtListFile();
             $updateNecessity &= ~$tmpBitmask;
         }
         // database table cleanup
         if ($updateNecessity & self::PROBLEM_NO_VERSIONS_IN_DATABASE) {
             $updateNecessity &= ~self::PROBLEM_NO_VERSIONS_IN_DATABASE;
         } else {
             // Use straight query as extbase "remove" is too slow here
             // This truncates the whole table. It would be more correct to remove only rows of a specific
             // repository, but multiple repository handling is not implemented, and truncate is quicker.
             $this->getDatabaseConnection()->exec_TRUNCATEquery('tx_extensionmanager_domain_model_extension');
         }
         // no further problems - start of import process
         if ($updateNecessity === 0) {
             $uid = $this->repository->getUid();
             /* @var $objExtListImporter \TYPO3\CMS\Extensionmanager\Utility\Importer\ExtensionListUtility */
             $objExtListImporter = $this->objectManager->get(\TYPO3\CMS\Extensionmanager\Utility\Importer\ExtensionListUtility::class);
             $objExtListImporter->import($this->getLocalExtListFile(), $uid);
             $updated = true;
         }
     }
     return $updated;
 }
Esempio n. 2
0
 /**
  * Method updates TYPO3 database with up-to-date
  * extension version records.
  *
  * @return boolean TRUE if the extension list was successfully update, FALSE if no update necessary
  * @see isExtListUpdateNecessary()
  */
 public function updateExtList()
 {
     $updated = FALSE;
     $updateNecessity = $this->isExtListUpdateNecessary();
     if ($updateNecessity !== 0) {
         // retrieval of file necessary
         $tmpBitmask = self::PROBLEM_EXTENSION_FILE_NOT_EXISTING | self::PROBLEM_EXTENSION_HASH_CHANGED;
         if (($tmpBitmask & $updateNecessity) > 0) {
             $this->fetchExtListFile();
             $updateNecessity &= ~$tmpBitmask;
         }
         // database table cleanup
         if ($updateNecessity & self::PROBLEM_NO_VERSIONS_IN_DATABASE) {
             $updateNecessity &= ~self::PROBLEM_NO_VERSIONS_IN_DATABASE;
         } else {
             // using straight sql here as extbases "remove" runs into memory problems
             $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_extensionmanager_domain_model_extension', 'repository=' . $this->repository->getUid());
         }
         // no further problems - start of import process
         if ($updateNecessity === 0) {
             $uid = $this->repository->getUid();
             /* @var $objExtListImporter \TYPO3\CMS\Extensionmanager\Utility\Importer\ExtensionListUtility */
             $objExtListImporter = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\Importer\\ExtensionListUtility');
             $objExtListImporter->import($this->getLocalExtListFile(), $uid);
             $updated = TRUE;
         }
     }
     return $updated;
 }