32 protected $objectType =
'TYPO3\\CMS\\Core\\Resource\\ResourceStorage';
37 protected $table =
'sys_file_storage';
60 parent::__construct();
64 $this->logger = $logManager->getLogger(__CLASS__);
75 if (isset(self::$storageRowCache[
$uid])) {
76 return $this->factory->getStorageObject($uid, self::$storageRowCache[$uid]);
88 if (static::$storageRowCache === NULL) {
90 static::$storageRowCache = $this->db->exec_SELECTgetRows(
104 if (static::$storageRowCache === array()) {
105 $storageObjectsExists = $this->db->exec_SELECTgetSingleRow(
'uid', $this->table,
'');
106 if ($storageObjectsExists !== NULL) {
107 if ($this->createLocalStorage(
108 'fileadmin/ (auto-created)',
109 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'fileadminDir'],
111 'This is the local fileadmin/ directory. This storage mount has been created automatically by TYPO3.',
115 static::$storageRowCache = NULL;
130 public function findByStorageType($storageType) {
136 $storageObjects = array();
137 foreach (static::$storageRowCache as $storageRow) {
138 if ($storageRow[
'driver'] !== $storageType) {
141 if ($driverRegistry->driverExists($storageRow[
'driver'])) {
142 $storageObjects[] = $this->factory->getStorageObject($storageRow[
'uid'], $storageRow);
144 $this->logger->warning(
145 sprintf(
'Could not instantiate storage "%s" because of missing driver.', array($storageRow[
'name'])),
150 return $storageObjects;
165 $storageObjects = array();
166 foreach (static::$storageRowCache as $storageRow) {
167 if ($driverRegistry->driverExists($storageRow[
'driver'])) {
168 $storageObjects[] = $this->factory->getStorageObject($storageRow[
'uid'], $storageRow);
170 $this->logger->warning(
171 sprintf(
'Could not instantiate storage "%s" because of missing driver.', array($storageRow[
'name'])),
176 return $storageObjects;
189 public function createLocalStorage($name, $basePath, $pathType, $description =
'', $default = FALSE) {
190 $caseSensitive = $this->
testCaseSensitivity($pathType ===
'relative' ? PATH_site . $basePath : $basePath);
192 $flexFormData = array(
196 'basePath' => array(
'vDEF' => rtrim($basePath,
'/') .
'/'),
197 'pathType' => array(
'vDEF' => $pathType),
198 'caseSensitive' => array(
'vDEF' => $caseSensitive)
206 $flexFormXml = $flexObj->flexArray2Xml($flexFormData, TRUE);
209 $field_values = array(
214 'description' => $description,
216 'configuration' => $flexFormXml,
221 'is_default' => $default ? 1 : 0
223 $this->db->exec_INSERTquery(
'sys_file_storage', $field_values);
224 return (
int)$this->db->sql_insert_id();
234 return $this->factory->getStorageObject($databaseRow[
'uid'], $databaseRow);
244 $caseSensitive = TRUE;
245 $path = rtrim($absolutePath,
'/') .
'/aAbB';
246 $testFileExists = @file_exists($path);
249 if (!$testFileExists) {
254 if (@file_exists(strtoupper($path)) && @file_exists(strtolower($path))) {
255 $caseSensitive = FALSE;
259 if (!$testFileExists) {
263 return $caseSensitive;
createDomainObject(array $databaseRow)
static makeInstance($className)
testCaseSensitivity($absolutePath)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
getWhereClauseForEnabledFields()