Commit Graph

86 Commits (feat/database/query-result-fetch-associative-fetch-num)

Author SHA1 Message Date
Christoph Wurst 14719110b9 chore: Replace \OC::$server->query with \OCP\Server::get in /lib
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2023-07-06 15:21:22 +07:00
Julius Härtl eddb64f8c3
Merge pull request #37969 from nextcloud/poc/noid/systemtags-perf-tag-endpoint 2023-06-28 07:53:35 +07:00
Arthur Schiwon a0f9556f7c
fix: cominbation of small fixes
- possible null return
- parameter name mismatch in implementation
- incomplete unit test

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-06-21 20:28:01 +07:00
Arthur Schiwon b0d1cf5730
fix: change if with conditionless else to switch; and a parameter value
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-06-21 18:19:08 +07:00
Arthur Schiwon 58f7fd2370
use efficient tag retrieval on DAV report request
- 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>
2023-06-21 18:19:08 +07:00
Arthur Schiwon 088a0eea29
ci: pro forma check of existence of internal method
createNode() is protected and used by Folder, but being an internal-only
method it shall not be exposed in the Folder or IRootFolder interface.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-06-21 16:53:20 +07:00
Arthur Schiwon 71e41ffeeb
refactor: declare getMount() and getMountsIn() at IRootFolder
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-06-21 16:53:20 +07:00
Arthur Schiwon f6ac874dbf
chore: ugly type juggling
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-06-21 16:53:20 +07:00
Faraz Samapoor e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
2023-05-15 15:17:19 +07:00
Arthur Schiwon dbfd2f936a
refactor: remove SystemTag logic from Folder into QuerySearchHelper
- adds OC\SystemTag\SystemTagsInFilesDetector where the search logic is
  moved to

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-05-09 23:51:52 +07:00
Arthur Schiwon 2489a2d63a
feat: specify media type via url path: systemtags-current/$mediaType
- only the media part of the mime type can be search, but not the full
  mime type. It can be added, should it become necessary.
- thus fixes previously hardcoded selector for image/ types
- also fixes a return type hint
- adds a return type hint

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-05-09 23:51:51 +07:00
Arthur Schiwon 6bff6a5667
PoC: SystemTags endpoint to return tags used by a user with meta data
Target case is photos app: when visiting the tags category, all systemtags
of the whole cloud are retrieved. In subequent steps the next tag is
requested until the browser view is filled with tag tiles (i.e. previews
are requested just as well).

With this approach, we incorpoate the dav search and look for user related
tags that are used by them, and already returns the statistics (number of
files tagged with the respective tag) as well as a file id for the purpose
to load the preview. This defaults to the file with the highest id.

Call:
curl -s -u 'user:password' \
  'https://my.nc.srv/remote.php/dav/systemtags-current' \
  -X PROPFIND -H 'Accept: text/plain' \
  -H 'Accept-Language: en-US,en;q=0.5'  -H 'Depth: 1' \
  -H 'Content-Type: text/plain;charset=UTF-8' \
  --data @/home/doe/request-systemtag-props.xml

With request-systemtag-props.xml:
<?xml version="1.0" encoding="UTF-8"?>
<d:propfind xmlns:d="DAV:">
        <d:prop xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
                <oc:id/>
                <oc:display-name/>
                <oc:user-visible/>
                <oc:user-assignable/>
                <oc:can-assign/>
                <nc:files-assigned/>
                <nc:reference-fileid/>
        </d:prop>
</d:propfind>

Example output:
  …
  <d:response>
    <d:href>/master/remote.php/dav/systemtags/84</d:href>
    <d:propstat>
      <d:prop>
        <oc:id>84</oc:id>
        <oc:display-name>Computer</oc:display-name>
        <oc:user-visible>true</oc:user-visible>
        <oc:user-assignable>true</oc:user-assignable>
        <oc:can-assign>true</oc:can-assign>
        <nc:files-assigned>42</nc:files-assigned>
        <nc:reference-fileid>924022</nc:reference-fileid>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/remote.php/dav/systemtags/97</d:href>
    <d:propstat>
      <d:prop>
        <oc:id>97</oc:id>
        <oc:display-name>Bear</oc:display-name>
        <oc:user-visible>true</oc:user-visible>
        <oc:user-assignable>true</oc:user-assignable>
        <oc:can-assign>true</oc:can-assign>
        <nc:files-assigned>1</nc:files-assigned>
        <nc:reference-fileid>923422</nc:reference-fileid>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  …

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-05-09 23:51:48 +07:00
Côme Chilliet 9c3e06c046
Merge pull request #33061 from ibpl/master-IB#1121253
Paths added to messages and message cleanup
2023-03-14 17:28:22 +07:00
Robin Appelman 5bcf37b7ff only fetch the data for mounts inside a folder when needed
for most operations we don't actually care about any mounts inside a folder, only for metadata that needs to propagate across storage boundaries (size, etag, mtime) do we need all the submount info.

