@@ -74,7 +74,7 @@ |
||
| 74 | 74 | * @since 5.0.0 |
| 75 | 75 | */ |
| 76 | 76 | public static function setExecutionType($type) { |
| 77 | - if( !in_array( $type, array('none', 'ajax', 'webcron', 'cron'))) { |
|
| 77 | + if (!in_array($type, array('none', 'ajax', 'webcron', 'cron'))) { |
|
| 78 | 78 | return false; |
| 79 | 79 | } |
| 80 | 80 | \OC::$server->getConfig()->setAppValue('core', 'backgroundjobs_mode', $type); |
@@ -50,136 +50,136 @@ |
||
| 50 | 50 | * @since 4.5.0 |
| 51 | 51 | */ |
| 52 | 52 | class BackgroundJob { |
| 53 | - /** |
|
| 54 | - * get the execution type of background jobs |
|
| 55 | - * |
|
| 56 | - * @return string |
|
| 57 | - * |
|
| 58 | - * This method returns the type how background jobs are executed. If the user |
|
| 59 | - * did not select something, the type is ajax. |
|
| 60 | - * @since 5.0.0 |
|
| 61 | - */ |
|
| 62 | - public static function getExecutionType() { |
|
| 63 | - return \OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax'); |
|
| 64 | - } |
|
| 53 | + /** |
|
| 54 | + * get the execution type of background jobs |
|
| 55 | + * |
|
| 56 | + * @return string |
|
| 57 | + * |
|
| 58 | + * This method returns the type how background jobs are executed. If the user |
|
| 59 | + * did not select something, the type is ajax. |
|
| 60 | + * @since 5.0.0 |
|
| 61 | + */ |
|
| 62 | + public static function getExecutionType() { |
|
| 63 | + return \OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax'); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * sets the background jobs execution type |
|
| 68 | - * |
|
| 69 | - * @param string $type execution type |
|
| 70 | - * @return false|null |
|
| 71 | - * |
|
| 72 | - * This method sets the execution type of the background jobs. Possible types |
|
| 73 | - * are "none", "ajax", "webcron", "cron" |
|
| 74 | - * @since 5.0.0 |
|
| 75 | - */ |
|
| 76 | - public static function setExecutionType($type) { |
|
| 77 | - if( !in_array( $type, array('none', 'ajax', 'webcron', 'cron'))) { |
|
| 78 | - return false; |
|
| 79 | - } |
|
| 80 | - \OC::$server->getConfig()->setAppValue('core', 'backgroundjobs_mode', $type); |
|
| 81 | - } |
|
| 66 | + /** |
|
| 67 | + * sets the background jobs execution type |
|
| 68 | + * |
|
| 69 | + * @param string $type execution type |
|
| 70 | + * @return false|null |
|
| 71 | + * |
|
| 72 | + * This method sets the execution type of the background jobs. Possible types |
|
| 73 | + * are "none", "ajax", "webcron", "cron" |
|
| 74 | + * @since 5.0.0 |
|
| 75 | + */ |
|
| 76 | + public static function setExecutionType($type) { |
|
| 77 | + if( !in_array( $type, array('none', 'ajax', 'webcron', 'cron'))) { |
|
| 78 | + return false; |
|
| 79 | + } |
|
| 80 | + \OC::$server->getConfig()->setAppValue('core', 'backgroundjobs_mode', $type); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * @param string $job |
|
| 85 | - * @param mixed $argument |
|
| 86 | - * @deprecated 8.1.0 Use \OC::$server->getJobList()->add() instead |
|
| 87 | - * @since 6.0.0 |
|
| 88 | - */ |
|
| 89 | - public static function registerJob($job, $argument = null) { |
|
| 90 | - $jobList = \OC::$server->getJobList(); |
|
| 91 | - $jobList->add($job, $argument); |
|
| 92 | - } |
|
| 83 | + /** |
|
| 84 | + * @param string $job |
|
| 85 | + * @param mixed $argument |
|
| 86 | + * @deprecated 8.1.0 Use \OC::$server->getJobList()->add() instead |
|
| 87 | + * @since 6.0.0 |
|
| 88 | + */ |
|
| 89 | + public static function registerJob($job, $argument = null) { |
|
| 90 | + $jobList = \OC::$server->getJobList(); |
|
| 91 | + $jobList->add($job, $argument); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * @deprecated 6.0.0 |
|
| 96 | - * creates a regular task |
|
| 97 | - * @param string $klass class name |
|
| 98 | - * @param string $method method name |
|
| 99 | - * @return boolean|null |
|
| 100 | - * @since 4.5.0 |
|
| 101 | - */ |
|
| 102 | - public static function addRegularTask($klass, $method) { |
|
| 103 | - if (!\OCP\Util::needUpgrade()) { |
|
| 104 | - self::registerJob('OC\BackgroundJob\Legacy\RegularJob', array($klass, $method)); |
|
| 105 | - return true; |
|
| 106 | - } |
|
| 107 | - } |
|
| 94 | + /** |
|
| 95 | + * @deprecated 6.0.0 |
|
| 96 | + * creates a regular task |
|
| 97 | + * @param string $klass class name |
|
| 98 | + * @param string $method method name |
|
| 99 | + * @return boolean|null |
|
| 100 | + * @since 4.5.0 |
|
| 101 | + */ |
|
| 102 | + public static function addRegularTask($klass, $method) { |
|
| 103 | + if (!\OCP\Util::needUpgrade()) { |
|
| 104 | + self::registerJob('OC\BackgroundJob\Legacy\RegularJob', array($klass, $method)); |
|
| 105 | + return true; |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * @deprecated 6.0.0 |
|
| 111 | - * gets all regular tasks |
|
| 112 | - * @return array |
|
| 113 | - * |
|
| 114 | - * key is string "$klass-$method", value is array( $klass, $method ) |
|
| 115 | - * @since 4.5.0 |
|
| 116 | - */ |
|
| 117 | - static public function allRegularTasks() { |
|
| 118 | - return []; |
|
| 119 | - } |
|
| 109 | + /** |
|
| 110 | + * @deprecated 6.0.0 |
|
| 111 | + * gets all regular tasks |
|
| 112 | + * @return array |
|
| 113 | + * |
|
| 114 | + * key is string "$klass-$method", value is array( $klass, $method ) |
|
| 115 | + * @since 4.5.0 |
|
| 116 | + */ |
|
| 117 | + static public function allRegularTasks() { |
|
| 118 | + return []; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * @deprecated 6.0.0 |
|
| 123 | - * Gets one queued task |
|
| 124 | - * @param int $id ID of the task |
|
| 125 | - * @return BackgroundJob\IJob|null |
|
| 126 | - * @since 4.5.0 |
|
| 127 | - */ |
|
| 128 | - public static function findQueuedTask($id) { |
|
| 129 | - $jobList = \OC::$server->getJobList(); |
|
| 130 | - return $jobList->getById($id); |
|
| 131 | - } |
|
| 121 | + /** |
|
| 122 | + * @deprecated 6.0.0 |
|
| 123 | + * Gets one queued task |
|
| 124 | + * @param int $id ID of the task |
|
| 125 | + * @return BackgroundJob\IJob|null |
|
| 126 | + * @since 4.5.0 |
|
| 127 | + */ |
|
| 128 | + public static function findQueuedTask($id) { |
|
| 129 | + $jobList = \OC::$server->getJobList(); |
|
| 130 | + return $jobList->getById($id); |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - /** |
|
| 134 | - * @deprecated 6.0.0 |
|
| 135 | - * Gets all queued tasks |
|
| 136 | - * @return array an array of associative arrays |
|
| 137 | - * @since 4.5.0 |
|
| 138 | - */ |
|
| 139 | - public static function allQueuedTasks() { |
|
| 140 | - return []; |
|
| 141 | - } |
|
| 133 | + /** |
|
| 134 | + * @deprecated 6.0.0 |
|
| 135 | + * Gets all queued tasks |
|
| 136 | + * @return array an array of associative arrays |
|
| 137 | + * @since 4.5.0 |
|
| 138 | + */ |
|
| 139 | + public static function allQueuedTasks() { |
|
| 140 | + return []; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - /** |
|
| 144 | - * @deprecated 6.0.0 |
|
| 145 | - * Gets all queued tasks of a specific app |
|
| 146 | - * @param string $app app name |
|
| 147 | - * @return array an array of associative arrays |
|
| 148 | - * @since 4.5.0 |
|
| 149 | - */ |
|
| 150 | - public static function queuedTaskWhereAppIs($app) { |
|
| 151 | - return []; |
|
| 152 | - } |
|
| 143 | + /** |
|
| 144 | + * @deprecated 6.0.0 |
|
| 145 | + * Gets all queued tasks of a specific app |
|
| 146 | + * @param string $app app name |
|
| 147 | + * @return array an array of associative arrays |
|
| 148 | + * @since 4.5.0 |
|
| 149 | + */ |
|
| 150 | + public static function queuedTaskWhereAppIs($app) { |
|
| 151 | + return []; |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * @deprecated 6.0.0 |
|
| 156 | - * queues a task |
|
| 157 | - * @param string $app app name |
|
| 158 | - * @param string $class class name |
|
| 159 | - * @param string $method method name |
|
| 160 | - * @param string $parameters all useful data as text |
|
| 161 | - * @return boolean id of task |
|
| 162 | - * @since 4.5.0 |
|
| 163 | - */ |
|
| 164 | - public static function addQueuedTask($app, $class, $method, $parameters) { |
|
| 165 | - self::registerJob('OC\BackgroundJob\Legacy\QueuedJob', array('app' => $app, 'klass' => $class, 'method' => $method, 'parameters' => $parameters)); |
|
| 166 | - return true; |
|
| 167 | - } |
|
| 154 | + /** |
|
| 155 | + * @deprecated 6.0.0 |
|
| 156 | + * queues a task |
|
| 157 | + * @param string $app app name |
|
| 158 | + * @param string $class class name |
|
| 159 | + * @param string $method method name |
|
| 160 | + * @param string $parameters all useful data as text |
|
| 161 | + * @return boolean id of task |
|
| 162 | + * @since 4.5.0 |
|
| 163 | + */ |
|
| 164 | + public static function addQueuedTask($app, $class, $method, $parameters) { |
|
| 165 | + self::registerJob('OC\BackgroundJob\Legacy\QueuedJob', array('app' => $app, 'klass' => $class, 'method' => $method, 'parameters' => $parameters)); |
|
| 166 | + return true; |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - /** |
|
| 170 | - * @deprecated 6.0.0 |
|
| 171 | - * deletes a queued task |
|
| 172 | - * @param int $id id of task |
|
| 173 | - * @return boolean|null |
|
| 174 | - * |
|
| 175 | - * Deletes a report |
|
| 176 | - * @since 4.5.0 |
|
| 177 | - */ |
|
| 178 | - public static function deleteQueuedTask($id) { |
|
| 179 | - $jobList = \OC::$server->getJobList(); |
|
| 180 | - $job = $jobList->getById($id); |
|
| 181 | - if ($job) { |
|
| 182 | - $jobList->remove($job); |
|
| 183 | - } |
|
| 184 | - } |
|
| 169 | + /** |
|
| 170 | + * @deprecated 6.0.0 |
|
| 171 | + * deletes a queued task |
|
| 172 | + * @param int $id id of task |
|
| 173 | + * @return boolean|null |
|
| 174 | + * |
|
| 175 | + * Deletes a report |
|
| 176 | + * @since 4.5.0 |
|
| 177 | + */ |
|
| 178 | + public static function deleteQueuedTask($id) { |
|
| 179 | + $jobList = \OC::$server->getJobList(); |
|
| 180 | + $job = $jobList->getById($id); |
|
| 181 | + if ($job) { |
|
| 182 | + $jobList->remove($job); |
|
| 183 | + } |
|
| 184 | + } |
|
| 185 | 185 | } |
@@ -30,116 +30,116 @@ |
||
| 30 | 30 | * @since 8.0.0 |
| 31 | 31 | */ |
| 32 | 32 | interface IDateTimeFormatter { |
| 33 | - /** |
|
| 34 | - * Formats the date of the given timestamp |
|
| 35 | - * |
|
| 36 | - * @param int|\DateTime $timestamp |
|
| 37 | - * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
| 38 | - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
| 39 | - * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
| 40 | - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
| 41 | - * short: e.g. 'M/d/yy' => '8/20/14' |
|
| 42 | - * The exact format is dependent on the language |
|
| 43 | - * @param \DateTimeZone $timeZone The timezone to use |
|
| 44 | - * @param \OCP\IL10N $l The locale to use |
|
| 45 | - * @return string Formatted date string |
|
| 46 | - * @since 8.0.0 |
|
| 47 | - */ |
|
| 48 | - public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 33 | + /** |
|
| 34 | + * Formats the date of the given timestamp |
|
| 35 | + * |
|
| 36 | + * @param int|\DateTime $timestamp |
|
| 37 | + * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
| 38 | + * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
| 39 | + * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
| 40 | + * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
| 41 | + * short: e.g. 'M/d/yy' => '8/20/14' |
|
| 42 | + * The exact format is dependent on the language |
|
| 43 | + * @param \DateTimeZone $timeZone The timezone to use |
|
| 44 | + * @param \OCP\IL10N $l The locale to use |
|
| 45 | + * @return string Formatted date string |
|
| 46 | + * @since 8.0.0 |
|
| 47 | + */ |
|
| 48 | + public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Formats the date of the given timestamp |
|
| 52 | - * |
|
| 53 | - * @param int|\DateTime $timestamp |
|
| 54 | - * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
| 55 | - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
| 56 | - * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
| 57 | - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
| 58 | - * short: e.g. 'M/d/yy' => '8/20/14' |
|
| 59 | - * The exact format is dependent on the language |
|
| 60 | - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
| 61 | - * @param \DateTimeZone $timeZone The timezone to use |
|
| 62 | - * @param \OCP\IL10N $l The locale to use |
|
| 63 | - * @return string Formatted relative date string |
|
| 64 | - * @since 8.0.0 |
|
| 65 | - */ |
|
| 66 | - public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 50 | + /** |
|
| 51 | + * Formats the date of the given timestamp |
|
| 52 | + * |
|
| 53 | + * @param int|\DateTime $timestamp |
|
| 54 | + * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
| 55 | + * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' |
|
| 56 | + * long: e.g. 'MMMM d, y' => 'August 20, 2014' |
|
| 57 | + * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' |
|
| 58 | + * short: e.g. 'M/d/yy' => '8/20/14' |
|
| 59 | + * The exact format is dependent on the language |
|
| 60 | + * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
| 61 | + * @param \DateTimeZone $timeZone The timezone to use |
|
| 62 | + * @param \OCP\IL10N $l The locale to use |
|
| 63 | + * @return string Formatted relative date string |
|
| 64 | + * @since 8.0.0 |
|
| 65 | + */ |
|
| 66 | + public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Gives the relative date of the timestamp |
|
| 70 | - * Only works for past dates |
|
| 71 | - * |
|
| 72 | - * @param int|\DateTime $timestamp |
|
| 73 | - * @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
| 74 | - * @return string Dates returned are: |
|
| 75 | - * < 1 month => Today, Yesterday, n days ago |
|
| 76 | - * < 13 month => last month, n months ago |
|
| 77 | - * >= 13 month => last year, n years ago |
|
| 78 | - * @param \OCP\IL10N $l The locale to use |
|
| 79 | - * @return string Formatted date span |
|
| 80 | - * @since 8.0.0 |
|
| 81 | - */ |
|
| 82 | - public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
| 68 | + /** |
|
| 69 | + * Gives the relative date of the timestamp |
|
| 70 | + * Only works for past dates |
|
| 71 | + * |
|
| 72 | + * @param int|\DateTime $timestamp |
|
| 73 | + * @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
| 74 | + * @return string Dates returned are: |
|
| 75 | + * < 1 month => Today, Yesterday, n days ago |
|
| 76 | + * < 13 month => last month, n months ago |
|
| 77 | + * >= 13 month => last year, n years ago |
|
| 78 | + * @param \OCP\IL10N $l The locale to use |
|
| 79 | + * @return string Formatted date span |
|
| 80 | + * @since 8.0.0 |
|
| 81 | + */ |
|
| 82 | + public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * Formats the time of the given timestamp |
|
| 86 | - * |
|
| 87 | - * @param int|\DateTime $timestamp |
|
| 88 | - * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
| 89 | - * full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00' |
|
| 90 | - * long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT' |
|
| 91 | - * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' |
|
| 92 | - * short: e.g. 'h:mm a' => '11:42 AM' |
|
| 93 | - * The exact format is dependent on the language |
|
| 94 | - * @param \DateTimeZone $timeZone The timezone to use |
|
| 95 | - * @param \OCP\IL10N $l The locale to use |
|
| 96 | - * @return string Formatted time string |
|
| 97 | - * @since 8.0.0 |
|
| 98 | - */ |
|
| 99 | - public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 84 | + /** |
|
| 85 | + * Formats the time of the given timestamp |
|
| 86 | + * |
|
| 87 | + * @param int|\DateTime $timestamp |
|
| 88 | + * @param string $format Either 'full', 'long', 'medium' or 'short' |
|
| 89 | + * full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00' |
|
| 90 | + * long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT' |
|
| 91 | + * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' |
|
| 92 | + * short: e.g. 'h:mm a' => '11:42 AM' |
|
| 93 | + * The exact format is dependent on the language |
|
| 94 | + * @param \DateTimeZone $timeZone The timezone to use |
|
| 95 | + * @param \OCP\IL10N $l The locale to use |
|
| 96 | + * @return string Formatted time string |
|
| 97 | + * @since 8.0.0 |
|
| 98 | + */ |
|
| 99 | + public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 100 | 100 | |
| 101 | - /** |
|
| 102 | - * Gives the relative past time of the timestamp |
|
| 103 | - * |
|
| 104 | - * @param int|\DateTime $timestamp |
|
| 105 | - * @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
| 106 | - * @return string Dates returned are: |
|
| 107 | - * < 60 sec => seconds ago |
|
| 108 | - * < 1 hour => n minutes ago |
|
| 109 | - * < 1 day => n hours ago |
|
| 110 | - * < 1 month => Yesterday, n days ago |
|
| 111 | - * < 13 month => last month, n months ago |
|
| 112 | - * >= 13 month => last year, n years ago |
|
| 113 | - * @param \OCP\IL10N $l The locale to use |
|
| 114 | - * @return string Formatted time span |
|
| 115 | - * @since 8.0.0 |
|
| 116 | - */ |
|
| 117 | - public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
| 101 | + /** |
|
| 102 | + * Gives the relative past time of the timestamp |
|
| 103 | + * |
|
| 104 | + * @param int|\DateTime $timestamp |
|
| 105 | + * @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time |
|
| 106 | + * @return string Dates returned are: |
|
| 107 | + * < 60 sec => seconds ago |
|
| 108 | + * < 1 hour => n minutes ago |
|
| 109 | + * < 1 day => n hours ago |
|
| 110 | + * < 1 month => Yesterday, n days ago |
|
| 111 | + * < 13 month => last month, n months ago |
|
| 112 | + * >= 13 month => last year, n years ago |
|
| 113 | + * @param \OCP\IL10N $l The locale to use |
|
| 114 | + * @return string Formatted time span |
|
| 115 | + * @since 8.0.0 |
|
| 116 | + */ |
|
| 117 | + public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null); |
|
| 118 | 118 | |
| 119 | - /** |
|
| 120 | - * Formats the date and time of the given timestamp |
|
| 121 | - * |
|
| 122 | - * @param int|\DateTime $timestamp |
|
| 123 | - * @param string $formatDate See formatDate() for description |
|
| 124 | - * @param string $formatTime See formatTime() for description |
|
| 125 | - * @param \DateTimeZone $timeZone The timezone to use |
|
| 126 | - * @param \OCP\IL10N $l The locale to use |
|
| 127 | - * @return string Formatted date and time string |
|
| 128 | - * @since 8.0.0 |
|
| 129 | - */ |
|
| 130 | - public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 119 | + /** |
|
| 120 | + * Formats the date and time of the given timestamp |
|
| 121 | + * |
|
| 122 | + * @param int|\DateTime $timestamp |
|
| 123 | + * @param string $formatDate See formatDate() for description |
|
| 124 | + * @param string $formatTime See formatTime() for description |
|
| 125 | + * @param \DateTimeZone $timeZone The timezone to use |
|
| 126 | + * @param \OCP\IL10N $l The locale to use |
|
| 127 | + * @return string Formatted date and time string |
|
| 128 | + * @since 8.0.0 |
|
| 129 | + */ |
|
| 130 | + public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * Formats the date and time of the given timestamp |
|
| 134 | - * |
|
| 135 | - * @param int|\DateTime $timestamp |
|
| 136 | - * @param string $formatDate See formatDate() for description |
|
| 137 | - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
| 138 | - * @param string $formatTime See formatTime() for description |
|
| 139 | - * @param \DateTimeZone $timeZone The timezone to use |
|
| 140 | - * @param \OCP\IL10N $l The locale to use |
|
| 141 | - * @return string Formatted relative date and time string |
|
| 142 | - * @since 8.0.0 |
|
| 143 | - */ |
|
| 144 | - public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 132 | + /** |
|
| 133 | + * Formats the date and time of the given timestamp |
|
| 134 | + * |
|
| 135 | + * @param int|\DateTime $timestamp |
|
| 136 | + * @param string $formatDate See formatDate() for description |
|
| 137 | + * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable |
|
| 138 | + * @param string $formatTime See formatTime() for description |
|
| 139 | + * @param \DateTimeZone $timeZone The timezone to use |
|
| 140 | + * @param \OCP\IL10N $l The locale to use |
|
| 141 | + * @return string Formatted relative date and time string |
|
| 142 | + * @since 8.0.0 |
|
| 143 | + */ |
|
| 144 | + public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null); |
|
| 145 | 145 | } |
@@ -40,68 +40,68 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | interface UserInterface { |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Check if backend implements actions |
|
| 45 | - * @param int $actions bitwise-or'ed actions |
|
| 46 | - * @return boolean |
|
| 47 | - * |
|
| 48 | - * Returns the supported actions as int to be |
|
| 49 | - * compared with \OC_User_Backend::CREATE_USER etc. |
|
| 50 | - * @since 4.5.0 |
|
| 51 | - */ |
|
| 52 | - public function implementsActions($actions); |
|
| 43 | + /** |
|
| 44 | + * Check if backend implements actions |
|
| 45 | + * @param int $actions bitwise-or'ed actions |
|
| 46 | + * @return boolean |
|
| 47 | + * |
|
| 48 | + * Returns the supported actions as int to be |
|
| 49 | + * compared with \OC_User_Backend::CREATE_USER etc. |
|
| 50 | + * @since 4.5.0 |
|
| 51 | + */ |
|
| 52 | + public function implementsActions($actions); |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * delete a user |
|
| 56 | - * @param string $uid The username of the user to delete |
|
| 57 | - * @return bool |
|
| 58 | - * @since 4.5.0 |
|
| 59 | - */ |
|
| 60 | - public function deleteUser($uid); |
|
| 54 | + /** |
|
| 55 | + * delete a user |
|
| 56 | + * @param string $uid The username of the user to delete |
|
| 57 | + * @return bool |
|
| 58 | + * @since 4.5.0 |
|
| 59 | + */ |
|
| 60 | + public function deleteUser($uid); |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Get a list of all users |
|
| 64 | - * |
|
| 65 | - * @param string $search |
|
| 66 | - * @param null|int $limit |
|
| 67 | - * @param null|int $offset |
|
| 68 | - * @return string[] an array of all uids |
|
| 69 | - * @since 4.5.0 |
|
| 70 | - */ |
|
| 71 | - public function getUsers($search = '', $limit = null, $offset = null); |
|
| 62 | + /** |
|
| 63 | + * Get a list of all users |
|
| 64 | + * |
|
| 65 | + * @param string $search |
|
| 66 | + * @param null|int $limit |
|
| 67 | + * @param null|int $offset |
|
| 68 | + * @return string[] an array of all uids |
|
| 69 | + * @since 4.5.0 |
|
| 70 | + */ |
|
| 71 | + public function getUsers($search = '', $limit = null, $offset = null); |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * check if a user exists |
|
| 75 | - * @param string $uid the username |
|
| 76 | - * @return boolean |
|
| 77 | - * @since 4.5.0 |
|
| 78 | - */ |
|
| 79 | - public function userExists($uid); |
|
| 73 | + /** |
|
| 74 | + * check if a user exists |
|
| 75 | + * @param string $uid the username |
|
| 76 | + * @return boolean |
|
| 77 | + * @since 4.5.0 |
|
| 78 | + */ |
|
| 79 | + public function userExists($uid); |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * get display name of the user |
|
| 83 | - * @param string $uid user ID of the user |
|
| 84 | - * @return string display name |
|
| 85 | - * @since 4.5.0 |
|
| 86 | - */ |
|
| 87 | - public function getDisplayName($uid); |
|
| 81 | + /** |
|
| 82 | + * get display name of the user |
|
| 83 | + * @param string $uid user ID of the user |
|
| 84 | + * @return string display name |
|
| 85 | + * @since 4.5.0 |
|
| 86 | + */ |
|
| 87 | + public function getDisplayName($uid); |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * Get a list of all display names and user ids. |
|
| 91 | - * |
|
| 92 | - * @param string $search |
|
| 93 | - * @param string|null $limit |
|
| 94 | - * @param string|null $offset |
|
| 95 | - * @return array an array of all displayNames (value) and the corresponding uids (key) |
|
| 96 | - * @since 4.5.0 |
|
| 97 | - */ |
|
| 98 | - public function getDisplayNames($search = '', $limit = null, $offset = null); |
|
| 89 | + /** |
|
| 90 | + * Get a list of all display names and user ids. |
|
| 91 | + * |
|
| 92 | + * @param string $search |
|
| 93 | + * @param string|null $limit |
|
| 94 | + * @param string|null $offset |
|
| 95 | + * @return array an array of all displayNames (value) and the corresponding uids (key) |
|
| 96 | + * @since 4.5.0 |
|
| 97 | + */ |
|
| 98 | + public function getDisplayNames($search = '', $limit = null, $offset = null); |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Check if a user list is available or not |
|
| 102 | - * @return boolean if users can be listed or not |
|
| 103 | - * @since 4.5.0 |
|
| 104 | - */ |
|
| 105 | - public function hasUserListings(); |
|
| 100 | + /** |
|
| 101 | + * Check if a user list is available or not |
|
| 102 | + * @return boolean if users can be listed or not |
|
| 103 | + * @since 4.5.0 |
|
| 104 | + */ |
|
| 105 | + public function hasUserListings(); |
|
| 106 | 106 | |
| 107 | 107 | } |
@@ -35,151 +35,151 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | interface IEncryptionModule { |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @return string defining the technical unique id |
|
| 40 | - * @since 8.1.0 |
|
| 41 | - */ |
|
| 42 | - public function getId(); |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * In comparison to getKey() this function returns a human readable (maybe translated) name |
|
| 46 | - * |
|
| 47 | - * @return string |
|
| 48 | - * @since 8.1.0 |
|
| 49 | - */ |
|
| 50 | - public function getDisplayName(); |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * start receiving chunks from a file. This is the place where you can |
|
| 54 | - * perform some initial step before starting encrypting/decrypting the |
|
| 55 | - * chunks |
|
| 56 | - * |
|
| 57 | - * @param string $path to the file |
|
| 58 | - * @param string $user who read/write the file (null for public access) |
|
| 59 | - * @param string $mode php stream open mode |
|
| 60 | - * @param array $header contains the header data read from the file |
|
| 61 | - * @param array $accessList who has access to the file contains the key 'users' and 'public' |
|
| 62 | - * |
|
| 63 | - * $return array $header contain data as key-value pairs which should be |
|
| 64 | - * written to the header, in case of a write operation |
|
| 65 | - * or if no additional data is needed return a empty array |
|
| 66 | - * @since 8.1.0 |
|
| 67 | - */ |
|
| 68 | - public function begin($path, $user, $mode, array $header, array $accessList); |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * last chunk received. This is the place where you can perform some final |
|
| 72 | - * operation and return some remaining data if something is left in your |
|
| 73 | - * buffer. |
|
| 74 | - * |
|
| 75 | - * @param string $path to the file |
|
| 76 | - * @param string $position id of the last block (looks like "<Number>end") |
|
| 77 | - * |
|
| 78 | - * @return string remained data which should be written to the file in case |
|
| 79 | - * of a write operation |
|
| 80 | - * |
|
| 81 | - * @since 8.1.0 |
|
| 82 | - * @since 9.0.0 parameter $position added |
|
| 83 | - */ |
|
| 84 | - public function end($path, $position); |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * encrypt data |
|
| 88 | - * |
|
| 89 | - * @param string $data you want to encrypt |
|
| 90 | - * @param string $position position of the block we want to encrypt (starts with '0') |
|
| 91 | - * |
|
| 92 | - * @return mixed encrypted data |
|
| 93 | - * |
|
| 94 | - * @since 8.1.0 |
|
| 95 | - * @since 9.0.0 parameter $position added |
|
| 96 | - */ |
|
| 97 | - public function encrypt($data, $position); |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * decrypt data |
|
| 101 | - * |
|
| 102 | - * @param string $data you want to decrypt |
|
| 103 | - * @param string $position position of the block we want to decrypt |
|
| 104 | - * |
|
| 105 | - * @return mixed decrypted data |
|
| 106 | - * |
|
| 107 | - * @since 8.1.0 |
|
| 108 | - * @since 9.0.0 parameter $position added |
|
| 109 | - */ |
|
| 110 | - public function decrypt($data, $position); |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * update encrypted file, e.g. give additional users access to the file |
|
| 114 | - * |
|
| 115 | - * @param string $path path to the file which should be updated |
|
| 116 | - * @param string $uid of the user who performs the operation |
|
| 117 | - * @param array $accessList who has access to the file contains the key 'users' and 'public' |
|
| 118 | - * @return boolean |
|
| 119 | - * @since 8.1.0 |
|
| 120 | - */ |
|
| 121 | - public function update($path, $uid, array $accessList); |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * should the file be encrypted or not |
|
| 125 | - * |
|
| 126 | - * @param string $path |
|
| 127 | - * @return boolean |
|
| 128 | - * @since 8.1.0 |
|
| 129 | - */ |
|
| 130 | - public function shouldEncrypt($path); |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * get size of the unencrypted payload per block. |
|
| 134 | - * ownCloud read/write files with a block size of 8192 byte |
|
| 135 | - * |
|
| 136 | - * @param bool $signed |
|
| 137 | - * @return int |
|
| 138 | - * @since 8.1.0 optional parameter $signed was added in 9.0.0 |
|
| 139 | - */ |
|
| 140 | - public function getUnencryptedBlockSize($signed = false); |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * check if the encryption module is able to read the file, |
|
| 144 | - * e.g. if all encryption keys exists |
|
| 145 | - * |
|
| 146 | - * @param string $path |
|
| 147 | - * @param string $uid user for whom we want to check if he can read the file |
|
| 148 | - * @return boolean |
|
| 149 | - * @since 8.1.0 |
|
| 150 | - */ |
|
| 151 | - public function isReadable($path, $uid); |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Initial encryption of all files |
|
| 155 | - * |
|
| 156 | - * @param InputInterface $input |
|
| 157 | - * @param OutputInterface $output write some status information to the terminal during encryption |
|
| 158 | - * @since 8.2.0 |
|
| 159 | - */ |
|
| 160 | - public function encryptAll(InputInterface $input, OutputInterface $output); |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * prepare encryption module to decrypt all files |
|
| 164 | - * |
|
| 165 | - * @param InputInterface $input |
|
| 166 | - * @param OutputInterface $output write some status information to the terminal during encryption |
|
| 167 | - * @param $user (optional) for which the files should be decrypted, default = all users |
|
| 168 | - * @return bool return false on failure or if it isn't supported by the module |
|
| 169 | - * @since 8.2.0 |
|
| 170 | - */ |
|
| 171 | - public function prepareDecryptAll(InputInterface $input, OutputInterface $output, $user = ''); |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * Check if the module is ready to be used by that specific user. |
|
| 175 | - * In case a module is not ready - because e.g. key pairs have not been generated |
|
| 176 | - * upon login this method can return false before any operation starts and might |
|
| 177 | - * cause issues during operations. |
|
| 178 | - * |
|
| 179 | - * @param string $user |
|
| 180 | - * @return boolean |
|
| 181 | - * @since 9.1.0 |
|
| 182 | - */ |
|
| 183 | - public function isReadyForUser($user); |
|
| 38 | + /** |
|
| 39 | + * @return string defining the technical unique id |
|
| 40 | + * @since 8.1.0 |
|
| 41 | + */ |
|
| 42 | + public function getId(); |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * In comparison to getKey() this function returns a human readable (maybe translated) name |
|
| 46 | + * |
|
| 47 | + * @return string |
|
| 48 | + * @since 8.1.0 |
|
| 49 | + */ |
|
| 50 | + public function getDisplayName(); |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * start receiving chunks from a file. This is the place where you can |
|
| 54 | + * perform some initial step before starting encrypting/decrypting the |
|
| 55 | + * chunks |
|
| 56 | + * |
|
| 57 | + * @param string $path to the file |
|
| 58 | + * @param string $user who read/write the file (null for public access) |
|
| 59 | + * @param string $mode php stream open mode |
|
| 60 | + * @param array $header contains the header data read from the file |
|
| 61 | + * @param array $accessList who has access to the file contains the key 'users' and 'public' |
|
| 62 | + * |
|
| 63 | + * $return array $header contain data as key-value pairs which should be |
|
| 64 | + * written to the header, in case of a write operation |
|
| 65 | + * or if no additional data is needed return a empty array |
|
| 66 | + * @since 8.1.0 |
|
| 67 | + */ |
|
| 68 | + public function begin($path, $user, $mode, array $header, array $accessList); |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * last chunk received. This is the place where you can perform some final |
|
| 72 | + * operation and return some remaining data if something is left in your |
|
| 73 | + * buffer. |
|
| 74 | + * |
|
| 75 | + * @param string $path to the file |
|
| 76 | + * @param string $position id of the last block (looks like "<Number>end") |
|
| 77 | + * |
|
| 78 | + * @return string remained data which should be written to the file in case |
|
| 79 | + * of a write operation |
|
| 80 | + * |
|
| 81 | + * @since 8.1.0 |
|
| 82 | + * @since 9.0.0 parameter $position added |
|
| 83 | + */ |
|
| 84 | + public function end($path, $position); |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * encrypt data |
|
| 88 | + * |
|
| 89 | + * @param string $data you want to encrypt |
|
| 90 | + * @param string $position position of the block we want to encrypt (starts with '0') |
|
| 91 | + * |
|
| 92 | + * @return mixed encrypted data |
|
| 93 | + * |
|
| 94 | + * @since 8.1.0 |
|
| 95 | + * @since 9.0.0 parameter $position added |
|
| 96 | + */ |
|
| 97 | + public function encrypt($data, $position); |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * decrypt data |
|
| 101 | + * |
|
| 102 | + * @param string $data you want to decrypt |
|
| 103 | + * @param string $position position of the block we want to decrypt |
|
| 104 | + * |
|
| 105 | + * @return mixed decrypted data |
|
| 106 | + * |
|
| 107 | + * @since 8.1.0 |
|
| 108 | + * @since 9.0.0 parameter $position added |
|
| 109 | + */ |
|
| 110 | + public function decrypt($data, $position); |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * update encrypted file, e.g. give additional users access to the file |
|
| 114 | + * |
|
| 115 | + * @param string $path path to the file which should be updated |
|
| 116 | + * @param string $uid of the user who performs the operation |
|
| 117 | + * @param array $accessList who has access to the file contains the key 'users' and 'public' |
|
| 118 | + * @return boolean |
|
| 119 | + * @since 8.1.0 |
|
| 120 | + */ |
|
| 121 | + public function update($path, $uid, array $accessList); |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * should the file be encrypted or not |
|
| 125 | + * |
|
| 126 | + * @param string $path |
|
| 127 | + * @return boolean |
|
| 128 | + * @since 8.1.0 |
|
| 129 | + */ |
|
| 130 | + public function shouldEncrypt($path); |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * get size of the unencrypted payload per block. |
|
| 134 | + * ownCloud read/write files with a block size of 8192 byte |
|
| 135 | + * |
|
| 136 | + * @param bool $signed |
|
| 137 | + * @return int |
|
| 138 | + * @since 8.1.0 optional parameter $signed was added in 9.0.0 |
|
| 139 | + */ |
|
| 140 | + public function getUnencryptedBlockSize($signed = false); |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * check if the encryption module is able to read the file, |
|
| 144 | + * e.g. if all encryption keys exists |
|
| 145 | + * |
|
| 146 | + * @param string $path |
|
| 147 | + * @param string $uid user for whom we want to check if he can read the file |
|
| 148 | + * @return boolean |
|
| 149 | + * @since 8.1.0 |
|
| 150 | + */ |
|
| 151 | + public function isReadable($path, $uid); |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Initial encryption of all files |
|
| 155 | + * |
|
| 156 | + * @param InputInterface $input |
|
| 157 | + * @param OutputInterface $output write some status information to the terminal during encryption |
|
| 158 | + * @since 8.2.0 |
|
| 159 | + */ |
|
| 160 | + public function encryptAll(InputInterface $input, OutputInterface $output); |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * prepare encryption module to decrypt all files |
|
| 164 | + * |
|
| 165 | + * @param InputInterface $input |
|
| 166 | + * @param OutputInterface $output write some status information to the terminal during encryption |
|
| 167 | + * @param $user (optional) for which the files should be decrypted, default = all users |
|
| 168 | + * @return bool return false on failure or if it isn't supported by the module |
|
| 169 | + * @since 8.2.0 |
|
| 170 | + */ |
|
| 171 | + public function prepareDecryptAll(InputInterface $input, OutputInterface $output, $user = ''); |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * Check if the module is ready to be used by that specific user. |
|
| 175 | + * In case a module is not ready - because e.g. key pairs have not been generated |
|
| 176 | + * upon login this method can return false before any operation starts and might |
|
| 177 | + * cause issues during operations. |
|
| 178 | + * |
|
| 179 | + * @param string $user |
|
| 180 | + * @return boolean |
|
| 181 | + * @since 9.1.0 |
|
| 182 | + */ |
|
| 183 | + public function isReadyForUser($user); |
|
| 184 | 184 | |
| 185 | 185 | } |
@@ -32,13 +32,13 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | interface IFile { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * get list of users with access to the file |
|
| 37 | - * |
|
| 38 | - * @param string $path to the file |
|
| 39 | - * @return array |
|
| 40 | - * @since 8.1.0 |
|
| 41 | - */ |
|
| 42 | - public function getAccessList($path); |
|
| 35 | + /** |
|
| 36 | + * get list of users with access to the file |
|
| 37 | + * |
|
| 38 | + * @param string $path to the file |
|
| 39 | + * @return array |
|
| 40 | + * @since 8.1.0 |
|
| 41 | + */ |
|
| 42 | + public function getAccessList($path); |
|
| 43 | 43 | |
| 44 | 44 | } |
@@ -35,18 +35,18 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | class GenericEncryptionException extends HintException { |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @param string $message |
|
| 40 | - * @param string $hint |
|
| 41 | - * @param int $code |
|
| 42 | - * @param \Exception $previous |
|
| 43 | - * @since 8.1.0 |
|
| 44 | - */ |
|
| 45 | - public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) { |
|
| 46 | - if (empty($message)) { |
|
| 47 | - $message = 'Unspecified encryption exception'; |
|
| 48 | - } |
|
| 49 | - parent::__construct($message, $hint, $code, $previous); |
|
| 50 | - } |
|
| 38 | + /** |
|
| 39 | + * @param string $message |
|
| 40 | + * @param string $hint |
|
| 41 | + * @param int $code |
|
| 42 | + * @param \Exception $previous |
|
| 43 | + * @since 8.1.0 |
|
| 44 | + */ |
|
| 45 | + public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) { |
|
| 46 | + if (empty($message)) { |
|
| 47 | + $message = 'Unspecified encryption exception'; |
|
| 48 | + } |
|
| 49 | + parent::__construct($message, $hint, $code, $previous); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | 52 | } |
@@ -34,67 +34,67 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | interface IManager { |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Check if encryption is available (at least one encryption module needs to be enabled) |
|
| 39 | - * |
|
| 40 | - * @return bool true if enabled, false if not |
|
| 41 | - * @since 8.1.0 |
|
| 42 | - */ |
|
| 43 | - public function isEnabled(); |
|
| 37 | + /** |
|
| 38 | + * Check if encryption is available (at least one encryption module needs to be enabled) |
|
| 39 | + * |
|
| 40 | + * @return bool true if enabled, false if not |
|
| 41 | + * @since 8.1.0 |
|
| 42 | + */ |
|
| 43 | + public function isEnabled(); |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Registers an callback function which must return an encryption module instance |
|
| 47 | - * |
|
| 48 | - * @param string $id |
|
| 49 | - * @param string $displayName |
|
| 50 | - * @param callable $callback |
|
| 51 | - * @throws ModuleAlreadyExistsException |
|
| 52 | - * @since 8.1.0 |
|
| 53 | - */ |
|
| 54 | - public function registerEncryptionModule($id, $displayName, callable $callback); |
|
| 45 | + /** |
|
| 46 | + * Registers an callback function which must return an encryption module instance |
|
| 47 | + * |
|
| 48 | + * @param string $id |
|
| 49 | + * @param string $displayName |
|
| 50 | + * @param callable $callback |
|
| 51 | + * @throws ModuleAlreadyExistsException |
|
| 52 | + * @since 8.1.0 |
|
| 53 | + */ |
|
| 54 | + public function registerEncryptionModule($id, $displayName, callable $callback); |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Unregisters an encryption module |
|
| 58 | - * |
|
| 59 | - * @param string $moduleId |
|
| 60 | - * @since 8.1.0 |
|
| 61 | - */ |
|
| 62 | - public function unregisterEncryptionModule($moduleId); |
|
| 56 | + /** |
|
| 57 | + * Unregisters an encryption module |
|
| 58 | + * |
|
| 59 | + * @param string $moduleId |
|
| 60 | + * @since 8.1.0 |
|
| 61 | + */ |
|
| 62 | + public function unregisterEncryptionModule($moduleId); |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * get a list of all encryption modules |
|
| 66 | - * |
|
| 67 | - * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]] |
|
| 68 | - * @since 8.1.0 |
|
| 69 | - */ |
|
| 70 | - public function getEncryptionModules(); |
|
| 64 | + /** |
|
| 65 | + * get a list of all encryption modules |
|
| 66 | + * |
|
| 67 | + * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]] |
|
| 68 | + * @since 8.1.0 |
|
| 69 | + */ |
|
| 70 | + public function getEncryptionModules(); |
|
| 71 | 71 | |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * get a specific encryption module |
|
| 75 | - * |
|
| 76 | - * @param string $moduleId Empty to get the default module |
|
| 77 | - * @return IEncryptionModule |
|
| 78 | - * @throws ModuleDoesNotExistsException |
|
| 79 | - * @since 8.1.0 |
|
| 80 | - */ |
|
| 81 | - public function getEncryptionModule($moduleId = ''); |
|
| 73 | + /** |
|
| 74 | + * get a specific encryption module |
|
| 75 | + * |
|
| 76 | + * @param string $moduleId Empty to get the default module |
|
| 77 | + * @return IEncryptionModule |
|
| 78 | + * @throws ModuleDoesNotExistsException |
|
| 79 | + * @since 8.1.0 |
|
| 80 | + */ |
|
| 81 | + public function getEncryptionModule($moduleId = ''); |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * get default encryption module Id |
|
| 85 | - * |
|
| 86 | - * @return string |
|
| 87 | - * @since 8.1.0 |
|
| 88 | - */ |
|
| 89 | - public function getDefaultEncryptionModuleId(); |
|
| 83 | + /** |
|
| 84 | + * get default encryption module Id |
|
| 85 | + * |
|
| 86 | + * @return string |
|
| 87 | + * @since 8.1.0 |
|
| 88 | + */ |
|
| 89 | + public function getDefaultEncryptionModuleId(); |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * set default encryption module Id |
|
| 93 | - * |
|
| 94 | - * @param string $moduleId |
|
| 95 | - * @return string |
|
| 96 | - * @since 8.1.0 |
|
| 97 | - */ |
|
| 98 | - public function setDefaultEncryptionModule($moduleId); |
|
| 91 | + /** |
|
| 92 | + * set default encryption module Id |
|
| 93 | + * |
|
| 94 | + * @param string $moduleId |
|
| 95 | + * @return string |
|
| 96 | + * @since 8.1.0 |
|
| 97 | + */ |
|
| 98 | + public function setDefaultEncryptionModule($moduleId); |
|
| 99 | 99 | |
| 100 | 100 | } |
@@ -45,96 +45,96 @@ |
||
| 45 | 45 | * @since 8.0.0 |
| 46 | 46 | */ |
| 47 | 47 | interface IGroupManager { |
| 48 | - /** |
|
| 49 | - * Checks whether a given backend is used |
|
| 50 | - * |
|
| 51 | - * @param string $backendClass Full classname including complete namespace |
|
| 52 | - * @return bool |
|
| 53 | - * @since 8.1.0 |
|
| 54 | - */ |
|
| 55 | - public function isBackendUsed($backendClass); |
|
| 48 | + /** |
|
| 49 | + * Checks whether a given backend is used |
|
| 50 | + * |
|
| 51 | + * @param string $backendClass Full classname including complete namespace |
|
| 52 | + * @return bool |
|
| 53 | + * @since 8.1.0 |
|
| 54 | + */ |
|
| 55 | + public function isBackendUsed($backendClass); |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @param \OCP\GroupInterface $backend |
|
| 59 | - * @since 8.0.0 |
|
| 60 | - */ |
|
| 61 | - public function addBackend($backend); |
|
| 57 | + /** |
|
| 58 | + * @param \OCP\GroupInterface $backend |
|
| 59 | + * @since 8.0.0 |
|
| 60 | + */ |
|
| 61 | + public function addBackend($backend); |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * @since 8.0.0 |
|
| 65 | - */ |
|
| 66 | - public function clearBackends(); |
|
| 63 | + /** |
|
| 64 | + * @since 8.0.0 |
|
| 65 | + */ |
|
| 66 | + public function clearBackends(); |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * @param string $gid |
|
| 70 | - * @return \OCP\IGroup |
|
| 71 | - * @since 8.0.0 |
|
| 72 | - */ |
|
| 73 | - public function get($gid); |
|
| 68 | + /** |
|
| 69 | + * @param string $gid |
|
| 70 | + * @return \OCP\IGroup |
|
| 71 | + * @since 8.0.0 |
|
| 72 | + */ |
|
| 73 | + public function get($gid); |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * @param string $gid |
|
| 77 | - * @return bool |
|
| 78 | - * @since 8.0.0 |
|
| 79 | - */ |
|
| 80 | - public function groupExists($gid); |
|
| 75 | + /** |
|
| 76 | + * @param string $gid |
|
| 77 | + * @return bool |
|
| 78 | + * @since 8.0.0 |
|
| 79 | + */ |
|
| 80 | + public function groupExists($gid); |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * @param string $gid |
|
| 84 | - * @return \OCP\IGroup |
|
| 85 | - * @since 8.0.0 |
|
| 86 | - */ |
|
| 87 | - public function createGroup($gid); |
|
| 82 | + /** |
|
| 83 | + * @param string $gid |
|
| 84 | + * @return \OCP\IGroup |
|
| 85 | + * @since 8.0.0 |
|
| 86 | + */ |
|
| 87 | + public function createGroup($gid); |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * @param string $search |
|
| 91 | - * @param int $limit |
|
| 92 | - * @param int $offset |
|
| 93 | - * @return \OCP\IGroup[] |
|
| 94 | - * @since 8.0.0 |
|
| 95 | - */ |
|
| 96 | - public function search($search, $limit = null, $offset = null); |
|
| 89 | + /** |
|
| 90 | + * @param string $search |
|
| 91 | + * @param int $limit |
|
| 92 | + * @param int $offset |
|
| 93 | + * @return \OCP\IGroup[] |
|
| 94 | + * @since 8.0.0 |
|
| 95 | + */ |
|
| 96 | + public function search($search, $limit = null, $offset = null); |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * @param \OCP\IUser|null $user |
|
| 100 | - * @return \OCP\IGroup[] |
|
| 101 | - * @since 8.0.0 |
|
| 102 | - */ |
|
| 103 | - public function getUserGroups($user); |
|
| 98 | + /** |
|
| 99 | + * @param \OCP\IUser|null $user |
|
| 100 | + * @return \OCP\IGroup[] |
|
| 101 | + * @since 8.0.0 |
|
| 102 | + */ |
|
| 103 | + public function getUserGroups($user); |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * @param \OCP\IUser $user |
|
| 107 | - * @return array with group names |
|
| 108 | - * @since 8.0.0 |
|
| 109 | - */ |
|
| 110 | - public function getUserGroupIds($user); |
|
| 105 | + /** |
|
| 106 | + * @param \OCP\IUser $user |
|
| 107 | + * @return array with group names |
|
| 108 | + * @since 8.0.0 |
|
| 109 | + */ |
|
| 110 | + public function getUserGroupIds($user); |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * get a list of all display names in a group |
|
| 114 | - * |
|
| 115 | - * @param string $gid |
|
| 116 | - * @param string $search |
|
| 117 | - * @param int $limit |
|
| 118 | - * @param int $offset |
|
| 119 | - * @return array an array of display names (value) and user ids (key) |
|
| 120 | - * @since 8.0.0 |
|
| 121 | - */ |
|
| 122 | - public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0); |
|
| 112 | + /** |
|
| 113 | + * get a list of all display names in a group |
|
| 114 | + * |
|
| 115 | + * @param string $gid |
|
| 116 | + * @param string $search |
|
| 117 | + * @param int $limit |
|
| 118 | + * @param int $offset |
|
| 119 | + * @return array an array of display names (value) and user ids (key) |
|
| 120 | + * @since 8.0.0 |
|
| 121 | + */ |
|
| 122 | + public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0); |
|
| 123 | 123 | |
| 124 | - /** |
|
| 125 | - * Checks if a userId is in the admin group |
|
| 126 | - * @param string $userId |
|
| 127 | - * @return bool if admin |
|
| 128 | - * @since 8.0.0 |
|
| 129 | - */ |
|
| 130 | - public function isAdmin($userId); |
|
| 124 | + /** |
|
| 125 | + * Checks if a userId is in the admin group |
|
| 126 | + * @param string $userId |
|
| 127 | + * @return bool if admin |
|
| 128 | + * @since 8.0.0 |
|
| 129 | + */ |
|
| 130 | + public function isAdmin($userId); |
|
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * Checks if a userId is in a group |
|
| 134 | - * @param string $userId |
|
| 135 | - * @param string $group |
|
| 136 | - * @return bool if in group |
|
| 137 | - * @since 8.0.0 |
|
| 138 | - */ |
|
| 139 | - public function isInGroup($userId, $group); |
|
| 132 | + /** |
|
| 133 | + * Checks if a userId is in a group |
|
| 134 | + * @param string $userId |
|
| 135 | + * @param string $group |
|
| 136 | + * @return bool if in group |
|
| 137 | + * @since 8.0.0 |
|
| 138 | + */ |
|
| 139 | + public function isInGroup($userId, $group); |
|
| 140 | 140 | } |
@@ -35,46 +35,46 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | interface IAvatar { |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * get the users avatar |
|
| 40 | - * @param int $size size in px of the avatar, avatars are square, defaults to 64, -1 can be used to not scale the image |
|
| 41 | - * @return boolean|\OCP\IImage containing the avatar or false if there's no image |
|
| 42 | - * @since 6.0.0 - size of -1 was added in 9.0.0 |
|
| 43 | - */ |
|
| 44 | - public function get($size = 64); |
|
| 38 | + /** |
|
| 39 | + * get the users avatar |
|
| 40 | + * @param int $size size in px of the avatar, avatars are square, defaults to 64, -1 can be used to not scale the image |
|
| 41 | + * @return boolean|\OCP\IImage containing the avatar or false if there's no image |
|
| 42 | + * @since 6.0.0 - size of -1 was added in 9.0.0 |
|
| 43 | + */ |
|
| 44 | + public function get($size = 64); |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Check if an avatar exists for the user |
|
| 48 | - * |
|
| 49 | - * @return bool |
|
| 50 | - * @since 8.1.0 |
|
| 51 | - */ |
|
| 52 | - public function exists(); |
|
| 46 | + /** |
|
| 47 | + * Check if an avatar exists for the user |
|
| 48 | + * |
|
| 49 | + * @return bool |
|
| 50 | + * @since 8.1.0 |
|
| 51 | + */ |
|
| 52 | + public function exists(); |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * sets the users avatar |
|
| 56 | - * @param \OCP\IImage|resource|string $data An image object, imagedata or path to set a new avatar |
|
| 57 | - * @throws \Exception if the provided file is not a jpg or png image |
|
| 58 | - * @throws \Exception if the provided image is not valid |
|
| 59 | - * @throws \OC\NotSquareException if the image is not square |
|
| 60 | - * @return void |
|
| 61 | - * @since 6.0.0 |
|
| 62 | - */ |
|
| 63 | - public function set($data); |
|
| 54 | + /** |
|
| 55 | + * sets the users avatar |
|
| 56 | + * @param \OCP\IImage|resource|string $data An image object, imagedata or path to set a new avatar |
|
| 57 | + * @throws \Exception if the provided file is not a jpg or png image |
|
| 58 | + * @throws \Exception if the provided image is not valid |
|
| 59 | + * @throws \OC\NotSquareException if the image is not square |
|
| 60 | + * @return void |
|
| 61 | + * @since 6.0.0 |
|
| 62 | + */ |
|
| 63 | + public function set($data); |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * remove the users avatar |
|
| 67 | - * @return void |
|
| 68 | - * @since 6.0.0 |
|
| 69 | - */ |
|
| 70 | - public function remove(); |
|
| 65 | + /** |
|
| 66 | + * remove the users avatar |
|
| 67 | + * @return void |
|
| 68 | + * @since 6.0.0 |
|
| 69 | + */ |
|
| 70 | + public function remove(); |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Get the file of the avatar |
|
| 74 | - * @param int $size -1 can be used to not scale the image |
|
| 75 | - * @return File |
|
| 76 | - * @throws NotFoundException |
|
| 77 | - * @since 9.0.0 |
|
| 78 | - */ |
|
| 79 | - public function getFile($size); |
|
| 72 | + /** |
|
| 73 | + * Get the file of the avatar |
|
| 74 | + * @param int $size -1 can be used to not scale the image |
|
| 75 | + * @return File |
|
| 76 | + * @throws NotFoundException |
|
| 77 | + * @since 9.0.0 |
|
| 78 | + */ |
|
| 79 | + public function getFile($size); |
|
| 80 | 80 | } |