Commit Graph

224 Commits

Author SHA1 Message Date
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 14:19:56 +02:00
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 10:35:09 +02:00
Christoph Wurst bcd13296de
Make sure every file ends with an empty newline
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 16:11:50 +02:00
Christoph Wurst 44577e4345
Remove trailing and in between spaces
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 16:07:47 +02:00
Christoph Wurst afbd9c4e6e
Unify function spacing to PSR2 recommendation
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 13:54:22 +02:00
Christoph Wurst 41b5e5923a
Use exactly one empty line after the namespace declaration
For PSR2

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 11:48:10 +02:00
Christoph Wurst 85e369cddb
Fix multiline comments
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-08 22:24:54 +02:00
Robin Appelman 857957b45e
allow setting tooltips for external storage config options
allows explaining non-obvious config options a bit more

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-04-03 15:44:53 +02:00
Christoph Wurst 1a9330cd69
Update the license headers for Nextcloud 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-31 14:52:54 +02:00
John Molakvoæ fa4162e86f
Merge pull request #20208 from nextcloud/smb-folder-contents-normalize-path
normalize smb path while listing folder contents
2020-03-30 10:06:39 +02:00
Christoph Wurst 463b388589
Merge pull request #20170 from nextcloud/techdebt/remove-unused-imports
Remove unused imports
2020-03-27 17:14:08 +01:00
Robin Appelman ef7bb5225a
normalize smb path while listing folder contents
currently when listing `'/'`, it will include a double slash in the paths used for the listing logic
this causes unneeeded cache misses in the statCache

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-03-27 17:04:53 +01:00
Christoph Wurst b80ebc9674
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-26 16:34:56 +01:00
Christoph Wurst 74936c49ea
Remove unused imports
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-25 22:08:08 +01:00
Joas Schilling 17bc35e4f1
Merge pull request #19915 from nextcloud/external-storage-password-placeholders
Use placeholder values for password fields in external storage webui
2020-03-13 10:54:40 +01:00
Robin Appelman 0d112d7901
Use placeholder values for password fields in external storage webui
This prevents the password from being sent to the webui.

While an admin will always be able to retrieve the passwords (as they
can do arbitrairy code execution by design) this prevents casual
password snooping

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-03-12 19:45:23 +01:00
Robin Appelman 223ee42a53
faster implementation of SFTP write stream
using mostly the same techniques as the read stream

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-03-10 16:18:40 +01:00
Robin Appelman fe4e80093e
Faster implementation of sftp read stream
- Keeps a single file handle open instead of creating a new one for
every stream_read
- Read from sftp in large chunks instead of the 8k internal php size
- Request a read for the next chunk while we're still processing the
current one

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-03-06 16:57:18 +01:00
Arthur Schiwon 7e1d14d9a5
do not overwrite global user auth credentials with empty values
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-02-06 00:14:29 +01:00
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +01:00
Roeland Jago Douma 68748d4f85
Some php-cs fixes
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-22 20:52:10 +01:00
Daniel Kesselberg 2bd591f227
Make timeout a optional parameter
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-11-09 15:18:52 +01:00
Daniel Kesselberg 230f685987
Remove superfluous fclose
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-10-21 11:31:07 +02:00
Roeland Jago Douma 88b6dc5eaf
Merge pull request #17258 from nextcloud/smb-timeout-config
add (hidden) option to configure smb timeout
2019-09-27 12:29:56 +02:00
Robin Appelman bc160992d3
Update apps/files_external/lib/Lib/Backend/SMB.php
Co-Authored-By: Daniel Kesselberg <mail@danielkesselberg.de>
2019-09-25 14:59:44 +02:00
Robin Appelman 194edfc64e
add (hidden) option to configure smb timeout
hidden from ui to prevent clutter

```occ files_external:config <mount> timeout 30```

Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-09-25 13:30:40 +02:00
Daniel Kesselberg 72d22a4828
Use local variable for directory name
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-09-23 14:03:41 +02:00
Daniel Kesselberg 75b8944061
Don't strip path from directory prefix
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-09-23 14:03:41 +02:00
Daniel Kesselberg 80340a8d46
Fill directory cache from opendir
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-09-23 14:03:41 +02:00
Daniel Kesselberg 12863e0d24
Change visibility to private (from protected)
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-09-23 14:03:40 +02:00
Daniel Kesselberg 963d35c78c
Rename $location to $path
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-09-23 14:03:40 +02:00
Daniel Kesselberg 010473ca1f
Add method to check if directory exists
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-09-23 14:03:40 +02:00
Roeland Jago Douma 15e16d4a85
Merge pull request #16790 from nextcloud/admin-use-user-global-auth
Allow admin configured mounts to use user configured global credentials
2019-09-10 16:01:14 +02:00
Robin Appelman 603655341e
allow setting user provided global credentials trough credentials popup
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-09-09 17:15:30 +02:00
Robin Appelman 1d51b297a9
Allow admin configured mounts to use user configured global credentials
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-09-09 16:51:24 +02:00
Arthur Schiwon 43bc31bacb
set a storage availability delay on auth issues to avoid lock out
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-08-22 12:40:15 +02:00
Arthur Schiwon cd62b38cc8
catch auth issues also when php-smbclient is in use
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-08-22 11:12:43 +02:00
Morris Jobke adc2ab4bb2
Ignore forbidden exception when fetching share mtime on SMB for symlinks
See https://github.com/nextcloud/server/pull/7556#issuecomment-499028026

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2019-07-08 21:43:24 +02:00
Robin Appelman 6d5579863e
add option to show hidden files in SMB shares
Note hidden files can mean different things in smb and the option the the files web ui,
the webui only counts files starting with '.' as hidden, while smb files
can be marked as hidden regardless, any files that are marked as hidden
on smb will thus be shown in the webui regardless of the setting in the files app.

