Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
factor out hidden folder name into a seperate function
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Aug 23, 2022
commit bca9d5ea02aee16309a5f8efda31b633903a045e
3 changes: 2 additions & 1 deletion apps/dav/lib/Connector/Sabre/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

namespace OCA\DAV\Connector\Sabre;

use OC\Files\Filesystem;
use OC\Files\Mount\MoveableMount;
use OC\Files\View;
use OCA\DAV\Connector\Sabre\Exception\FileLocked;
Expand Down Expand Up @@ -267,7 +268,7 @@ public function getChildren() {
throw new Locked();
}

$hiddenName = 'hidden_' . \OC_Util::getInstanceId();
$hiddenName = Filesystem::getHiddenFolderName();

$nodes = [];
foreach ($folderContent as $info) {
Expand Down
3 changes: 2 additions & 1 deletion lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use OC\Files\Filesystem;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Cache\CacheEntryInsertedEvent;
Expand Down Expand Up @@ -860,7 +861,7 @@ protected function buildSearchQuery(ISearchQuery $searchQuery): IQueryBuilder {
}

// exclude entries from the hidden folder in the user storage
$query->andWhere($query->expr()->notLike('path', $query->createNamedParameter('files/hidden_' . \OC_Util::getInstanceId() . '%')));
$query->andWhere($query->expr()->notLike('path', $query->createNamedParameter('files/' . Filesystem::getHiddenFolderName() . '%')));

if ($searchQuery->limitToHome() && ($this instanceof HomeCache)) {
$query->andWhere($builder->expr()->like('path', $query->expr()->literal('files/%')));
Expand Down
4 changes: 4 additions & 0 deletions lib/private/Files/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -920,4 +920,8 @@ public static function getOwner($path) {
public static function getETag($path) {
return self::$defaultInstance->getETag($path);
}

public static function getHiddenFolderName(): string {
return '.hidden_' . \OC_Util::getInstanceId();
}
}
3 changes: 2 additions & 1 deletion lib/private/Files/Node/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

use OC\DB\QueryBuilder\Literal;
use OC\Files\Cache\CacheEntry;
use OC\Files\Filesystem;
use OC\Files\Search\SearchBinaryOperator;
use OC\Files\Search\SearchComparison;
use OC\Files\Search\SearchQuery;
Expand Down Expand Up @@ -283,7 +284,7 @@ public function search($query) {
}

if (!$limitToHome) {
$hiddenFolder = 'hidden_' . \OC_Util::getInstanceId();
$hiddenFolder = Filesystem::getHiddenFolderName();
$mounts = $this->root->getMountsIn($this->path);
foreach ($mounts as $mount) {
// don't search in mounts inside the hidden folder
Expand Down
4 changes: 3 additions & 1 deletion lib/private/Files/Node/Root.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
namespace OC\Files\Node;

use OC\Cache\CappedMemoryCache;
use OC\Files\FileInfo;
use OC\Files\Filesystem;
use OC\Files\Mount\Manager;
use OC\Files\Mount\MountPoint;
use OC\Hooks\PublicEmitter;
Expand Down Expand Up @@ -395,7 +397,7 @@ public function getUserFolder($userId) {

public function getHiddenUserFolder($userId) {
$userFolder = $this->getUserFolder($userId);
$hiddenName = 'hidden_' . \OC_Util::getInstanceId();
$hiddenName = Filesystem::getHiddenFolderName();
try {
return $userFolder->get($hiddenName);
} catch (NotFoundException $e) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,7 @@ private function searchCommon($method, $args) {
}
}

$hiddenFolder = 'hidden_' . \OC_Util::getInstanceId();
$hiddenFolder = Filesystem::getHiddenFolderName();
$mounts = Filesystem::getMountManager()->findIn($this->fakeRoot);
foreach ($mounts as $mount) {
$mountPoint = $mount->getMountPoint();
Expand Down