/**
  * Returns a list of mountpoints that are available in the VFS.
  * In case no storage exists this automatically created a storage for fileadmin/
  *
  * @return \TYPO3\CMS\Core\Resource\ResourceStorage[]
  */
 public function findAll()
 {
     // check if we have never created a storage before (no records, regardless of the enableFields),
     // only fetch one record for that (is enough). If no record is found, create the fileadmin/ storage
     $storageObjectsCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $this->table, '1=1');
     if ($storageObjectsCount === 0) {
         $this->createLocalStorage('fileadmin/ (auto-created)', $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], 'relative', 'This is the local fileadmin/ directory. This storage mount has been created automatically by TYPO3.');
     }
     $storageObjects = array();
     $whereClause = NULL;
     if ($this->type != '') {
         $whereClause = $this->typeField . ' = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->type, $this->table);
     }
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->table, ($whereClause ? $whereClause : '1=1') . $this->getWhereClauseForEnabledFields());
     /** @var $driverRegistry \TYPO3\CMS\Core\Resource\Driver\DriverRegistry */
     $driverRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Driver\\DriverRegistry');
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         if ($driverRegistry->driverExists($row['driver'])) {
             $storageObjects[] = $this->createDomainObject($row);
         } else {
             $this->logger->warning(sprintf('Could not instantiate storage "%s" because of missing driver.', array($row['name'])), $row);
         }
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     return $storageObjects;
 }
 /**
  * Returns a list of mountpoints that are available in the VFS.
  * In case no storage exists this automatically created a storage for fileadmin/
  *
  * @return ResourceStorage[]
  */
 public function findAll()
 {
     $this->initializeLocalCache();
     /** @var $driverRegistry Driver\DriverRegistry */
     $driverRegistry = GeneralUtility::makeInstance(Driver\DriverRegistry::class);
     $storageObjects = array();
     foreach (static::$storageRowCache as $storageRow) {
         if ($driverRegistry->driverExists($storageRow['driver'])) {
             $storageObjects[] = $this->factory->getStorageObject($storageRow['uid'], $storageRow);
         } else {
             $this->logger->warning(sprintf('Could not instantiate storage "%s" because of missing driver.', array($storageRow['name'])), $storageRow);
         }
     }
     return $storageObjects;
 }
Esempio n. 3
0
 /**
  * Appends the processors to the given logger as configured.
  *
  * @param \TYPO3\CMS\Core\Log\Logger $logger Logger to configure
  * @return void
  * @throws \RangeException
  */
 protected function setProcessorsForLogger(\TYPO3\CMS\Core\Log\Logger $logger)
 {
     $configuration = $this->getConfigurationForLogger(self::CONFIGURATION_TYPE_PROCESSOR, $logger->getName());
     foreach ($configuration as $severityLevel => $processor) {
         foreach ($processor as $logProcessorClassName => $logProcessorOptions) {
             /** @var $logProcessor \TYPO3\CMS\Core\Log\Processor\ProcessorInterface */
             $logProcessor = NULL;
             try {
                 $logProcessor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($logProcessorClassName, $logProcessorOptions);
                 $logger->addProcessor($severityLevel, $logProcessor);
             } catch (\RangeException $e) {
                 $logger->warning('Instantiation of LogProcessor "' . $logProcessorClassName . '" failed for logger ' . $logger->getName() . ' (' . $e->getMessage() . ')');
             }
         }
     }
 }
Esempio n. 4
0
 /**
  * @test
  */
 public function loggerLogsRecord()
 {
     $logger = new Logger('test.core.log');
     /** @var NullWriter|\PHPUnit_Framework_MockObject_MockObject $writer */
     $writer = $this->getMock(NullWriter::class, array('writeLog'));
     $writer->expects($this->once())->method('writeLog');
     $logger->addWriter(LogLevel::DEBUG, $writer);
     $logger->warning('test');
 }