Merge pull request #19236 from owncloud/call_dot_directories_function
Replaces if ($file === '.' || $file === '..') by public function call isIgnoredDir
This commit is contained in:
commit
bcdb3c26da
|
@ -517,7 +517,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
|
|||
$dh = $this->opendir($path1);
|
||||
if (is_resource($dh)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if ($file === '.' || $file === '..') {
|
||||
if (\OC\Files\Filesystem::isIgnoredDir($file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
|
||||
$dh = $this->opendir($path);
|
||||
while ($file = readdir($dh)) {
|
||||
if ($file === '.' || $file === '..') {
|
||||
if (\OC\Files\Filesystem::isIgnoredDir($file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -429,7 +429,7 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
|
||||
$dh = $this->opendir($path1);
|
||||
while ($file = readdir($dh)) {
|
||||
if ($file === '.' || $file === '..') {
|
||||
if (\OC\Files\Filesystem::isIgnoredDir($file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -895,7 +895,7 @@ class Trashbin {
|
|||
$view = new \OC\Files\View('/' . $user . '/files_trashbin');
|
||||
if ($view->is_dir('/files') && $dh = $view->opendir('/files')) {
|
||||
while ($file = readdir($dh)) {
|
||||
if ($file !== '.' and $file !== '..') {
|
||||
if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ abstract class Common implements Storage {
|
|||
$dh = $this->opendir($path);
|
||||
if (is_resource($dh)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if ($file !== '.' and $file !== '..') {
|
||||
if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
|
||||
if ($this->is_dir($path . '/' . $file)) {
|
||||
mkdir($target . '/' . $file);
|
||||
$this->addLocalFolder($path . '/' . $file, $target . '/' . $file);
|
||||
|
@ -283,7 +283,7 @@ abstract class Common implements Storage {
|
|||
$dh = $this->opendir($dir);
|
||||
if (is_resource($dh)) {
|
||||
while (($item = readdir($dh)) !== false) {
|
||||
if ($item == '.' || $item == '..') continue;
|
||||
if (\OC\Files\Filesystem::isIgnoredDir($item)) continue;
|
||||
if (strstr(strtolower($item), strtolower($query)) !== false) {
|
||||
$files[] = $dir . '/' . $item;
|
||||
}
|
||||
|
|
|
@ -283,7 +283,7 @@ class Local extends \OC\Files\Storage\Common {
|
|||
$files = array();
|
||||
$physicalDir = $this->getSourcePath($dir);
|
||||
foreach (scandir($physicalDir) as $item) {
|
||||
if ($item == '.' || $item == '..')
|
||||
if (\OC\Files\Filesystem::isIgnoredDir($item))
|
||||
continue;
|
||||
$physicalItem = $physicalDir . '/' . $item;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ trait CopyDirectory {
|
|||
$dh = $this->opendir($source);
|
||||
$result = true;
|
||||
while ($file = readdir($dh)) {
|
||||
if ($file !== '.' and $file !== '..') {
|
||||
if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
|
||||
if ($this->is_dir($source . '/' . $file)) {
|
||||
$this->mkdir($target . '/' . $file);
|
||||
$result = $this->copyRecursive($source . '/' . $file, $target . '/' . $file);
|
||||
|
|
|
@ -1669,7 +1669,7 @@ class View {
|
|||
if ($trimmed === '') {
|
||||
throw new InvalidPathException($l10n->t('Empty filename is not allowed'));
|
||||
}
|
||||
if ($trimmed === '.' || $trimmed === '..') {
|
||||
if (\OC\Files\Filesystem::isIgnoredDir($trimmed)) {
|
||||
throw new InvalidPathException($l10n->t('Dot files are not allowed'));
|
||||
}
|
||||
|
||||
|
|
|
@ -1433,7 +1433,7 @@ class OC_Util {
|
|||
if ($trimmed === '') {
|
||||
return false;
|
||||
}
|
||||
if ($trimmed === '.' || $trimmed === '..') {
|
||||
if (\OC\Files\Filesystem::isIgnoredDir($trimmed)) {
|
||||
return false;
|
||||
}
|
||||
foreach (str_split($trimmed) as $char) {
|
||||
|
|
|
@ -30,7 +30,7 @@ class Jail extends \Test\Files\Storage\Storage {
|
|||
$contents = array();
|
||||
$dh = $this->sourceStorage->opendir('');
|
||||
while ($file = readdir($dh)) {
|
||||
if ($file !== '.' and $file !== '..') {
|
||||
if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
|
||||
$contents[] = $file;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
|
|||
static protected function tearDownAfterClassCleanStrayDataUnlinkDir($dir) {
|
||||
if ($dh = @opendir($dir)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if ($file === '..' || $file === '.') {
|
||||
if (\OC\Files\Filesystem::isIgnoredDir($file)) {
|
||||
continue;
|
||||
}
|
||||
$path = $dir . '/' . $file;
|
||||
|
|
Loading…
Reference in New Issue