コード例 #1
0
 private function _killCacheIfNeeded(ehough_epilog_Logger $logger, $shouldLog)
 {
     $bootConfigService = tubepress_impl_patterns_sl_ServiceLocator::getBootHelperConfigService();
     $shouldKillCache = $bootConfigService->isCacheKillerTurnedOn();
     if (!$shouldKillCache) {
         return;
     }
     $elementName = $this->getBootCacheConfigElementName();
     $filePath = $bootConfigService->getAbsolutePathToCacheFileForElement($elementName);
     if (!file_exists($filePath)) {
         return;
     }
     if ($shouldLog) {
         $logger->debug(sprintf('Attempting to delete cache file for %s at %s', $elementName, $filePath));
     }
     $result = @unlink($filePath);
     if (!$shouldLog) {
         return;
     }
     if ($result === true) {
         $logger->debug(sprintf('Successfully deleted cache file for %s at %s', $elementName, $filePath));
     } else {
         $logger->warn(sprintf('Could not delete cache file for %s at %s. Please delete it manually.', $elementName, $filePath));
     }
 }
コード例 #2
0
 /**
  * Loads the PSR-0 class paths and any classmaps for this add-on into
  * the system's primary classloader.
  *
  * @param array                             $addons
  * @param ehough_pulsar_ComposerClassLoader $classLoader
  *
  * @return void
  */
 public function addClassHintsForAddons(array $addons, ehough_pulsar_ComposerClassLoader $classLoader)
 {
     if ($this->_retrievedFromCache) {
         return;
     }
     $bootConfigService = tubepress_impl_patterns_sl_ServiceLocator::getBootHelperConfigService();
     if (!$bootConfigService->isClassLoaderEnabled()) {
         return;
     }
     if ($this->_shouldLog) {
         $this->_logger->debug('Now registering add-on class hints');
     }
     /**
      * @var $addon tubepress_spi_addon_Addon
      */
     foreach ($addons as $addon) {
         $this->_addClassHints($addon, $classLoader);
     }
     if ($this->_shouldLog) {
         $this->_logger->debug('Done registering add-on class hints.');
     }
     $this->tryToCache($classLoader);
 }
コード例 #3
0
 private function _performBlacklisting(array &$addons)
 {
     $bootConfigService = tubepress_impl_patterns_sl_ServiceLocator::getBootHelperConfigService();
     $addonBlacklist = $bootConfigService->getAddonBlacklistArray();
     if ($this->_shouldLog) {
         $this->_logger->debug(sprintf('Add-on blacklist: %s', json_encode($addonBlacklist)));
     }
     $addonCount = count($addons);
     for ($x = 0; $x < $addonCount; $x++) {
         /**
          * @var $addon tubepress_spi_addon_Addon
          */
         $addon = $addons[$x];
         $addonName = $addon->getName();
         if (in_array($addonName, $addonBlacklist)) {
             unset($addons[$x]);
         }
     }
     if ($this->_shouldLog) {
         $this->_logger->debug(sprintf('After blacklist processing, we now have %d add-on(s)', count($addons)));
     }
 }