By only loading this data when needed we can save a bunch of storage setup in a number of cases

Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-02-09 11:39:00 +07:00
Côme Chilliet a78595a45f
Make sure that path is normalized and then checked,
and not the other way around

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-11-10 15:03:15 +07:00
Pawel Boguslawski 4a46c747e9 Merge master 2022-11-04 13:34:21 +07:00
Carl Schwan 67551f379f
Filter out old files when trying to get recent files
Only do so when asking for less than 100 files and having an offset
equal to 0.

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-09-05 12:53:32 +07:00
Robin Appelman e9ba58ca61
remove leading slash for search results at mountpoint root
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-08-29 17:33:43 +07:00
Julius Härtl 83b1415906
Only pass parent if paths match
As the user folder might be initialized by the root from two levels
down the hierarchy, passing this as a parent only works if the path matches

Signed-off-by: Julius Härtl <jus@bitgrid.net>
2022-08-24 22:20:32 +07:00
Julius Härtl b2d6435737
Avoid extra query for the parent node if we can pass it along
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2022-08-24 22:20:32 +07:00
Paweł Bogusławski a850424b1b Update Folder.php
Signed-off-by: Pawel Boguslawski <pawel.boguslawski@ib.pl>
2022-07-29 13:34:00 +07:00
Paweł Bogusławski 097b78594a Update Folder.php
Signed-off-by: Pawel Boguslawski <pawel.boguslawski@ib.pl>
2022-07-29 13:34:00 +07:00
Paweł Bogusławski 04baf69fea Update lib/private/Files/Node/Folder.php
Co-authored-by: Vincent Petry <vincent@nextcloud.com>
Signed-off-by: Pawel Boguslawski <pawel.boguslawski@ib.pl>
2022-07-29 13:34:00 +07:00
Pawel Boguslawski 9eb1a92fa4 Paths added to messages and message cleanup
This mod adds path to error messages. Without it it's difficult for example
to find what path causes permission problems.

Related: https://help.nextcloud.com/t/ocp-files-notpermittedexception-could-not-create-folder/133818
Related: https://help.nextcloud.com/t/could-not-create-folder-false-error/65962/
Author-Change-Id: IB#1121253
Signed-off-by: Pawel Boguslawski <pawel.boguslawski@ib.pl>
2022-07-29 13:34:00 +07:00
luz paz 368f83095d Fix typos in lib/private subdirectory
Found via `codespell -q 3 -S l10n -L jus ./lib/private`

Signed-off-by: luz paz <luzpaz@github.com>
2022-07-27 08:52:17 +07:00
Côme Chilliet 1bd5222224
Fix PHP 8.2 warnings about undeclared properties
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-06-21 16:17:52 +07:00
Robin Appelman 151c800397
allow reusing known folder info when getting directory contents
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-04-06 14:40:34 +07:00
Robin Appelman 44a8ebdc1f
optimize getById on LazyUserFolder to not require a full fs setup
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-04-04 15:40:16 +07:00
Robin Appelman 700444e218
split out some path manipulation logic
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-04-04 15:40:12 +07:00
Robin Appelman 5c2e7c7d28
fix Folder->getById() when a single storage is mounted multiple times
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-07-28 17:21:04 +07:00
Robin Appelman 9884344230
dont include folder being search in in the results
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-07-02 16:32:25 +07:00
Robin Appelman f938daa6e4
update tests and fix some edge cases around new search
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-06-14 16:11:36 +07:00
Robin Appelman 27e50b24aa
some cleanup and documentation
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-06-14 16:11:32 +07:00
Robin Appelman 5d1d53c42e
perform file search in a single query
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-06-14 16:11:29 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07:00
Robin Appelman 0d5f4edc22
adjust tests
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-04-21 14:09:07 +07:00
Robin Appelman e8221303e9
use search query for Folder::getRecent
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-04-21 13:56:04 +07:00
Julius Härtl 8398762d78
Fail when creating new files with an empty path
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-04-20 11:20:20 +07:00
Robin Appelman 8a92229485
getStorage can also return null
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-24 14:56:40 +07:00
Robin Appelman f842608c95
getRelativePath can return null
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-24 14:30:29 +07:00
Robin Appelman bfe3712372
handle ordering in folder search
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-19 16:07:54 +07:00
Robin Appelman feed42dd6d
folder filtering in sql
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-19 13:41:00 +07:00
Robin Appelman de713967c0
cleanup fileinfo creation
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-19 13:35:37 +07:00
Robin Appelman a428f7d1e0
format
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-18 17:44:30 +07:00
Robin Appelman bd229e7548
handle limit and offset in folder file search
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-18 17:38:31 +07:00
Robin Appelman f8bca545df
unify handling of Folder::search methods into "new" query objects
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-18 16:35:41 +07:00
dependabot-preview[bot] eb502c02ff
Bump nextcloud/coding-standard from 0.3.0 to 0.5.0
Bumps [nextcloud/coding-standard](https://github.com/nextcloud/coding-standard) from 0.3.0 to 0.5.0.
- [Release notes](https://github.com/nextcloud/coding-standard/releases)
- [Changelog](https://github.com/nextcloud/coding-standard/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nextcloud/coding-standard/compare/v0.3.0...v0.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-02-18 13:31:24 +07:00
Christoph Wurst d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-16 18:48:22 +07:00
Joas Schilling 8027dcbc6f
Don't leave cursors open when tests fail
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-09 12:28:17 +07:00
Christoph Wurst 2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-08-24 14:54:25 +07:00