Fixes #15644

Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-05-23 21:23:56 +02:00
Michael Zamot dc35a8af83 Convert timestamp key value of metadata in Swift files_external
modified:   apps/files_external/lib/Lib/Storage/Swift.php

Signed-off-by: Michael Zamot <michael@zamot.io>

Convert value of timestamp metadata key in swift files_external to string
2019-03-01 12:10:37 -07:00
Morris Jobke 7fc68fe93e
Merge pull request #14211 from nextcloud/bugfix/prefix-path-to-filecache-s3
Prefix $path for filename for internal file cache
2019-02-19 12:01:08 +01:00
Daniel Kesselberg 0d667d18bb
Call headObject if file not in filecache 🙈
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-02-14 18:34:04 +01:00
Daniel Kesselberg 659ed3ecda
Prefix $path for filename for internal file cache
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2019-02-14 17:06:14 +01:00
Arthur Schiwon 792bcb82ae
add LDAP ConfigHandler for external storages and "$home" var
* handler registered upon OCA\\Files_External::loadAdditionalBackends
  event as user_ldap is loaded before files_external
* new configuration field "ldapExtStorageHomeAttribute" (not in GUI yet)

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2019-02-14 15:22:22 +01:00
Robin Appelman 2c1f6331a4
Add interface to allow storages from opting out of encryption
As opposed to hard-coding a list of excluded storages

Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-11-29 16:31:34 +01:00
Daniel Kesselberg 4cbea5f7e1
Remove value from cache on delete/clear
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2018-10-08 16:40:39 +02:00
Daniel Kesselberg 5cf38254bb
Use helper method for content length and last modified
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2018-10-01 20:18:36 +02:00
Daniel Kesselberg 67d5380b91
Reuse information from ListObjects for stat / filetype
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2018-09-30 21:05:53 +02:00
Morris Jobke 8563ab94aa
Merge pull request #10589 from nextcloud/smb-stat-retry
retry smb stat on timeout
2018-08-24 07:00:40 +02:00
Robin Appelman bdc6d0b5a1
log entries that are hidden during file listing
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-08-16 01:20:05 +02:00
Robin Appelman 24aaa3bc97
retry stat on timeout
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-08-08 16:07:41 +02:00
Morris Jobke e35451fd4e
Merge pull request #10025 from nextcloud/smb-rename-invalidargument-retry
also retry rename operation on InvalidArgumentException
2018-07-11 16:25:22 +02:00
Robin Appelman 27089422e1
Improved logging of smb connection errors
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-07-03 14:56:37 +02:00
Robin Appelman 431710a5aa
also retry rename operation on InvalidArgumentException
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-06-27 15:33:51 +02:00
Robin Appelman 90be8f336c
Add support for using kerberos ticket to authenticate to smb servers
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-06-22 14:25:36 +02:00
Robin Appelman 4a424f86db
update icewind/smb to 3.0.0
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-06-21 16:02:51 +02:00
Roeland Jago Douma 2b19add6b0
Add SFTP auth mechanism to use a password and public key for SFTP
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-06-07 13:35:43 +02:00
Morris Jobke b348431bce
Merge pull request #8842 from lanxenet/patch-1
fix(AmazonS3):  fix loop $result['Contents'] error
2018-05-07 18:41:39 +02:00
Roeland Jago Douma 055a003661
Use an actual function of the storage to determine needsPartFile
We have a function for it so better to override that. Also because other
codes that might check this should get the right value.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-05-01 15:02:36 +02:00
Arthur Schiwon 38a90130ce
move log constants to ILogger
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-04-26 10:45:52 +02:00
Roeland Jago Douma 47a3008141
Remove \OCP\Files::tmpFile
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-19 10:52:35 +01:00
Morris Jobke 63bc633d89
Merge pull request #8857 from nextcloud/swift-verify-cached-token
verify cached swift token
2018-03-19 10:10:04 +01:00
Robin Appelman 41954d2903
verify cached swift token
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-03-16 15:20:16 +01:00
enoch 6212992c0a
fix(AmazonS3): fix loop $result['Contents'] error
Invalid argument supplied for foreach() at /var/www/html/apps/files_external/lib/Lib/Storage/AmazonS3.php#295
2018-03-16 11:51:27 +08:00
Morris Jobke 044d01d0e1
Use proper method to log exceptions
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-03-12 18:10:59 +01:00
Roeland Jago Douma 017e1325f1
Merge pull request #8285 from nextcloud/apps_files-smb-catch-exceptions-on-listing
Make SMB module more fault-tolerant
2018-02-27 13:10:54 +01:00
Morris Jobke 8867629cf1
Merge pull request #8359 from nextcloud/swift-v3
Support swift v3 authentication
2018-02-26 18:30:00 +01:00
Robin Appelman d40c61a71a
adjust external storage config format to the one used in primary storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-02-26 14:54:30 +01:00
Robin Appelman 31dd6d6aae
add support for v3 swift auth
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-02-26 14:54:08 +01:00
Roeland Jago Douma 30017e3364
Properly set the mount type for external storages
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-02-20 15:51:12 +01:00
Robin Appelman 817f2f8f49
adjust swift external storage to new openstack sdk
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-02-19 19:41:16 +01:00
Roeland Jago Douma 7ad1e13961
Merge pull request #8158 from nextcloud/s3-minio
Use a more widely available method to test s3 settings
2018-02-19 17:09:36 +01:00
Morris Jobke d3d045dd5c
Remove unused import statements
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-02-14 16:55:43 +01:00
Roland Tapken 8e251e5d5a Make SMB module more fault-tolerant
Ignore unavailable files when fetching the share's mtime
or reading directory listings. This can happen on servers using a
distributed file system (DFS) with unavailable destinations, for example
when the remote server is offline.

