Esempio n. 1
0
 /**
  * Execute certain hook handle
  *
  * @return void
  */
 public function executeHookHandler()
 {
     if (\XLite\Upgrade\Cell::getInstance()->isUpgraded()) {
         $entries = \XLite\Upgrade\Cell::getInstance()->getEntries();
         if ($entries) {
             \Includes\Utils\Operator::showMessage('', true, false);
             /** @var \XLite\Upgrade\Entry\AEntry $entry */
             foreach ($entries as $entry) {
                 if (!$entry->isPostUpgradeActionsCalled()) {
                     $message = '...Invoke actions for ' . $entry->getActualName();
                     \Includes\Decorator\Utils\CacheManager::logMessage(PHP_EOL);
                     \Includes\Decorator\Utils\CacheManager::logMessage($message);
                     $isInvoked = \XLite\Upgrade\Cell::getInstance()->runHelper($entry, 'post_rebuild');
                     if ($isInvoked && \XLite\Upgrade\Cell::getInstance()->getHookRedirect()) {
                         break;
                     }
                     if (!\XLite\Upgrade\Cell::getInstance()->hasUnfinishedUpgradeHooks('post_rebuild', $entry)) {
                         // All post-rebuild hooks completed, run the rest actions...
                         \XLite\Upgrade\Cell::getInstance()->runCommonHelper($entry, 'add_labels');
                         \XLite\Upgrade\Cell::getInstance()->callInstallEvent($entry);
                         $entry->setPostUpgradeActionsCalled();
                     }
                     if (\Includes\Decorator\Utils\CacheManager::isTimeExceeds(static::STEP_TTL)) {
                         break;
                     }
                 }
             }
         }
     }
     \Includes\Decorator\Utils\CacheManager::logMessage(PHP_EOL);
     \XLite\Core\Database::getEM()->flush();
     \XLite\Core\Database::getEM()->clear();
 }
Esempio n. 2
0
 /**
  * Execute certain hook handle
  *
  * @return void
  */
 public function executeHookHandler()
 {
     $list = \Includes\Decorator\Plugin\Doctrine\Utils\FixturesManager::getFixtures();
     if ($list) {
         \Includes\Utils\Operator::showMessage('', true, false);
         foreach ($list as $fixture) {
             $message = '...Load ' . substr($fixture, strlen(LC_DIR_ROOT));
             \Includes\Utils\Operator::showMessage($message, true, true);
             \Includes\Decorator\Utils\CacheManager::logMessage(PHP_EOL);
             \Includes\Decorator\Utils\CacheManager::logMessage($message);
             if (static::isYAML($fixture)) {
                 // Load YAML fixture
                 \XLite\Core\Database::getInstance()->loadFixturesFromYaml($fixture);
             } else {
                 // Load SQL queries
                 \Includes\Utils\Database::uploadSQLFromFile($fixture);
             }
             \Includes\Decorator\Plugin\Doctrine\Utils\FixturesManager::removeFixtureFromList($fixture);
             if (\Includes\Decorator\Utils\CacheManager::isTimeExceeds(static::STEP_TTL)) {
                 break;
             }
         }
     }
     \Includes\Decorator\Utils\CacheManager::logMessage(PHP_EOL);
     \XLite\Core\Database::getEM()->clear();
 }