@@ -27,16 +27,16 @@ |
||
27 | 27 | */ |
28 | 28 | class StorageTimeoutException extends StorageNotAvailableException { |
29 | 29 | |
30 | - /** |
|
31 | - * StorageTimeoutException constructor. |
|
32 | - * |
|
33 | - * @param string $message |
|
34 | - * @param int $code |
|
35 | - * @param \Exception $previous |
|
36 | - * @since 9.0.0 |
|
37 | - */ |
|
38 | - public function __construct($message = '', \Exception $previous = null) { |
|
39 | - $l = \OC::$server->getL10N('core'); |
|
40 | - parent::__construct($l->t('Storage connection timeout. %s', $message), self::STATUS_TIMEOUT, $previous); |
|
41 | - } |
|
30 | + /** |
|
31 | + * StorageTimeoutException constructor. |
|
32 | + * |
|
33 | + * @param string $message |
|
34 | + * @param int $code |
|
35 | + * @param \Exception $previous |
|
36 | + * @since 9.0.0 |
|
37 | + */ |
|
38 | + public function __construct($message = '', \Exception $previous = null) { |
|
39 | + $l = \OC::$server->getL10N('core'); |
|
40 | + parent::__construct($l->t('Storage connection timeout. %s', $message), self::STATUS_TIMEOUT, $previous); |
|
41 | + } |
|
42 | 42 | } |
@@ -30,47 +30,47 @@ |
||
30 | 30 | * @since 9.0.0 |
31 | 31 | */ |
32 | 32 | interface IUpdater { |
33 | - /** |
|
34 | - * Get the propagator for etags and mtime for the view the updater works on |
|
35 | - * |
|
36 | - * @return IPropagator |
|
37 | - * @since 9.0.0 |
|
38 | - */ |
|
39 | - public function getPropagator(); |
|
33 | + /** |
|
34 | + * Get the propagator for etags and mtime for the view the updater works on |
|
35 | + * |
|
36 | + * @return IPropagator |
|
37 | + * @since 9.0.0 |
|
38 | + */ |
|
39 | + public function getPropagator(); |
|
40 | 40 | |
41 | - /** |
|
42 | - * Propagate etag and mtime changes for the parent folders of $path up to the root of the filesystem |
|
43 | - * |
|
44 | - * @param string $path the path of the file to propagate the changes for |
|
45 | - * @param int|null $time the timestamp to set as mtime for the parent folders, if left out the current time is used |
|
46 | - * @since 9.0.0 |
|
47 | - */ |
|
48 | - public function propagate($path, $time = null); |
|
41 | + /** |
|
42 | + * Propagate etag and mtime changes for the parent folders of $path up to the root of the filesystem |
|
43 | + * |
|
44 | + * @param string $path the path of the file to propagate the changes for |
|
45 | + * @param int|null $time the timestamp to set as mtime for the parent folders, if left out the current time is used |
|
46 | + * @since 9.0.0 |
|
47 | + */ |
|
48 | + public function propagate($path, $time = null); |
|
49 | 49 | |
50 | - /** |
|
51 | - * Update the cache for $path and update the size, etag and mtime of the parent folders |
|
52 | - * |
|
53 | - * @param string $path |
|
54 | - * @param int $time |
|
55 | - * @since 9.0.0 |
|
56 | - */ |
|
57 | - public function update($path, $time = null); |
|
50 | + /** |
|
51 | + * Update the cache for $path and update the size, etag and mtime of the parent folders |
|
52 | + * |
|
53 | + * @param string $path |
|
54 | + * @param int $time |
|
55 | + * @since 9.0.0 |
|
56 | + */ |
|
57 | + public function update($path, $time = null); |
|
58 | 58 | |
59 | - /** |
|
60 | - * Remove $path from the cache and update the size, etag and mtime of the parent folders |
|
61 | - * |
|
62 | - * @param string $path |
|
63 | - * @since 9.0.0 |
|
64 | - */ |
|
65 | - public function remove($path); |
|
59 | + /** |
|
60 | + * Remove $path from the cache and update the size, etag and mtime of the parent folders |
|
61 | + * |
|
62 | + * @param string $path |
|
63 | + * @since 9.0.0 |
|
64 | + */ |
|
65 | + public function remove($path); |
|
66 | 66 | |
67 | - /** |
|
68 | - * Rename a file or folder in the cache and update the size, etag and mtime of the parent folders |
|
69 | - * |
|
70 | - * @param IStorage $sourceStorage |
|
71 | - * @param string $source |
|
72 | - * @param string $target |
|
73 | - * @since 9.0.0 |
|
74 | - */ |
|
75 | - public function renameFromStorage(IStorage $sourceStorage, $source, $target); |
|
67 | + /** |
|
68 | + * Rename a file or folder in the cache and update the size, etag and mtime of the parent folders |
|
69 | + * |
|
70 | + * @param IStorage $sourceStorage |
|
71 | + * @param string $source |
|
72 | + * @param string $target |
|
73 | + * @since 9.0.0 |
|
74 | + */ |
|
75 | + public function renameFromStorage(IStorage $sourceStorage, $source, $target); |
|
76 | 76 | } |
@@ -28,108 +28,108 @@ |
||
28 | 28 | * @since 9.0.0 |
29 | 29 | */ |
30 | 30 | interface ICacheEntry { |
31 | - const DIRECTORY_MIMETYPE = 'httpd/unix-directory'; |
|
31 | + const DIRECTORY_MIMETYPE = 'httpd/unix-directory'; |
|
32 | 32 | |
33 | - /** |
|
34 | - * Get the numeric id of a file |
|
35 | - * |
|
36 | - * @return int |
|
37 | - * @since 9.0.0 |
|
38 | - */ |
|
39 | - public function getId(); |
|
33 | + /** |
|
34 | + * Get the numeric id of a file |
|
35 | + * |
|
36 | + * @return int |
|
37 | + * @since 9.0.0 |
|
38 | + */ |
|
39 | + public function getId(); |
|
40 | 40 | |
41 | - /** |
|
42 | - * Get the numeric id for the storage |
|
43 | - * |
|
44 | - * @return int |
|
45 | - * @since 9.0.0 |
|
46 | - */ |
|
47 | - public function getStorageId(); |
|
41 | + /** |
|
42 | + * Get the numeric id for the storage |
|
43 | + * |
|
44 | + * @return int |
|
45 | + * @since 9.0.0 |
|
46 | + */ |
|
47 | + public function getStorageId(); |
|
48 | 48 | |
49 | - /** |
|
50 | - * Get the path of the file relative to the storage root |
|
51 | - * |
|
52 | - * @return string |
|
53 | - * @since 9.0.0 |
|
54 | - */ |
|
55 | - public function getPath(); |
|
49 | + /** |
|
50 | + * Get the path of the file relative to the storage root |
|
51 | + * |
|
52 | + * @return string |
|
53 | + * @since 9.0.0 |
|
54 | + */ |
|
55 | + public function getPath(); |
|
56 | 56 | |
57 | - /** |
|
58 | - * Get the file name |
|
59 | - * |
|
60 | - * @return string |
|
61 | - * @since 9.0.0 |
|
62 | - */ |
|
63 | - public function getName(); |
|
57 | + /** |
|
58 | + * Get the file name |
|
59 | + * |
|
60 | + * @return string |
|
61 | + * @since 9.0.0 |
|
62 | + */ |
|
63 | + public function getName(); |
|
64 | 64 | |
65 | - /** |
|
66 | - * Get the full mimetype |
|
67 | - * |
|
68 | - * @return string |
|
69 | - * @since 9.0.0 |
|
70 | - */ |
|
71 | - public function getMimeType(); |
|
65 | + /** |
|
66 | + * Get the full mimetype |
|
67 | + * |
|
68 | + * @return string |
|
69 | + * @since 9.0.0 |
|
70 | + */ |
|
71 | + public function getMimeType(); |
|
72 | 72 | |
73 | - /** |
|
74 | - * Get the first part of the mimetype |
|
75 | - * |
|
76 | - * @return string |
|
77 | - * @since 9.0.0 |
|
78 | - */ |
|
79 | - public function getMimePart(); |
|
73 | + /** |
|
74 | + * Get the first part of the mimetype |
|
75 | + * |
|
76 | + * @return string |
|
77 | + * @since 9.0.0 |
|
78 | + */ |
|
79 | + public function getMimePart(); |
|
80 | 80 | |
81 | - /** |
|
82 | - * Get the file size in bytes |
|
83 | - * |
|
84 | - * @return int |
|
85 | - * @since 9.0.0 |
|
86 | - */ |
|
87 | - public function getSize(); |
|
81 | + /** |
|
82 | + * Get the file size in bytes |
|
83 | + * |
|
84 | + * @return int |
|
85 | + * @since 9.0.0 |
|
86 | + */ |
|
87 | + public function getSize(); |
|
88 | 88 | |
89 | - /** |
|
90 | - * Get the last modified date as unix timestamp |
|
91 | - * |
|
92 | - * @return int |
|
93 | - * @since 9.0.0 |
|
94 | - */ |
|
95 | - public function getMTime(); |
|
89 | + /** |
|
90 | + * Get the last modified date as unix timestamp |
|
91 | + * |
|
92 | + * @return int |
|
93 | + * @since 9.0.0 |
|
94 | + */ |
|
95 | + public function getMTime(); |
|
96 | 96 | |
97 | - /** |
|
98 | - * Get the last modified date on the storage as unix timestamp |
|
99 | - * |
|
100 | - * Note that when a file is updated we also update the mtime of all parent folders to make it visible to the user which folder has had updates most recently |
|
101 | - * This can differ from the mtime on the underlying storage which usually only changes when a direct child is added, removed or renamed |
|
102 | - * |
|
103 | - * @return int |
|
104 | - * @since 9.0.0 |
|
105 | - */ |
|
106 | - public function getStorageMTime(); |
|
97 | + /** |
|
98 | + * Get the last modified date on the storage as unix timestamp |
|
99 | + * |
|
100 | + * Note that when a file is updated we also update the mtime of all parent folders to make it visible to the user which folder has had updates most recently |
|
101 | + * This can differ from the mtime on the underlying storage which usually only changes when a direct child is added, removed or renamed |
|
102 | + * |
|
103 | + * @return int |
|
104 | + * @since 9.0.0 |
|
105 | + */ |
|
106 | + public function getStorageMTime(); |
|
107 | 107 | |
108 | - /** |
|
109 | - * Get the etag for the file |
|
110 | - * |
|
111 | - * An etag is used for change detection of files and folders, an etag of a file changes whenever the content of the file changes |
|
112 | - * Etag for folders change whenever a file in the folder has changed |
|
113 | - * |
|
114 | - * @return string |
|
115 | - * @since 9.0.0 |
|
116 | - */ |
|
117 | - public function getEtag(); |
|
108 | + /** |
|
109 | + * Get the etag for the file |
|
110 | + * |
|
111 | + * An etag is used for change detection of files and folders, an etag of a file changes whenever the content of the file changes |
|
112 | + * Etag for folders change whenever a file in the folder has changed |
|
113 | + * |
|
114 | + * @return string |
|
115 | + * @since 9.0.0 |
|
116 | + */ |
|
117 | + public function getEtag(); |
|
118 | 118 | |
119 | - /** |
|
120 | - * Get the permissions for the file stored as bitwise combination of \OCP\PERMISSION_READ, \OCP\PERMISSION_CREATE |
|
121 | - * \OCP\PERMISSION_UPDATE, \OCP\PERMISSION_DELETE and \OCP\PERMISSION_SHARE |
|
122 | - * |
|
123 | - * @return int |
|
124 | - * @since 9.0.0 |
|
125 | - */ |
|
126 | - public function getPermissions(); |
|
119 | + /** |
|
120 | + * Get the permissions for the file stored as bitwise combination of \OCP\PERMISSION_READ, \OCP\PERMISSION_CREATE |
|
121 | + * \OCP\PERMISSION_UPDATE, \OCP\PERMISSION_DELETE and \OCP\PERMISSION_SHARE |
|
122 | + * |
|
123 | + * @return int |
|
124 | + * @since 9.0.0 |
|
125 | + */ |
|
126 | + public function getPermissions(); |
|
127 | 127 | |
128 | - /** |
|
129 | - * Check if the file is encrypted |
|
130 | - * |
|
131 | - * @return bool |
|
132 | - * @since 9.0.0 |
|
133 | - */ |
|
134 | - public function isEncrypted(); |
|
128 | + /** |
|
129 | + * Check if the file is encrypted |
|
130 | + * |
|
131 | + * @return bool |
|
132 | + * @since 9.0.0 |
|
133 | + */ |
|
134 | + public function isEncrypted(); |
|
135 | 135 | } |
@@ -28,56 +28,56 @@ |
||
28 | 28 | * @since 9.0.0 |
29 | 29 | */ |
30 | 30 | interface IWatcher { |
31 | - const CHECK_NEVER = 0; // never check the underlying filesystem for updates |
|
32 | - const CHECK_ONCE = 1; // check the underlying filesystem for updates once every request for each file |
|
33 | - const CHECK_ALWAYS = 2; // always check the underlying filesystem for updates |
|
31 | + const CHECK_NEVER = 0; // never check the underlying filesystem for updates |
|
32 | + const CHECK_ONCE = 1; // check the underlying filesystem for updates once every request for each file |
|
33 | + const CHECK_ALWAYS = 2; // always check the underlying filesystem for updates |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param int $policy either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS |
|
37 | - * @since 9.0.0 |
|
38 | - */ |
|
39 | - public function setPolicy($policy); |
|
35 | + /** |
|
36 | + * @param int $policy either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS |
|
37 | + * @since 9.0.0 |
|
38 | + */ |
|
39 | + public function setPolicy($policy); |
|
40 | 40 | |
41 | - /** |
|
42 | - * @return int either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS |
|
43 | - * @since 9.0.0 |
|
44 | - */ |
|
45 | - public function getPolicy(); |
|
41 | + /** |
|
42 | + * @return int either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS |
|
43 | + * @since 9.0.0 |
|
44 | + */ |
|
45 | + public function getPolicy(); |
|
46 | 46 | |
47 | - /** |
|
48 | - * check $path for updates and update if needed |
|
49 | - * |
|
50 | - * @param string $path |
|
51 | - * @param ICacheEntry|null $cachedEntry |
|
52 | - * @return boolean true if path was updated |
|
53 | - * @since 9.0.0 |
|
54 | - */ |
|
55 | - public function checkUpdate($path, $cachedEntry = null); |
|
47 | + /** |
|
48 | + * check $path for updates and update if needed |
|
49 | + * |
|
50 | + * @param string $path |
|
51 | + * @param ICacheEntry|null $cachedEntry |
|
52 | + * @return boolean true if path was updated |
|
53 | + * @since 9.0.0 |
|
54 | + */ |
|
55 | + public function checkUpdate($path, $cachedEntry = null); |
|
56 | 56 | |
57 | - /** |
|
58 | - * Update the cache for changes to $path |
|
59 | - * |
|
60 | - * @param string $path |
|
61 | - * @param ICacheEntry $cachedData |
|
62 | - * @since 9.0.0 |
|
63 | - */ |
|
64 | - public function update($path, $cachedData); |
|
57 | + /** |
|
58 | + * Update the cache for changes to $path |
|
59 | + * |
|
60 | + * @param string $path |
|
61 | + * @param ICacheEntry $cachedData |
|
62 | + * @since 9.0.0 |
|
63 | + */ |
|
64 | + public function update($path, $cachedData); |
|
65 | 65 | |
66 | - /** |
|
67 | - * Check if the cache for $path needs to be updated |
|
68 | - * |
|
69 | - * @param string $path |
|
70 | - * @param ICacheEntry $cachedData |
|
71 | - * @return bool |
|
72 | - * @since 9.0.0 |
|
73 | - */ |
|
74 | - public function needsUpdate($path, $cachedData); |
|
66 | + /** |
|
67 | + * Check if the cache for $path needs to be updated |
|
68 | + * |
|
69 | + * @param string $path |
|
70 | + * @param ICacheEntry $cachedData |
|
71 | + * @return bool |
|
72 | + * @since 9.0.0 |
|
73 | + */ |
|
74 | + public function needsUpdate($path, $cachedData); |
|
75 | 75 | |
76 | - /** |
|
77 | - * remove deleted files in $path from the cache |
|
78 | - * |
|
79 | - * @param string $path |
|
80 | - * @since 9.0.0 |
|
81 | - */ |
|
82 | - public function cleanFolder($path); |
|
76 | + /** |
|
77 | + * remove deleted files in $path from the cache |
|
78 | + * |
|
79 | + * @param string $path |
|
80 | + * @since 9.0.0 |
|
81 | + */ |
|
82 | + public function cleanFolder($path); |
|
83 | 83 | } |
@@ -35,223 +35,223 @@ |
||
35 | 35 | * @since 9.0.0 |
36 | 36 | */ |
37 | 37 | interface ICache { |
38 | - const NOT_FOUND = 0; |
|
39 | - const PARTIAL = 1; //only partial data available, file not cached in the database |
|
40 | - const SHALLOW = 2; //folder in cache, but not all child files are completely scanned |
|
41 | - const COMPLETE = 3; |
|
38 | + const NOT_FOUND = 0; |
|
39 | + const PARTIAL = 1; //only partial data available, file not cached in the database |
|
40 | + const SHALLOW = 2; //folder in cache, but not all child files are completely scanned |
|
41 | + const COMPLETE = 3; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Get the numeric storage id for this cache's storage |
|
45 | - * |
|
46 | - * @return int |
|
47 | - * @since 9.0.0 |
|
48 | - */ |
|
49 | - public function getNumericStorageId(); |
|
43 | + /** |
|
44 | + * Get the numeric storage id for this cache's storage |
|
45 | + * |
|
46 | + * @return int |
|
47 | + * @since 9.0.0 |
|
48 | + */ |
|
49 | + public function getNumericStorageId(); |
|
50 | 50 | |
51 | - /** |
|
52 | - * get the stored metadata of a file or folder |
|
53 | - * |
|
54 | - * @param string | int $file either the path of a file or folder or the file id for a file or folder |
|
55 | - * @return ICacheEntry|false the cache entry or false if the file is not found in the cache |
|
56 | - * @since 9.0.0 |
|
57 | - */ |
|
58 | - public function get($file); |
|
51 | + /** |
|
52 | + * get the stored metadata of a file or folder |
|
53 | + * |
|
54 | + * @param string | int $file either the path of a file or folder or the file id for a file or folder |
|
55 | + * @return ICacheEntry|false the cache entry or false if the file is not found in the cache |
|
56 | + * @since 9.0.0 |
|
57 | + */ |
|
58 | + public function get($file); |
|
59 | 59 | |
60 | - /** |
|
61 | - * get the metadata of all files stored in $folder |
|
62 | - * |
|
63 | - * Only returns files one level deep, no recursion |
|
64 | - * |
|
65 | - * @param string $folder |
|
66 | - * @return ICacheEntry[] |
|
67 | - * @since 9.0.0 |
|
68 | - */ |
|
69 | - public function getFolderContents($folder); |
|
60 | + /** |
|
61 | + * get the metadata of all files stored in $folder |
|
62 | + * |
|
63 | + * Only returns files one level deep, no recursion |
|
64 | + * |
|
65 | + * @param string $folder |
|
66 | + * @return ICacheEntry[] |
|
67 | + * @since 9.0.0 |
|
68 | + */ |
|
69 | + public function getFolderContents($folder); |
|
70 | 70 | |
71 | - /** |
|
72 | - * get the metadata of all files stored in $folder |
|
73 | - * |
|
74 | - * Only returns files one level deep, no recursion |
|
75 | - * |
|
76 | - * @param int $fileId the file id of the folder |
|
77 | - * @return ICacheEntry[] |
|
78 | - * @since 9.0.0 |
|
79 | - */ |
|
80 | - public function getFolderContentsById($fileId); |
|
71 | + /** |
|
72 | + * get the metadata of all files stored in $folder |
|
73 | + * |
|
74 | + * Only returns files one level deep, no recursion |
|
75 | + * |
|
76 | + * @param int $fileId the file id of the folder |
|
77 | + * @return ICacheEntry[] |
|
78 | + * @since 9.0.0 |
|
79 | + */ |
|
80 | + public function getFolderContentsById($fileId); |
|
81 | 81 | |
82 | - /** |
|
83 | - * store meta data for a file or folder |
|
84 | - * This will automatically call either insert or update depending on if the file exists |
|
85 | - * |
|
86 | - * @param string $file |
|
87 | - * @param array $data |
|
88 | - * |
|
89 | - * @return int file id |
|
90 | - * @throws \RuntimeException |
|
91 | - * @since 9.0.0 |
|
92 | - */ |
|
93 | - public function put($file, array $data); |
|
82 | + /** |
|
83 | + * store meta data for a file or folder |
|
84 | + * This will automatically call either insert or update depending on if the file exists |
|
85 | + * |
|
86 | + * @param string $file |
|
87 | + * @param array $data |
|
88 | + * |
|
89 | + * @return int file id |
|
90 | + * @throws \RuntimeException |
|
91 | + * @since 9.0.0 |
|
92 | + */ |
|
93 | + public function put($file, array $data); |
|
94 | 94 | |
95 | - /** |
|
96 | - * insert meta data for a new file or folder |
|
97 | - * |
|
98 | - * @param string $file |
|
99 | - * @param array $data |
|
100 | - * |
|
101 | - * @return int file id |
|
102 | - * @throws \RuntimeException |
|
103 | - * @since 9.0.0 |
|
104 | - */ |
|
105 | - public function insert($file, array $data); |
|
95 | + /** |
|
96 | + * insert meta data for a new file or folder |
|
97 | + * |
|
98 | + * @param string $file |
|
99 | + * @param array $data |
|
100 | + * |
|
101 | + * @return int file id |
|
102 | + * @throws \RuntimeException |
|
103 | + * @since 9.0.0 |
|
104 | + */ |
|
105 | + public function insert($file, array $data); |
|
106 | 106 | |
107 | - /** |
|
108 | - * update the metadata of an existing file or folder in the cache |
|
109 | - * |
|
110 | - * @param int $id the fileid of the existing file or folder |
|
111 | - * @param array $data [$key => $value] the metadata to update, only the fields provided in the array will be updated, non-provided values will remain unchanged |
|
112 | - * @since 9.0.0 |
|
113 | - */ |
|
114 | - public function update($id, array $data); |
|
107 | + /** |
|
108 | + * update the metadata of an existing file or folder in the cache |
|
109 | + * |
|
110 | + * @param int $id the fileid of the existing file or folder |
|
111 | + * @param array $data [$key => $value] the metadata to update, only the fields provided in the array will be updated, non-provided values will remain unchanged |
|
112 | + * @since 9.0.0 |
|
113 | + */ |
|
114 | + public function update($id, array $data); |
|
115 | 115 | |
116 | - /** |
|
117 | - * get the file id for a file |
|
118 | - * |
|
119 | - * A file id is a numeric id for a file or folder that's unique within an owncloud instance which stays the same for the lifetime of a file |
|
120 | - * |
|
121 | - * File ids are easiest way for apps to store references to a file since unlike paths they are not affected by renames or sharing |
|
122 | - * |
|
123 | - * @param string $file |
|
124 | - * @return int |
|
125 | - * @since 9.0.0 |
|
126 | - */ |
|
127 | - public function getId($file); |
|
116 | + /** |
|
117 | + * get the file id for a file |
|
118 | + * |
|
119 | + * A file id is a numeric id for a file or folder that's unique within an owncloud instance which stays the same for the lifetime of a file |
|
120 | + * |
|
121 | + * File ids are easiest way for apps to store references to a file since unlike paths they are not affected by renames or sharing |
|
122 | + * |
|
123 | + * @param string $file |
|
124 | + * @return int |
|
125 | + * @since 9.0.0 |
|
126 | + */ |
|
127 | + public function getId($file); |
|
128 | 128 | |
129 | - /** |
|
130 | - * get the id of the parent folder of a file |
|
131 | - * |
|
132 | - * @param string $file |
|
133 | - * @return int |
|
134 | - * @since 9.0.0 |
|
135 | - */ |
|
136 | - public function getParentId($file); |
|
129 | + /** |
|
130 | + * get the id of the parent folder of a file |
|
131 | + * |
|
132 | + * @param string $file |
|
133 | + * @return int |
|
134 | + * @since 9.0.0 |
|
135 | + */ |
|
136 | + public function getParentId($file); |
|
137 | 137 | |
138 | - /** |
|
139 | - * check if a file is available in the cache |
|
140 | - * |
|
141 | - * @param string $file |
|
142 | - * @return bool |
|
143 | - * @since 9.0.0 |
|
144 | - */ |
|
145 | - public function inCache($file); |
|
138 | + /** |
|
139 | + * check if a file is available in the cache |
|
140 | + * |
|
141 | + * @param string $file |
|
142 | + * @return bool |
|
143 | + * @since 9.0.0 |
|
144 | + */ |
|
145 | + public function inCache($file); |
|
146 | 146 | |
147 | - /** |
|
148 | - * remove a file or folder from the cache |
|
149 | - * |
|
150 | - * when removing a folder from the cache all files and folders inside the folder will be removed as well |
|
151 | - * |
|
152 | - * @param string $file |
|
153 | - * @since 9.0.0 |
|
154 | - */ |
|
155 | - public function remove($file); |
|
147 | + /** |
|
148 | + * remove a file or folder from the cache |
|
149 | + * |
|
150 | + * when removing a folder from the cache all files and folders inside the folder will be removed as well |
|
151 | + * |
|
152 | + * @param string $file |
|
153 | + * @since 9.0.0 |
|
154 | + */ |
|
155 | + public function remove($file); |
|
156 | 156 | |
157 | - /** |
|
158 | - * Move a file or folder in the cache |
|
159 | - * |
|
160 | - * @param string $source |
|
161 | - * @param string $target |
|
162 | - * @since 9.0.0 |
|
163 | - */ |
|
164 | - public function move($source, $target); |
|
157 | + /** |
|
158 | + * Move a file or folder in the cache |
|
159 | + * |
|
160 | + * @param string $source |
|
161 | + * @param string $target |
|
162 | + * @since 9.0.0 |
|
163 | + */ |
|
164 | + public function move($source, $target); |
|
165 | 165 | |
166 | - /** |
|
167 | - * Move a file or folder in the cache |
|
168 | - * |
|
169 | - * Note that this should make sure the entries are removed from the source cache |
|
170 | - * |
|
171 | - * @param \OCP\Files\Cache\ICache $sourceCache |
|
172 | - * @param string $sourcePath |
|
173 | - * @param string $targetPath |
|
174 | - * @throws \OC\DatabaseException |
|
175 | - * @since 9.0.0 |
|
176 | - */ |
|
177 | - public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath); |
|
166 | + /** |
|
167 | + * Move a file or folder in the cache |
|
168 | + * |
|
169 | + * Note that this should make sure the entries are removed from the source cache |
|
170 | + * |
|
171 | + * @param \OCP\Files\Cache\ICache $sourceCache |
|
172 | + * @param string $sourcePath |
|
173 | + * @param string $targetPath |
|
174 | + * @throws \OC\DatabaseException |
|
175 | + * @since 9.0.0 |
|
176 | + */ |
|
177 | + public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath); |
|
178 | 178 | |
179 | - /** |
|
180 | - * Get the scan status of a file |
|
181 | - * |
|
182 | - * - ICache::NOT_FOUND: File is not in the cache |
|
183 | - * - ICache::PARTIAL: File is not stored in the cache but some incomplete data is known |
|
184 | - * - ICache::SHALLOW: The folder and it's direct children are in the cache but not all sub folders are fully scanned |
|
185 | - * - ICache::COMPLETE: The file or folder, with all it's children) are fully scanned |
|
186 | - * |
|
187 | - * @param string $file |
|
188 | - * |
|
189 | - * @return int ICache::NOT_FOUND, ICache::PARTIAL, ICache::SHALLOW or ICache::COMPLETE |
|
190 | - * @since 9.0.0 |
|
191 | - */ |
|
192 | - public function getStatus($file); |
|
179 | + /** |
|
180 | + * Get the scan status of a file |
|
181 | + * |
|
182 | + * - ICache::NOT_FOUND: File is not in the cache |
|
183 | + * - ICache::PARTIAL: File is not stored in the cache but some incomplete data is known |
|
184 | + * - ICache::SHALLOW: The folder and it's direct children are in the cache but not all sub folders are fully scanned |
|
185 | + * - ICache::COMPLETE: The file or folder, with all it's children) are fully scanned |
|
186 | + * |
|
187 | + * @param string $file |
|
188 | + * |
|
189 | + * @return int ICache::NOT_FOUND, ICache::PARTIAL, ICache::SHALLOW or ICache::COMPLETE |
|
190 | + * @since 9.0.0 |
|
191 | + */ |
|
192 | + public function getStatus($file); |
|
193 | 193 | |
194 | - /** |
|
195 | - * search for files matching $pattern, files are matched if their filename matches the search pattern |
|
196 | - * |
|
197 | - * @param string $pattern the search pattern using SQL search syntax (e.g. '%searchstring%') |
|
198 | - * @return ICacheEntry[] an array of cache entries where the name matches the search pattern |
|
199 | - * @since 9.0.0 |
|
200 | - * @deprecated 9.0.0 due to lack of pagination, not all backends might implement this |
|
201 | - */ |
|
202 | - public function search($pattern); |
|
194 | + /** |
|
195 | + * search for files matching $pattern, files are matched if their filename matches the search pattern |
|
196 | + * |
|
197 | + * @param string $pattern the search pattern using SQL search syntax (e.g. '%searchstring%') |
|
198 | + * @return ICacheEntry[] an array of cache entries where the name matches the search pattern |
|
199 | + * @since 9.0.0 |
|
200 | + * @deprecated 9.0.0 due to lack of pagination, not all backends might implement this |
|
201 | + */ |
|
202 | + public function search($pattern); |
|
203 | 203 | |
204 | - /** |
|
205 | - * search for files by mimetype |
|
206 | - * |
|
207 | - * @param string $mimetype either a full mimetype to search ('text/plain') or only the first part of a mimetype ('image') |
|
208 | - * where it will search for all mimetypes in the group ('image/*') |
|
209 | - * @return ICacheEntry[] an array of cache entries where the mimetype matches the search |
|
210 | - * @since 9.0.0 |
|
211 | - * @deprecated 9.0.0 due to lack of pagination, not all backends might implement this |
|
212 | - */ |
|
213 | - public function searchByMime($mimetype); |
|
204 | + /** |
|
205 | + * search for files by mimetype |
|
206 | + * |
|
207 | + * @param string $mimetype either a full mimetype to search ('text/plain') or only the first part of a mimetype ('image') |
|
208 | + * where it will search for all mimetypes in the group ('image/*') |
|
209 | + * @return ICacheEntry[] an array of cache entries where the mimetype matches the search |
|
210 | + * @since 9.0.0 |
|
211 | + * @deprecated 9.0.0 due to lack of pagination, not all backends might implement this |
|
212 | + */ |
|
213 | + public function searchByMime($mimetype); |
|
214 | 214 | |
215 | - /** |
|
216 | - * Search for files by tag of a given users. |
|
217 | - * |
|
218 | - * Note that every user can tag files differently. |
|
219 | - * |
|
220 | - * @param string|int $tag name or tag id |
|
221 | - * @param string $userId owner of the tags |
|
222 | - * @return ICacheEntry[] file data |
|
223 | - * @since 9.0.0 |
|
224 | - * @deprecated 9.0.0 due to lack of pagination, not all backends might implement this |
|
225 | - */ |
|
226 | - public function searchByTag($tag, $userId); |
|
215 | + /** |
|
216 | + * Search for files by tag of a given users. |
|
217 | + * |
|
218 | + * Note that every user can tag files differently. |
|
219 | + * |
|
220 | + * @param string|int $tag name or tag id |
|
221 | + * @param string $userId owner of the tags |
|
222 | + * @return ICacheEntry[] file data |
|
223 | + * @since 9.0.0 |
|
224 | + * @deprecated 9.0.0 due to lack of pagination, not all backends might implement this |
|
225 | + */ |
|
226 | + public function searchByTag($tag, $userId); |
|
227 | 227 | |
228 | - /** |
|
229 | - * find a folder in the cache which has not been fully scanned |
|
230 | - * |
|
231 | - * If multiple incomplete folders are in the cache, the one with the highest id will be returned, |
|
232 | - * use the one with the highest id gives the best result with the background scanner, since that is most |
|
233 | - * likely the folder where we stopped scanning previously |
|
234 | - * |
|
235 | - * @return string|bool the path of the folder or false when no folder matched |
|
236 | - * @since 9.0.0 |
|
237 | - */ |
|
238 | - public function getIncomplete(); |
|
228 | + /** |
|
229 | + * find a folder in the cache which has not been fully scanned |
|
230 | + * |
|
231 | + * If multiple incomplete folders are in the cache, the one with the highest id will be returned, |
|
232 | + * use the one with the highest id gives the best result with the background scanner, since that is most |
|
233 | + * likely the folder where we stopped scanning previously |
|
234 | + * |
|
235 | + * @return string|bool the path of the folder or false when no folder matched |
|
236 | + * @since 9.0.0 |
|
237 | + */ |
|
238 | + public function getIncomplete(); |
|
239 | 239 | |
240 | - /** |
|
241 | - * get the path of a file on this storage by it's file id |
|
242 | - * |
|
243 | - * @param int $id the file id of the file or folder to search |
|
244 | - * @return string|null the path of the file (relative to the storage) or null if a file with the given id does not exists within this cache |
|
245 | - * @since 9.0.0 |
|
246 | - */ |
|
247 | - public function getPathById($id); |
|
240 | + /** |
|
241 | + * get the path of a file on this storage by it's file id |
|
242 | + * |
|
243 | + * @param int $id the file id of the file or folder to search |
|
244 | + * @return string|null the path of the file (relative to the storage) or null if a file with the given id does not exists within this cache |
|
245 | + * @since 9.0.0 |
|
246 | + */ |
|
247 | + public function getPathById($id); |
|
248 | 248 | |
249 | - /** |
|
250 | - * normalize the given path for usage in the cache |
|
251 | - * |
|
252 | - * @param string $path |
|
253 | - * @return string |
|
254 | - * @since 9.0.0 |
|
255 | - */ |
|
256 | - public function normalize($path); |
|
249 | + /** |
|
250 | + * normalize the given path for usage in the cache |
|
251 | + * |
|
252 | + * @param string $path |
|
253 | + * @return string |
|
254 | + * @since 9.0.0 |
|
255 | + */ |
|
256 | + public function normalize($path); |
|
257 | 257 | } |
@@ -28,29 +28,29 @@ |
||
28 | 28 | * @since 9.0.0 |
29 | 29 | */ |
30 | 30 | interface IPropagator { |
31 | - /** |
|
32 | - * Mark the beginning of a propagation batch |
|
33 | - * |
|
34 | - * Note that not all cache setups support propagation in which case this will be a noop |
|
35 | - * |
|
36 | - * Batching for cache setups that do support it has to be explicit since the cache state is not fully consistent |
|
37 | - * before the batch is committed. |
|
38 | - * |
|
39 | - * @since 9.1.0 |
|
40 | - */ |
|
41 | - public function beginBatch(); |
|
31 | + /** |
|
32 | + * Mark the beginning of a propagation batch |
|
33 | + * |
|
34 | + * Note that not all cache setups support propagation in which case this will be a noop |
|
35 | + * |
|
36 | + * Batching for cache setups that do support it has to be explicit since the cache state is not fully consistent |
|
37 | + * before the batch is committed. |
|
38 | + * |
|
39 | + * @since 9.1.0 |
|
40 | + */ |
|
41 | + public function beginBatch(); |
|
42 | 42 | |
43 | - /** |
|
44 | - * Commit the active propagation batch |
|
45 | - * |
|
46 | - * @since 9.1.0 |
|
47 | - */ |
|
48 | - public function commitBatch(); |
|
43 | + /** |
|
44 | + * Commit the active propagation batch |
|
45 | + * |
|
46 | + * @since 9.1.0 |
|
47 | + */ |
|
48 | + public function commitBatch(); |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param string $internalPath |
|
52 | - * @param int $time |
|
53 | - * @since 9.0.0 |
|
54 | - */ |
|
55 | - public function propagateChange($internalPath, $time); |
|
50 | + /** |
|
51 | + * @param string $internalPath |
|
52 | + * @param int $time |
|
53 | + * @since 9.0.0 |
|
54 | + */ |
|
55 | + public function propagateChange($internalPath, $time); |
|
56 | 56 | } |
@@ -30,51 +30,51 @@ |
||
30 | 30 | * @since 8.1.0 |
31 | 31 | */ |
32 | 32 | interface ILockingProvider { |
33 | - /** |
|
34 | - * @since 8.1.0 |
|
35 | - */ |
|
36 | - const LOCK_SHARED = 1; |
|
37 | - /** |
|
38 | - * @since 8.1.0 |
|
39 | - */ |
|
40 | - const LOCK_EXCLUSIVE = 2; |
|
33 | + /** |
|
34 | + * @since 8.1.0 |
|
35 | + */ |
|
36 | + const LOCK_SHARED = 1; |
|
37 | + /** |
|
38 | + * @since 8.1.0 |
|
39 | + */ |
|
40 | + const LOCK_EXCLUSIVE = 2; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @param string $path |
|
44 | - * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
45 | - * @return bool |
|
46 | - * @since 8.1.0 |
|
47 | - */ |
|
48 | - public function isLocked($path, $type); |
|
42 | + /** |
|
43 | + * @param string $path |
|
44 | + * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
45 | + * @return bool |
|
46 | + * @since 8.1.0 |
|
47 | + */ |
|
48 | + public function isLocked($path, $type); |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param string $path |
|
52 | - * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
53 | - * @throws \OCP\Lock\LockedException |
|
54 | - * @since 8.1.0 |
|
55 | - */ |
|
56 | - public function acquireLock($path, $type); |
|
50 | + /** |
|
51 | + * @param string $path |
|
52 | + * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
53 | + * @throws \OCP\Lock\LockedException |
|
54 | + * @since 8.1.0 |
|
55 | + */ |
|
56 | + public function acquireLock($path, $type); |
|
57 | 57 | |
58 | - /** |
|
59 | - * @param string $path |
|
60 | - * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
61 | - * @since 8.1.0 |
|
62 | - */ |
|
63 | - public function releaseLock($path, $type); |
|
58 | + /** |
|
59 | + * @param string $path |
|
60 | + * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
61 | + * @since 8.1.0 |
|
62 | + */ |
|
63 | + public function releaseLock($path, $type); |
|
64 | 64 | |
65 | - /** |
|
66 | - * Change the type of an existing lock |
|
67 | - * |
|
68 | - * @param string $path |
|
69 | - * @param int $targetType self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
70 | - * @throws \OCP\Lock\LockedException |
|
71 | - * @since 8.1.0 |
|
72 | - */ |
|
73 | - public function changeLock($path, $targetType); |
|
65 | + /** |
|
66 | + * Change the type of an existing lock |
|
67 | + * |
|
68 | + * @param string $path |
|
69 | + * @param int $targetType self::LOCK_SHARED or self::LOCK_EXCLUSIVE |
|
70 | + * @throws \OCP\Lock\LockedException |
|
71 | + * @since 8.1.0 |
|
72 | + */ |
|
73 | + public function changeLock($path, $targetType); |
|
74 | 74 | |
75 | - /** |
|
76 | - * release all lock acquired by this instance |
|
77 | - * @since 8.1.0 |
|
78 | - */ |
|
79 | - public function releaseAll(); |
|
75 | + /** |
|
76 | + * release all lock acquired by this instance |
|
77 | + * @since 8.1.0 |
|
78 | + */ |
|
79 | + public function releaseAll(); |
|
80 | 80 | } |
@@ -32,31 +32,31 @@ |
||
32 | 32 | */ |
33 | 33 | class LockedException extends \Exception { |
34 | 34 | |
35 | - /** |
|
36 | - * Locked path |
|
37 | - * |
|
38 | - * @var string |
|
39 | - */ |
|
40 | - private $path; |
|
35 | + /** |
|
36 | + * Locked path |
|
37 | + * |
|
38 | + * @var string |
|
39 | + */ |
|
40 | + private $path; |
|
41 | 41 | |
42 | - /** |
|
43 | - * LockedException constructor. |
|
44 | - * |
|
45 | - * @param string $path locked path |
|
46 | - * @param \Exception $previous previous exception for cascading |
|
47 | - * |
|
48 | - * @since 8.1.0 |
|
49 | - */ |
|
50 | - public function __construct($path, \Exception $previous = null) { |
|
51 | - parent::__construct('"' . $path . '" is locked', 0, $previous); |
|
52 | - $this->path = $path; |
|
53 | - } |
|
42 | + /** |
|
43 | + * LockedException constructor. |
|
44 | + * |
|
45 | + * @param string $path locked path |
|
46 | + * @param \Exception $previous previous exception for cascading |
|
47 | + * |
|
48 | + * @since 8.1.0 |
|
49 | + */ |
|
50 | + public function __construct($path, \Exception $previous = null) { |
|
51 | + parent::__construct('"' . $path . '" is locked', 0, $previous); |
|
52 | + $this->path = $path; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @return string |
|
57 | - * @since 8.1.0 |
|
58 | - */ |
|
59 | - public function getPath() { |
|
60 | - return $this->path; |
|
61 | - } |
|
55 | + /** |
|
56 | + * @return string |
|
57 | + * @since 8.1.0 |
|
58 | + */ |
|
59 | + public function getPath() { |
|
60 | + return $this->path; |
|
61 | + } |
|
62 | 62 | } |
@@ -40,158 +40,158 @@ |
||
40 | 40 | * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
41 | 41 | */ |
42 | 42 | class JSON { |
43 | - /** |
|
44 | - * Encode and print $data in JSON format |
|
45 | - * @param array $data The data to use |
|
46 | - * @param bool $setContentType the optional content type |
|
47 | - * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
48 | - */ |
|
49 | - public static function encodedPrint( $data, $setContentType=true ) { |
|
50 | - \OC_JSON::encodedPrint($data, $setContentType); |
|
51 | - } |
|
43 | + /** |
|
44 | + * Encode and print $data in JSON format |
|
45 | + * @param array $data The data to use |
|
46 | + * @param bool $setContentType the optional content type |
|
47 | + * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
48 | + */ |
|
49 | + public static function encodedPrint( $data, $setContentType=true ) { |
|
50 | + \OC_JSON::encodedPrint($data, $setContentType); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Check if the user is logged in, send json error msg if not. |
|
55 | - * |
|
56 | - * This method checks if a user is logged in. If not, a json error |
|
57 | - * response will be return and the method will exit from execution |
|
58 | - * of the script. |
|
59 | - * The returned json will be in the format: |
|
60 | - * |
|
61 | - * {"status":"error","data":{"message":"Authentication error."}} |
|
62 | - * |
|
63 | - * Add this call to the start of all ajax method files that requires |
|
64 | - * an authenticated user. |
|
65 | - * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead |
|
66 | - */ |
|
67 | - public static function checkLoggedIn() { |
|
68 | - \OC_JSON::checkLoggedIn(); |
|
69 | - } |
|
53 | + /** |
|
54 | + * Check if the user is logged in, send json error msg if not. |
|
55 | + * |
|
56 | + * This method checks if a user is logged in. If not, a json error |
|
57 | + * response will be return and the method will exit from execution |
|
58 | + * of the script. |
|
59 | + * The returned json will be in the format: |
|
60 | + * |
|
61 | + * {"status":"error","data":{"message":"Authentication error."}} |
|
62 | + * |
|
63 | + * Add this call to the start of all ajax method files that requires |
|
64 | + * an authenticated user. |
|
65 | + * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead |
|
66 | + */ |
|
67 | + public static function checkLoggedIn() { |
|
68 | + \OC_JSON::checkLoggedIn(); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Check an ajax get/post call if the request token is valid. |
|
73 | - * |
|
74 | - * This method checks for a valid variable 'requesttoken' in $_GET, |
|
75 | - * $_POST and $_SERVER. If a valid token is not found, a json error |
|
76 | - * response will be return and the method will exit from execution |
|
77 | - * of the script. |
|
78 | - * The returned json will be in the format: |
|
79 | - * |
|
80 | - * {"status":"error","data":{"message":"Token expired. Please reload page."}} |
|
81 | - * |
|
82 | - * Add this call to the start of all ajax method files that creates, |
|
83 | - * updates or deletes anything. |
|
84 | - * In cases where you e.g. use an ajax call to load a dialog containing |
|
85 | - * a submittable form, you will need to add the requesttoken first as a |
|
86 | - * parameter to the ajax call, then assign it to the template and finally |
|
87 | - * add a hidden input field also named 'requesttoken' containing the value. |
|
88 | - * @deprecated 8.1.0 Use annotation based CSRF checks from the AppFramework instead |
|
89 | - */ |
|
90 | - public static function callCheck() { |
|
91 | - \OC_JSON::callCheck(); |
|
92 | - } |
|
71 | + /** |
|
72 | + * Check an ajax get/post call if the request token is valid. |
|
73 | + * |
|
74 | + * This method checks for a valid variable 'requesttoken' in $_GET, |
|
75 | + * $_POST and $_SERVER. If a valid token is not found, a json error |
|
76 | + * response will be return and the method will exit from execution |
|
77 | + * of the script. |
|
78 | + * The returned json will be in the format: |
|
79 | + * |
|
80 | + * {"status":"error","data":{"message":"Token expired. Please reload page."}} |
|
81 | + * |
|
82 | + * Add this call to the start of all ajax method files that creates, |
|
83 | + * updates or deletes anything. |
|
84 | + * In cases where you e.g. use an ajax call to load a dialog containing |
|
85 | + * a submittable form, you will need to add the requesttoken first as a |
|
86 | + * parameter to the ajax call, then assign it to the template and finally |
|
87 | + * add a hidden input field also named 'requesttoken' containing the value. |
|
88 | + * @deprecated 8.1.0 Use annotation based CSRF checks from the AppFramework instead |
|
89 | + */ |
|
90 | + public static function callCheck() { |
|
91 | + \OC_JSON::callCheck(); |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Send json success msg |
|
96 | - * |
|
97 | - * Return a json success message with optional extra data. |
|
98 | - * @see OCP\JSON::error() for the format to use. |
|
99 | - * |
|
100 | - * @param array $data The data to use |
|
101 | - * @return string json formatted string. |
|
102 | - * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
103 | - */ |
|
104 | - public static function success( $data = array() ) { |
|
105 | - \OC_JSON::success($data); |
|
106 | - } |
|
94 | + /** |
|
95 | + * Send json success msg |
|
96 | + * |
|
97 | + * Return a json success message with optional extra data. |
|
98 | + * @see OCP\JSON::error() for the format to use. |
|
99 | + * |
|
100 | + * @param array $data The data to use |
|
101 | + * @return string json formatted string. |
|
102 | + * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
103 | + */ |
|
104 | + public static function success( $data = array() ) { |
|
105 | + \OC_JSON::success($data); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * Send json error msg |
|
110 | - * |
|
111 | - * Return a json error message with optional extra data for |
|
112 | - * error message or app specific data. |
|
113 | - * |
|
114 | - * Example use: |
|
115 | - * |
|
116 | - * $id = [some value] |
|
117 | - * OCP\JSON::error(array('data':array('message':'An error happened', 'id': $id))); |
|
118 | - * |
|
119 | - * Will return the json formatted string: |
|
120 | - * |
|
121 | - * {"status":"error","data":{"message":"An error happened", "id":[some value]}} |
|
122 | - * |
|
123 | - * @param array $data The data to use |
|
124 | - * @return string json formatted error string. |
|
125 | - * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
126 | - */ |
|
127 | - public static function error( $data = array() ) { |
|
128 | - \OC_JSON::error( $data ); |
|
129 | - } |
|
108 | + /** |
|
109 | + * Send json error msg |
|
110 | + * |
|
111 | + * Return a json error message with optional extra data for |
|
112 | + * error message or app specific data. |
|
113 | + * |
|
114 | + * Example use: |
|
115 | + * |
|
116 | + * $id = [some value] |
|
117 | + * OCP\JSON::error(array('data':array('message':'An error happened', 'id': $id))); |
|
118 | + * |
|
119 | + * Will return the json formatted string: |
|
120 | + * |
|
121 | + * {"status":"error","data":{"message":"An error happened", "id":[some value]}} |
|
122 | + * |
|
123 | + * @param array $data The data to use |
|
124 | + * @return string json formatted error string. |
|
125 | + * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
126 | + */ |
|
127 | + public static function error( $data = array() ) { |
|
128 | + \OC_JSON::error( $data ); |
|
129 | + } |
|
130 | 130 | |
131 | - /** |
|
132 | - * Set Content-Type header to jsonrequest |
|
133 | - * @param string $type The content type header |
|
134 | - * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
135 | - */ |
|
136 | - public static function setContentTypeHeader( $type='application/json' ) { |
|
137 | - \OC_JSON::setContentTypeHeader($type); |
|
138 | - } |
|
131 | + /** |
|
132 | + * Set Content-Type header to jsonrequest |
|
133 | + * @param string $type The content type header |
|
134 | + * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
135 | + */ |
|
136 | + public static function setContentTypeHeader( $type='application/json' ) { |
|
137 | + \OC_JSON::setContentTypeHeader($type); |
|
138 | + } |
|
139 | 139 | |
140 | - /** |
|
141 | - * Check if the App is enabled and send JSON error message instead |
|
142 | - * |
|
143 | - * This method checks if a specific app is enabled. If not, a json error |
|
144 | - * response will be return and the method will exit from execution |
|
145 | - * of the script. |
|
146 | - * The returned json will be in the format: |
|
147 | - * |
|
148 | - * {"status":"error","data":{"message":"Application is not enabled."}} |
|
149 | - * |
|
150 | - * Add this call to the start of all ajax method files that requires |
|
151 | - * a specific app to be enabled. |
|
152 | - * |
|
153 | - * @param string $app The app to check |
|
154 | - * @deprecated 8.1.0 Use the AppFramework instead. It will automatically check if the app is enabled. |
|
155 | - */ |
|
156 | - public static function checkAppEnabled( $app ) { |
|
157 | - \OC_JSON::checkAppEnabled($app); |
|
158 | - } |
|
140 | + /** |
|
141 | + * Check if the App is enabled and send JSON error message instead |
|
142 | + * |
|
143 | + * This method checks if a specific app is enabled. If not, a json error |
|
144 | + * response will be return and the method will exit from execution |
|
145 | + * of the script. |
|
146 | + * The returned json will be in the format: |
|
147 | + * |
|
148 | + * {"status":"error","data":{"message":"Application is not enabled."}} |
|
149 | + * |
|
150 | + * Add this call to the start of all ajax method files that requires |
|
151 | + * a specific app to be enabled. |
|
152 | + * |
|
153 | + * @param string $app The app to check |
|
154 | + * @deprecated 8.1.0 Use the AppFramework instead. It will automatically check if the app is enabled. |
|
155 | + */ |
|
156 | + public static function checkAppEnabled( $app ) { |
|
157 | + \OC_JSON::checkAppEnabled($app); |
|
158 | + } |
|
159 | 159 | |
160 | - /** |
|
161 | - * Check if the user is a admin, send json error msg if not |
|
162 | - * |
|
163 | - * This method checks if the current user has admin rights. If not, a json error |
|
164 | - * response will be return and the method will exit from execution |
|
165 | - * of the script. |
|
166 | - * The returned json will be in the format: |
|
167 | - * |
|
168 | - * {"status":"error","data":{"message":"Authentication error."}} |
|
169 | - * |
|
170 | - * Add this call to the start of all ajax method files that requires |
|
171 | - * administrative rights. |
|
172 | - * |
|
173 | - * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead |
|
174 | - */ |
|
175 | - public static function checkAdminUser() { |
|
176 | - \OC_JSON::checkAdminUser(); |
|
177 | - } |
|
160 | + /** |
|
161 | + * Check if the user is a admin, send json error msg if not |
|
162 | + * |
|
163 | + * This method checks if the current user has admin rights. If not, a json error |
|
164 | + * response will be return and the method will exit from execution |
|
165 | + * of the script. |
|
166 | + * The returned json will be in the format: |
|
167 | + * |
|
168 | + * {"status":"error","data":{"message":"Authentication error."}} |
|
169 | + * |
|
170 | + * Add this call to the start of all ajax method files that requires |
|
171 | + * administrative rights. |
|
172 | + * |
|
173 | + * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead |
|
174 | + */ |
|
175 | + public static function checkAdminUser() { |
|
176 | + \OC_JSON::checkAdminUser(); |
|
177 | + } |
|
178 | 178 | |
179 | - /** |
|
180 | - * Encode JSON |
|
181 | - * @param array $data |
|
182 | - * @return string |
|
183 | - * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
184 | - */ |
|
185 | - public static function encode($data) { |
|
186 | - return \OC_JSON::encode($data); |
|
187 | - } |
|
179 | + /** |
|
180 | + * Encode JSON |
|
181 | + * @param array $data |
|
182 | + * @return string |
|
183 | + * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
184 | + */ |
|
185 | + public static function encode($data) { |
|
186 | + return \OC_JSON::encode($data); |
|
187 | + } |
|
188 | 188 | |
189 | - /** |
|
190 | - * Check is a given user exists - send json error msg if not |
|
191 | - * @param string $user |
|
192 | - * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
193 | - */ |
|
194 | - public static function checkUserExists($user) { |
|
195 | - \OC_JSON::checkUserExists($user); |
|
196 | - } |
|
189 | + /** |
|
190 | + * Check is a given user exists - send json error msg if not |
|
191 | + * @param string $user |
|
192 | + * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
193 | + */ |
|
194 | + public static function checkUserExists($user) { |
|
195 | + \OC_JSON::checkUserExists($user); |
|
196 | + } |
|
197 | 197 | } |