Signed-off-by: Roland Tapken <roland@bitarbeiter.net>
2018-02-09 17:40:00 +01:00
Robin Appelman 48ea714341
Use a more widely available method to test s3 settings
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-02-08 09:34:05 +01:00
Robin Appelman 84bd2b6bc9
fix invalidating folder cache for s3
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-01-29 15:09:15 +01:00
Robin Appelman 7afd77604e
adjust s3 bulk delete to new sdk syntax
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-01-29 15:06:10 +01:00
Morris Jobke a661f043e1
Remove unneeded semicolon and parentheses
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 23:46:40 +01:00
Morris Jobke 4c38d1ed01
Merge pull request #8054 from nextcloud/substr-use-index
Use index based string access for substr with length of 1
2018-01-26 15:40:44 +01:00
Morris Jobke 9ff51aafc5
Use index based string access for substr with length of 1
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 13:38:34 +01:00
Morris Jobke 16a558871c
Use proper code flow instead of not needed else branch
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-25 23:01:03 +01:00
Morris Jobke 2a38605545
Properly log the full exception instead of only the message
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-23 10:57:21 +01:00
Roeland Jago Douma 05f75f803a
[files_external] OCS endpoint to proper OCSController
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-18 11:15:03 +01:00
Robin Appelman 34ced4dd97
add option to use legacy v2 auth with s3
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-12-19 11:54:55 +01:00
Morris Jobke b01d20c0d7
Merge pull request #7556 from nextcloud/smb-stat-exception
handle exceptions in SMB::stat
2017-12-18 22:31:05 +01:00
Robin Appelman 3fa13b48fc
handle exceptions in SMB::stat
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-12-18 15:55:46 +01:00
Robin Appelman 4f0d03e172
additional debug logging on smb copy/rename failures
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-12-18 13:59:58 +01:00
Robin Appelman 046eb0c635
add retry wrapper when reading files from swift
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-12-04 16:34:53 +01:00
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 16:56:19 +01:00
Roeland Jago Douma 87e10f9e6a
OC_OCS_Response is deprecated
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-09-21 17:56:00 +02:00
Robin Appelman c83232adae
Fix undefined offset warning when using '/' as external storage root
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-09-19 17:18:04 +02:00
Robin Appelman 91f44f5309
fix undefined constants
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-09-18 15:16:28 +02:00
Robin Appelman 9154b27943
disable part files for s3 external storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-09-18 15:16:27 +02:00
Robin Appelman cc9dd4280f
add stat cache for s3 external storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-09-18 15:16:27 +02:00
Robin Appelman d5678201b4
more efficient is_dir
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-09-18 15:16:27 +02:00
Robin Appelman 4bbc1cdc79
more efficient permissions for s3 external storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-09-18 15:16:27 +02:00
Robin Appelman 9b5accf9f3
more efficient write only fopen
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-09-18 15:16:27 +02:00
Robin Appelman d70607104e
reuse object read/write/delete logic in s3 implementations
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-09-18 15:16:27 +02:00
Robin Appelman dad18baec8
update aws sdk and move it to 3rdparty
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-09-18 15:16:27 +02:00
Robin Appelman e9a58f8579
show storage as unavailable in the file list
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-09-04 11:54:13 +02:00