DmitryDulepov\Realurl\Utility::checkAndPerformRequiredUpdates PHP 메소드

checkAndPerformRequiredUpdates() 공개 정적인 메소드

Checks if required update should run and runs it if necessary.
public static checkAndPerformRequiredUpdates ( ) : void
리턴 void
    public static function checkAndPerformRequiredUpdates()
    {
        $currentUpdateLevel = 2;
        $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
        /** @var \TYPO3\CMS\Core\Registry $registry */
        $updateLevel = (int) $registry->get('tx_realurl', 'updateLevel', 0);
        if ($updateLevel < $currentUpdateLevel) {
            require_once ExtensionManagementUtility::extPath('realurl', 'class.ext_update.php');
            $updater = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('DmitryDulepov\\Realurl\\ext_update');
            /** @var \DmitryDulepov\Realurl\ext_update $updater */
            if ($updater->access()) {
                $updater->main();
            }
            $registry->set('tx_realurl', 'updateLevel', $currentUpdateLevel);
        }
    }

Usage Example

예제 #1
0
 /**
  * Initializes the class.
  */
 public function __construct()
 {
     Utility::checkAndPerformRequiredUpdates();
     $this->databaseConnection = $GLOBALS['TYPO3_DB'];
     $this->tsfe = $GLOBALS['TSFE'];
     // Warning! It is important to init the new object and not reuse any existing object
     // $this->pageRepository->sys_language_uid must stay 0 because we will do overlays manually
     $this->pageRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
     $this->pageRepository->init(FALSE);
 }
All Usage Examples Of DmitryDulepov\Realurl\Utility::checkAndPerformRequiredUpdates