Commit Graph

68 Commits

Author SHA1 Message Date
Morris Jobke baecfc4080 Reduce OC_Config usage in lib/
* replaced by proper public interfaces
2015-12-02 14:49:40 +01:00
Lukas Reschke 13e817e901 Throw exception on `getPath` if file does not exist
Currently the `getPath` methods returned `NULL` in case when a file with the specified ID does not exist. This however mandates that developers are checking for the `NULL` case and if they do not the door for bugs with all kind of impact is widely opened.

This is especially harmful if used in context with Views where the final result is limited based on the result of `getPath`, if `getPath` returns `NULL` PHP type juggles this to an empty string resulting in all possible kind of bugs.

While one could argue that this is a misusage of the API the fact is that it is very often misused and an exception will trigger an immediate stop of execution as well as log this behaviour and show a pretty error page.

I also adjusted some usages where I believe that we need to catch these errors, in most cases this is though simply an error that should hard-fail.
2015-10-25 17:58:21 +01:00
Robin Appelman faf642c31d expose the mount manager in the public api 2015-07-01 15:57:04 +02:00
Morris Jobke f63915d0c8 update license headers and authors 2015-06-25 14:13:49 +02:00
Morris Jobke 5f59393b30 Merge pull request #17110 from owncloud/share-error-handling
[sharing] handle shares of users that aren't available anymore
2015-06-24 17:38:34 +02:00
Morris Jobke 4f2f8a6f28 [sharing] handle shares of users that aren't available anymore
* properly handle the case where an abandoned share is left and
  simply skip it
2015-06-23 18:22:36 +02:00
Morris Jobke fdd01cf15c Added error message on initMountpoints exception 2015-06-23 09:54:03 +02:00
Robin Appelman 8926bca0c7 phpdoc, strict and type hints 2015-06-02 14:07:55 +02:00
Robin Appelman 6f47a547d8 only use mount provider if we have a valid user 2015-06-02 14:07:54 +02:00
Robin Appelman 24131586d7 call mount providers that are registered after the filesystem is setup 2015-06-02 14:07:54 +02:00
Jörn Friedrich Dreyer b069f33a72 throw exception when backends don't provide a user instead of creating legacy local storages 2015-04-10 09:12:37 +02:00
Robin Appelman f585994c4b setup mount manager before wrappers 2015-04-02 13:28:36 +02:00
Robin Appelman cb9ead7dde add priority to storage wrappers 2015-03-26 21:26:38 +01:00
Jenkins for ownCloud b585d87d9d Update license headers 2015-03-26 11:44:36 +01:00
Morris Jobke 82254ad5ef Merge pull request #13893 from owncloud/create-cachedir-on-user
Only make sure the cache directory exists when we use it
2015-03-11 16:49:24 +01:00
Morris Jobke 06aef4e8b1 Revert "Updating license headers"
This reverts commit 6a1a4880f0.
2015-02-26 11:37:37 +01:00
Jenkins for ownCloud 6a1a4880f0 Updating license headers 2015-02-23 12:13:59 +01:00
Lukas Reschke 9904b30070 Ensure that passed argument is always a string
Some code paths called the `normalizePath` functionality with types other than a string which resulted in unexpected behaviour.

Thus the function is now manually casting the type to a string and I corrected the usage in list.php as well.
2015-02-13 12:49:34 +01:00
Lukas Reschke 4d91fa4c93 Normalize before processing 2015-02-06 15:03:29 +01:00
Robin Appelman 4a9c64e96b Only make sure the cache directory exists when we use it 2015-02-04 16:52:50 +01:00
Robin Appelman ddee63fa00 Fix resolving paths for views rooted in a file 2015-01-29 12:47:11 +01:00
Robin Appelman 960ff4f136 Apply wrappers to existing mounts before registering it 2015-01-23 13:48:35 +01:00
Vincent Petry 5fb8a4715d removeStorageWrapper to unregister a storage wrapper 2015-01-23 12:20:54 +01:00
Vincent Petry 6fb553e92c Do not call wrapStorage if storate with same name added twice 2015-01-22 16:24:24 +01:00
Lukas Reschke f0ac8a278a Use json_encode on string
It's better to encode the string to prevent possible (yet unknown) bugs in combination with PHP's type juggling.

Previously the boolean statements evaluated to either an empty string (false) or a not empty one (true, then it was 1). Not it always evaluates to false or true.

This also removes a stray - that was not intended there but shouldn't have produced any bugs. Just to increase readability.

Thanks @nickvergessen for spotting.

