aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Storage/Local.php
Commit message (Collapse)AuthorAgeFilesLines
* invert elseif on rmdir for local storage Lorenzo Tanganelli2023-05-241-2/+2
| | | Signed-off-by: Lorenzo Tanganelli <lorenzo.tanganelli@hotmail.it>
* Get rid of more int casts in file size manipulationsCôme Chilliet2023-05-111-1/+2
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* Merge pull request #37062 from nextcloud/free-spaceRobin Appelman2023-04-211-1/+1
|\ | | | | Check free space only if source exists and is dir
| * Add function_exists() checkGit'Fellow2023-03-071-1/+1
| | | | | | | | Co-authored-by: Simon L. <szaimen@e.mail.de> Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
| * Fix free space problemsGit'Fellow2023-03-071-1/+1
| | | | | | Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
* | Use typed version of IConfig::getSystemValue as much as possibleCôme Chilliet2023-04-051-2/+2
| | | | | | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* | Remove unused method getLocalFolderCôme Chilliet2023-04-031-4/+0
| | | | | | | | | | | | It’s not used and not in any OCP interface/class. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* | Remove useless coalescing operator on non-null return valueCôme Chilliet2023-04-011-1/+1
| | | | | | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* | Silence a warning from psalm with explanationCôme Chilliet2023-04-011-0/+1
|/ | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* Respect OCP interface in private classesCôme Chilliet2023-02-071-1/+1
| | | | | | | Because the parameter type was moved to phpdoc it needs to be removed from implementations Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* Strong type filesize related methods to ease 32bits problem findingsCôme Chilliet2023-02-071-2/+2
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* Revert "remove 32-bit workarounds"Côme Chilliet2023-02-071-0/+13
| | | | | | This reverts commit dd8774389e21b59c07882580356d51de018fe867. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* fix moving files of encrypted local storage to unencrypted local storageRobin Appelman2023-01-241-5/+13
| | | | | | for example when moving encrypted files to a groupfolder Signed-off-by: Robin Appelman <robin@icewind.nl>
* fix psalmszaimen2022-11-021-1/+1
| | | | Signed-off-by: szaimen <szaimen@e.mail.de>
* remove 32-bit workaroundsszaimen2022-11-021-13/+0
| | | | Signed-off-by: szaimen <szaimen@e.mail.de>
* Rename file1 and file2 to source and target in Storage abstractionCarl Schwan2022-10-181-21/+21
| | | | Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* trigger a rescan when trying to fopen a file that exists in cache but not on ↵Robin Appelman2022-09-291-1/+8
| | | | | | disk Signed-off-by: Robin Appelman <robin@icewind.nl>
* config: add a switch to control truncate before updateTigran Mkrtchyan2022-09-161-6/+12
| | | | | | | | | To avoid extra truncate on non WORM file systems, add a new config option `localstorage.unlink_on_truncate`, which defaults to false. The OC\Files\Storage\Local is update to respect that option. Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
* files: remove destination file before copying new content (WORM)Tigran Mkrtchyan2022-09-161-0/+2
| | | | Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
* files: make OC\Files\Storage\Local WORM friendlyTigran Mkrtchyan2022-08-251-0/+6
| | | | | | | | | | | | | | | Some filesystems run as a Write-Once-Read-Many storages. This makes them impossible to use with NexeCloud, as the file system layers uses `truncate` syscall (through file_put_contents function). As Nextcloud is never updates existing files, removing the old entry and creatint a new one on update will allow NextCoud to update on such file systems. Update Local#fopen and Local#file_put_contents to remote existing file before truncating. Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
* Expose umask override value as config parameter: localstorage.umaskMartin Brugnara2022-06-051-5/+9
| | | | | | | | | | | | | | | | | Commit 451c06d introduced override for umask value. This is needed to avoid broken env configuration or dirty workers to mess with the permissions when creating new files. Most Nextcloud, that does not integrate with external software would work fine with an hard-coded value (451c06d set it at 022). Advanced install may require more flexibility, as such this commit exposes the "umask override value" as configuration parameter: `localstorage.umask` It defaults to 0022 both in code and in config/config.sample.php . Signed-off-by: Martin Brugnara <martin@0x6d62.eu>
* Remove ILogger usages in lib/private/Files/StorageCôme Chilliet2022-04-261-5/+5
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* ignore forbidden files while scanning local storageRobin Appelman2022-04-201-1/+5
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* some file scanner performance improvementsRobin Appelman2022-03-171-4/+14
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* Check for `disk_free_space`acsfer2021-11-181-1/+1
| | | | Check for `disk_free_space` before calling it. Fix https://github.com/nextcloud/server/issues/29748
* Fix security issues when copying groupfolder with advanced ACLCarl Schwan2021-10-211-1/+4
| | | | | | | | | | Using advanced ACL, it is possible that an user has access to a directory but not to a subdirectory, so the copying use Common::copyFromStorage instead of Local::copyFromStorage. Fix https://github.com/nextcloud/groupfolders/issues/1692 Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* Merge pull request #28768 from nextcloud/check-file-existsJohn Molakvoæ2021-10-181-1/+1
|\
| * Simplify :)acsfer2021-10-041-1/+1
| |
| * Replace `file_exists()` method by `is_file()`acsfer2021-10-041-1/+1
| |
| * Get `filesize()` if `file_exists()`acsfer2021-10-011-1/+1
| | | | | | Should make sense.
* | explicitly close source stream on local storageDaniel Kesselberg2021-09-211-1/+4
|/ | | | Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
* Fix scanner mistaking socket files for directoriesRid2021-06-171-2/+2
| | | | Signed-off-by: Rid <rid@cylo.io>
* Update php licensesJohn Molakvoæ (skjnldsv)2021-06-041-1/+1
| | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* Merge pull request #25280 from nextcloud/explicit-file-permissionsRoeland Jago Douma2021-03-301-4/+16
|\ | | | | Set umask before operations that create local files
| * Set umask before operations that create local filesRobin Appelman2021-03-231-4/+16
| | | | | | | | | | | | this solves issues where "other php stuff" is messing with the umask Signed-off-by: Robin Appelman <robin@icewind.nl>
* | show better error messages when a file with a forbidden path is encounteredRobin Appelman2021-03-241-8/+4
|/ | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* explicitly set permissions on newly created foldersRobin Appelman2021-01-201-1/+4
| | | | | | this works around any `umask` that might be set and limiting the folder permissions Signed-off-by: Robin Appelman <robin@icewind.nl>
* Add 'allow Symlinks' as an option to config.phpJohannes Leuker2021-01-121-3/+2
| | | | Signed-off-by: Johannes Leuker <j.leuker@hosting.de>
* Merge pull request #24594 from kofemann/dcacheJulius Härtl2020-12-221-1/+1
|\
| * files: Local#writeStream should use it's own file_put_contentsTigran Mkrtchyan2020-12-071-1/+1
| | | | | | | | | | | | | | | | | | | | The OC\Files\Storage\Local#writeStream use system provided file_put_contents. However, it overrides file_put_contents, thus expects that the default behaviour can be different. Use Local#file_put_contents in writeStream to benefit from class specific functionality. Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
* | Update all license headers for Nextcloud 21Christoph Wurst2020-12-161-1/+2
|/ | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Fix file size computation on 32bit platformsaler92020-12-021-5/+4
| | | | Signed-off-by: aler9 <46489434+aler9@users.noreply.github.com>
* Update the license headers for Nextcloud 20Christoph Wurst2020-08-241-0/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Merge pull request #21677 from J0WI/clearstatcache-on-rmdirMorris Jobke2020-08-051-2/+4
|\ | | | | Do clearstatcache() on rmdir
| * Only clear the realpath cacheJ0WI2020-07-031-2/+2
| | | | | | | | Signed-off-by: J0WI <J0WI@users.noreply.github.com>
| * clearstatcache() on rmdirJ0WI2020-07-031-0/+2
| | | | | | | | Signed-off-by: J0WI <J0WI@users.noreply.github.com>
* | use exceptions for error signaling in writeStreamRobin Appelman2020-07-231-1/+7
|/ | | | | | this remove the ambiguity when writing zero length files Signed-off-by: Robin Appelman <robin@icewind.nl>
* Clear the statscache before fetching the metadataRoeland Jago Douma2020-05-221-0/+1
| | | | | | | | Else if a lot of writes happen. It might happen that an old stat result is used. Resulting in a wrong file size for the file. For example the text app when a lot of people edit at the same time. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Update license headers for 19Christoph Wurst2020-04-291-1/+0
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Add method to storage backends to get directory content with metadataRobin Appelman2020-04-201-0/+1
| | | | | | | | | | | | | | | | | Currently you need to use `opendir` and then call `getMetadata` for every file, which adds overhead because most storage backends already get the metadata when doing the `opendir`. While storagebackends can (and do) use caching to relief this problem, this adds cache invalidation dificulties and only a limited number of items are generally cached (to prevent memory usage exploding when scanning large storages) With this new methods storage backends can use the child metadata they got from listing the folder to return metadata without having to keep seperate caches. Signed-off-by: Robin Appelman <robin@icewind.nl>