(new DefinitionParameter('show_hidden', $l->t('Show hidden files')))
->setType(DefinitionParameter::VALUE_BOOLEAN)
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
+ (new DefinitionParameter('case_sensitive', $l->t('Case sensitive file system')))
+ ->setType(DefinitionParameter::VALUE_BOOLEAN)
+ ->setFlag(DefinitionParameter::FLAG_OPTIONAL)
+ ->setDefaultValue(true)
+ ->setTooltip($l->t('Disabling it will allow to use a case insentive file system, but comes with a performance penalty')),
(new DefinitionParameter('check_acl', $l->t('Verify ACL access when listing files')))
->setType(DefinitionParameter::VALUE_BOOLEAN)
->setFlag(DefinitionParameter::FLAG_OPTIONAL)
/** @var bool */
protected $showHidden;
+ private bool $caseSensitive;
+
/** @var bool */
protected $checkAcl;
$this->root = rtrim($this->root, '/') . '/';
$this->showHidden = isset($params['show_hidden']) && $params['show_hidden'];
+ $this->caseSensitive = (bool) ($params['case_sensitive'] ?? true);
$this->checkAcl = isset($params['check_acl']) && $params['check_acl'];
$this->statCache = new CappedMemoryCache();
if ($this->isRootDir($source) || $this->isRootDir($target)) {
return false;
}
+ if ($this->caseSensitive === false
+ && mb_strtolower($target) === mb_strtolower($source)
+ ) {
+ // Forbid changing case only on case-insensitive file system
+ return false;
+ }
$absoluteSource = $this->buildPath($source);
$absoluteTarget = $this->buildPath($target);
public function file_exists($path) {
try {
+ if ($this->caseSensitive === false) {
+ $filename = basename($path);
+ $siblings = $this->getDirectoryContent(dirname($this->buildPath($path)));
+ foreach ($siblings as $sibling) {
+ if ($sibling['name'] === $filename) {
+ return true;
+ }
+ }
+ return false;
+ }
$this->getFileInfo($path);
return true;
} catch (NotFoundException $e) {