Addresses https://github.com/owncloud/core/pull/13235/files#r22852319
2015-01-13 11:08:18 +01:00
Morris Jobke c91d47e5b3 Merge pull request #13224 from owncloud/simplify-is-valid-path-and-add-unit-tests
Simplify isValidPath and add unit tests
2015-01-10 17:35:40 +01:00
Lukas Reschke 7e11ca06f6 Cache results of `normalizePath`
`normalizePath` is a rather expensive operation and called multiple times for a single path for every file related operation.

In my development installation with about 9GB of data and 60k files this leads to a performance boost of 24% - in seconds that are 1.86s (!) - for simple searches. With more files the impact will be even more noticeable. Obviously this affects every operation that has in any regard something to do with using OC\Files\Filesystem.

Part of https://github.com/owncloud/core/issues/13221
2015-01-10 11:10:38 +01:00
Lukas Reschke 05615bfd47 Simplify isValidPath and add unit tests
The check for invalid paths is actually over-complicated and performed twice resulting in a performance penalty. Additionally, I decided to add unit-tests to that function.

Part of https://github.com/owncloud/core/issues/13221
2015-01-10 00:40:21 +01:00
Vincent Petry 15ecb28d50 Make $userId mandatory for searchByTags
$userId is now a mandatory parameter for searchByTags.

Also fixed some places in the code where the argument was missing (Node
API and View)
2014-12-12 11:18:35 +01:00
Vincent Petry 25dde7e93b Added searchByTags to view, storage and cache 2014-12-11 17:38:50 +01:00
Robin Appelman f4701d7721 Add public api for mount configurations 2014-12-04 16:47:27 +01:00
Joas Schilling 0ab973a3a6 Make it possible to cleanPath() absolute Windows paths 2014-11-17 10:48:15 +01:00
Robin Appelman 2974d4d380 Reset the users setup after clearing mounts 2014-10-28 15:13:29 +01:00
Robin Appelman 3f63f4b6b1 Only mount the storages for the user once 2014-10-27 18:50:28 +01:00
Vincent Petry 6585eaa5df Added failing unit tests for mount config hooks 2014-10-08 14:22:17 +02:00
Robin Appelman a9a37b5363 Don't automatically setup the filesystem the moment we load OC\Files\FileSystem 2014-09-02 16:15:42 +02:00
Morris Jobke b3b3354809 move to public namespace 2014-08-19 14:05:08 +02:00
Stephan Peijnik 5d7deefd95 Use tabs for indentation.
Signed-off-by: Stephan Peijnik <speijnik@anexia-it.com>
2014-08-19 13:55:43 +02:00
Stephan Peijnik 2df52e54d7 Fix STORAGE_* constants usage by moving those constants into \OC\Files\Filesystem.
As constants not defined within a class cannot be automatically found by the
autoloader moving those constants into a class makes them accessible to
code which uses them.

Signed-off-by: Stephan Peijnik <speijnik@anexia-it.com>
2014-08-19 13:55:35 +02:00
Jörn Friedrich Dreyer 5cae863408 change architecture from inheritance to composition 2014-06-18 12:53:20 +02:00
Jörn Friedrich Dreyer 4e65889f54 only use one config option 'objectstore' for root and home storage configuration 2014-06-18 12:53:20 +02:00
Jörn Friedrich Dreyer 10de4a7b90 move creation of / and users 'files' from storage constructor to setupFS / mount initialization 2014-06-18 12:53:20 +02:00
Jörn Friedrich Dreyer 1374ba9adf fix fallback config for default home storage 2014-06-18 12:53:20 +02:00
Jörn Friedrich Dreyer 3c66a8c8ed allow configuring objectstore as home and root storage 2014-06-18 12:53:19 +02:00
Bjoern Schiessle ab6680e9ab name the storage wrapper to make sure that we don't apply the wrapper multiple times 2014-06-04 07:55:46 +02:00
Morris Jobke dc36d30953 Remove all occurences of @brief and @returns from PHPDoc
* test case added to avoid adding them later
2014-05-19 17:50:53 +02:00
Robin McCorkell 87b548ed91 Fix all PHPDoc types and variable names, in /lib 2014-05-13 19:08:14 +01:00
Robin McCorkell b5bc37d2e4 Fix @return array PHPDocs, in /lib 2014-05-13 19:08:14 +01:00
Joas Schilling 4fa9e46d2b Emit a new hook, when a file is being updated only
The write-hook also is triggered for created files

Fix #8131
2014-04-29 10:34:26 +02:00
Robin Appelman 3d0661a1e7 Fix error when viewing expired link 2014-04-23 12:54:18 +02:00