Skip to content

[stable27] use more efficient tag retrieval on DAV report request - #39202

Merged
blizzz merged 14 commits into
stable27from
backport/37969/stable27
Jul 7, 2023
Merged

[stable27] use more efficient tag retrieval on DAV report request#39202
blizzz merged 14 commits into
stable27from
backport/37969/stable27

Conversation

@backportbot-nextcloud

@backportbot-nextcloudbackportbot-nextcloudBot commented Jul 6, 2023

Copy link
Copy Markdown

Backport of #37969

  • dropped commit 221562d – apart of the LazyFolder adjustments, this is re-added in 👇
  • added commit a7b4f50

blizzz added 6 commits July 6, 2023 17:29
- uses DAV search approach against valid files joined by systemtag selector
- reduced table join for tag/systemtag search
- supports pagination
- no changes to the output formats or similar
Example request body:
<?xml version="1.0"?>
<oc:filter-files xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns" xmlns:ocs="http://open-collaboration-services.org/ns">
<d:prop>
<d:getcontentlength/>
<d:getcontenttype/>
<d:getetag/>
<d:getlastmodified/>
<d:resourcetype/>
<nc:face-detections/>
<nc:file-metadata-size/>
<nc:has-preview/>
<nc:realpath/>
<oc:favorite/>
<oc:fileid/>
<oc:permissions/>
<nc:nbItems/>
</d:prop>
<oc:filter-rules>
<oc:systemtag>32</oc:systemtag>
</oc:filter-rules>
<d:limit>
<d:nresults>50</d:nresults>
<nc:firstresult>0</nc:firstresult>
</d:limit>
</oc:filter-files>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>

foreach ($tags as $tag) {
$tagName = $tag->getName();
$tmpNodes = $this->userFolder->searchBySystemTag($tagName, $this->userSession->getUser()->getUID(), $dbLimit, $dbOffset);

Check notice

Code scanning / Psalm

PossiblyNullReference

Cannot call method getUID on possibly null value
// Empty intersection, nothing can show up anymore
return [];
if (!$oneTagSearch && ($limit !== null || $offset !== null)) {
$nodes = array_slice($nodes, $offset, $limit);

Check notice

Code scanning / Psalm

PossiblyNullArgument

Argument 2 of array_slice cannot be null, possibly null value provided
@blizzzblizzz added the 2. developing Work in progress label Jul 6, 2023
blizzz
blizzz previously requested changes Jul 6, 2023

@blizzzblizzz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it not API breaking

@blizzzblizzz self-assigned this Jul 6, 2023
blizzz added 7 commits July 6, 2023 21:52
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
- possible null return
- parameter name mismatch in implementation
- incomplete unit test
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz
blizzzforce-pushed the backport/37969/stable27 branch from a1095d1 to da651ceCompareJuly 6, 2023 20:38
@blizzz
blizzz requested a review from miaulalalaJuly 6, 2023 20:39
@blizzz

Copy link
Copy Markdown
Member

/backport to stable26

- in this backport we have to drop the breaking addition in
\OCP\Files\Folder
- this requires adjustments in check for the existance of the method but
also in testing
- another change in \OCP\SystemTag\ISystemTagManager can be applied as
this interface is not implemented elsewhere
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz
blizzzforce-pushed the backport/37969/stable27 branch from da651ce to a7b4f50CompareJuly 7, 2023 10:26
@blizzz

Copy link
Copy Markdown
Member

/backport to stable25

@blizzz
blizzz merged commit 8f20b0c into stable27Jul 7, 2023
@blizzz
blizzz deleted the backport/37969/stable27 branch July 7, 2023 14:49
@blizzz

Copy link
Copy Markdown
Member

/backport to stable25

@backportbot-nextcloud

Copy link
Copy Markdown
Author

The backport to stable25 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable25
git pull origin stable25
# Create the new backport branch
git checkout -b fix/foo-stable25
# Cherry pick the change from the commit sha1 of the change against the default branch# This might cause conflicts. Resolve them.
git cherry-pick abc123
# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable25

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@blizzz@AndyScherzinger@github-advanced-security@skjnldsv