@@ -49,89 +49,89 @@ |
||
49 | 49 | interface IDashboardManager { |
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * Register a IWidgetsService. |
|
54 | - * |
|
55 | - * @since 15.0.0 |
|
56 | - * |
|
57 | - * @param IWidgetsService $widgetsService |
|
58 | - */ |
|
59 | - public function registerWidgetsService(IWidgetsService $widgetsService); |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * Register a IEventsService. |
|
64 | - * |
|
65 | - * @since 15.0.0 |
|
66 | - * |
|
67 | - * @param IEventsService $eventsService |
|
68 | - */ |
|
69 | - public function registerEventsService(IEventsService $eventsService); |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * returns the OCP\Dashboard\Model\IWidgetConfig for a widgetId and userId. |
|
74 | - * |
|
75 | - * @see IWidgetConfig |
|
76 | - * |
|
77 | - * @since 15.0.0 |
|
78 | - * |
|
79 | - * @param string $widgetId |
|
80 | - * @param string $userId |
|
81 | - * |
|
82 | - * @throws DashboardAppNotAvailableException |
|
83 | - * @return IWidgetConfig |
|
84 | - */ |
|
85 | - public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig; |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * Create push notifications for users. |
|
90 | - * $payload is an array that will be send to the Javascript method |
|
91 | - * called on push. |
|
92 | - * $uniqueId needs to be used if you send the push to multiples users |
|
93 | - * and multiples groups so that one user does not have duplicate |
|
94 | - * notifications. |
|
95 | - * |
|
96 | - * Push notifications are created in database and broadcast to user |
|
97 | - * that are running dashboard. |
|
98 | - * |
|
99 | - * @since 15.0.0 |
|
100 | - * |
|
101 | - * @param string $widgetId |
|
102 | - * @param array $users |
|
103 | - * @param array $payload |
|
104 | - * @param string $uniqueId |
|
105 | - * @throws DashboardAppNotAvailableException |
|
106 | - */ |
|
107 | - public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = ''); |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * Create push notifications for groups. (ie. createUsersEvent()) |
|
112 | - * |
|
113 | - * @since 15.0.0 |
|
114 | - * |
|
115 | - * @param string $widgetId |
|
116 | - * @param array $groups |
|
117 | - * @param array $payload |
|
118 | - * @param string $uniqueId |
|
119 | - * @throws DashboardAppNotAvailableException |
|
120 | - */ |
|
121 | - public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = ''); |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * Create push notifications for everyone. (ie. createUsersEvent()) |
|
126 | - * |
|
127 | - * @since 15.0.0 |
|
128 | - * |
|
129 | - * @param string $widgetId |
|
130 | - * @param array $payload |
|
131 | - * @param string $uniqueId |
|
132 | - * @throws DashboardAppNotAvailableException |
|
133 | - */ |
|
134 | - public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = ''); |
|
52 | + /** |
|
53 | + * Register a IWidgetsService. |
|
54 | + * |
|
55 | + * @since 15.0.0 |
|
56 | + * |
|
57 | + * @param IWidgetsService $widgetsService |
|
58 | + */ |
|
59 | + public function registerWidgetsService(IWidgetsService $widgetsService); |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * Register a IEventsService. |
|
64 | + * |
|
65 | + * @since 15.0.0 |
|
66 | + * |
|
67 | + * @param IEventsService $eventsService |
|
68 | + */ |
|
69 | + public function registerEventsService(IEventsService $eventsService); |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * returns the OCP\Dashboard\Model\IWidgetConfig for a widgetId and userId. |
|
74 | + * |
|
75 | + * @see IWidgetConfig |
|
76 | + * |
|
77 | + * @since 15.0.0 |
|
78 | + * |
|
79 | + * @param string $widgetId |
|
80 | + * @param string $userId |
|
81 | + * |
|
82 | + * @throws DashboardAppNotAvailableException |
|
83 | + * @return IWidgetConfig |
|
84 | + */ |
|
85 | + public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig; |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * Create push notifications for users. |
|
90 | + * $payload is an array that will be send to the Javascript method |
|
91 | + * called on push. |
|
92 | + * $uniqueId needs to be used if you send the push to multiples users |
|
93 | + * and multiples groups so that one user does not have duplicate |
|
94 | + * notifications. |
|
95 | + * |
|
96 | + * Push notifications are created in database and broadcast to user |
|
97 | + * that are running dashboard. |
|
98 | + * |
|
99 | + * @since 15.0.0 |
|
100 | + * |
|
101 | + * @param string $widgetId |
|
102 | + * @param array $users |
|
103 | + * @param array $payload |
|
104 | + * @param string $uniqueId |
|
105 | + * @throws DashboardAppNotAvailableException |
|
106 | + */ |
|
107 | + public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = ''); |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * Create push notifications for groups. (ie. createUsersEvent()) |
|
112 | + * |
|
113 | + * @since 15.0.0 |
|
114 | + * |
|
115 | + * @param string $widgetId |
|
116 | + * @param array $groups |
|
117 | + * @param array $payload |
|
118 | + * @param string $uniqueId |
|
119 | + * @throws DashboardAppNotAvailableException |
|
120 | + */ |
|
121 | + public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = ''); |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * Create push notifications for everyone. (ie. createUsersEvent()) |
|
126 | + * |
|
127 | + * @since 15.0.0 |
|
128 | + * |
|
129 | + * @param string $widgetId |
|
130 | + * @param array $payload |
|
131 | + * @param string $uniqueId |
|
132 | + * @throws DashboardAppNotAvailableException |
|
133 | + */ |
|
134 | + public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = ''); |
|
135 | 135 | |
136 | 136 | } |
137 | 137 |
@@ -46,17 +46,17 @@ |
||
46 | 46 | */ |
47 | 47 | interface IWidgetsService { |
48 | 48 | |
49 | - /** |
|
50 | - * Returns the IWidgetConfig for a widgetId and userId |
|
51 | - * |
|
52 | - * @since 15.0.0 |
|
53 | - * |
|
54 | - * @param string $widgetId |
|
55 | - * @param string $userId |
|
56 | - * |
|
57 | - * @return IWidgetConfig |
|
58 | - */ |
|
59 | - public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig; |
|
49 | + /** |
|
50 | + * Returns the IWidgetConfig for a widgetId and userId |
|
51 | + * |
|
52 | + * @since 15.0.0 |
|
53 | + * |
|
54 | + * @param string $widgetId |
|
55 | + * @param string $userId |
|
56 | + * |
|
57 | + * @return IWidgetConfig |
|
58 | + */ |
|
59 | + public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig; |
|
60 | 60 | |
61 | 61 | } |
62 | 62 |
@@ -34,71 +34,71 @@ |
||
34 | 34 | */ |
35 | 35 | interface IAccountProperty extends \JsonSerializable { |
36 | 36 | |
37 | - /** |
|
38 | - * Set the value of a property |
|
39 | - * |
|
40 | - * @since 15.0.0 |
|
41 | - * |
|
42 | - * @param string $value |
|
43 | - * @return IAccountProperty |
|
44 | - */ |
|
45 | - public function setValue(string $value): IAccountProperty; |
|
37 | + /** |
|
38 | + * Set the value of a property |
|
39 | + * |
|
40 | + * @since 15.0.0 |
|
41 | + * |
|
42 | + * @param string $value |
|
43 | + * @return IAccountProperty |
|
44 | + */ |
|
45 | + public function setValue(string $value): IAccountProperty; |
|
46 | 46 | |
47 | - /** |
|
48 | - * Set the scope of a property |
|
49 | - * |
|
50 | - * @since 15.0.0 |
|
51 | - * |
|
52 | - * @param string $scope |
|
53 | - * @return IAccountProperty |
|
54 | - */ |
|
55 | - public function setScope(string $scope): IAccountProperty; |
|
47 | + /** |
|
48 | + * Set the scope of a property |
|
49 | + * |
|
50 | + * @since 15.0.0 |
|
51 | + * |
|
52 | + * @param string $scope |
|
53 | + * @return IAccountProperty |
|
54 | + */ |
|
55 | + public function setScope(string $scope): IAccountProperty; |
|
56 | 56 | |
57 | - /** |
|
58 | - * Set the verification status of a property |
|
59 | - * |
|
60 | - * @since 15.0.0 |
|
61 | - * |
|
62 | - * @param string $verified |
|
63 | - * @return IAccountProperty |
|
64 | - */ |
|
65 | - public function setVerified(string $verified): IAccountProperty; |
|
57 | + /** |
|
58 | + * Set the verification status of a property |
|
59 | + * |
|
60 | + * @since 15.0.0 |
|
61 | + * |
|
62 | + * @param string $verified |
|
63 | + * @return IAccountProperty |
|
64 | + */ |
|
65 | + public function setVerified(string $verified): IAccountProperty; |
|
66 | 66 | |
67 | - /** |
|
68 | - * Get the name of a property |
|
69 | - * |
|
70 | - * @since 15.0.0 |
|
71 | - * |
|
72 | - * @return string |
|
73 | - */ |
|
74 | - public function getName(): string; |
|
67 | + /** |
|
68 | + * Get the name of a property |
|
69 | + * |
|
70 | + * @since 15.0.0 |
|
71 | + * |
|
72 | + * @return string |
|
73 | + */ |
|
74 | + public function getName(): string; |
|
75 | 75 | |
76 | - /** |
|
77 | - * Get the value of a property |
|
78 | - * |
|
79 | - * @since 15.0.0 |
|
80 | - * |
|
81 | - * @return string |
|
82 | - */ |
|
83 | - public function getValue(): string; |
|
76 | + /** |
|
77 | + * Get the value of a property |
|
78 | + * |
|
79 | + * @since 15.0.0 |
|
80 | + * |
|
81 | + * @return string |
|
82 | + */ |
|
83 | + public function getValue(): string; |
|
84 | 84 | |
85 | - /** |
|
86 | - * Get the scope of a property |
|
87 | - * |
|
88 | - * @since 15.0.0 |
|
89 | - * |
|
90 | - * @return string |
|
91 | - */ |
|
92 | - public function getScope(): string; |
|
85 | + /** |
|
86 | + * Get the scope of a property |
|
87 | + * |
|
88 | + * @since 15.0.0 |
|
89 | + * |
|
90 | + * @return string |
|
91 | + */ |
|
92 | + public function getScope(): string; |
|
93 | 93 | |
94 | - /** |
|
95 | - * Get the verification status of a property |
|
96 | - * |
|
97 | - * @since 15.0.0 |
|
98 | - * |
|
99 | - * @return string |
|
100 | - */ |
|
101 | - public function getVerified(): string; |
|
94 | + /** |
|
95 | + * Get the verification status of a property |
|
96 | + * |
|
97 | + * @since 15.0.0 |
|
98 | + * |
|
99 | + * @return string |
|
100 | + */ |
|
101 | + public function getVerified(): string; |
|
102 | 102 | |
103 | 103 | } |
104 | 104 |
@@ -30,111 +30,111 @@ |
||
30 | 30 | |
31 | 31 | class AccountProperty implements IAccountProperty { |
32 | 32 | |
33 | - /** @var string */ |
|
34 | - private $name; |
|
35 | - /** @var string */ |
|
36 | - private $value; |
|
37 | - /** @var string */ |
|
38 | - private $scope; |
|
39 | - /** @var string */ |
|
40 | - private $verified; |
|
33 | + /** @var string */ |
|
34 | + private $name; |
|
35 | + /** @var string */ |
|
36 | + private $value; |
|
37 | + /** @var string */ |
|
38 | + private $scope; |
|
39 | + /** @var string */ |
|
40 | + private $verified; |
|
41 | 41 | |
42 | - public function __construct(string $name, string $value, string $scope, string $verified) { |
|
43 | - $this->name = $name; |
|
44 | - $this->value = $value; |
|
45 | - $this->scope = $scope; |
|
46 | - $this->verified = $verified; |
|
47 | - } |
|
42 | + public function __construct(string $name, string $value, string $scope, string $verified) { |
|
43 | + $this->name = $name; |
|
44 | + $this->value = $value; |
|
45 | + $this->scope = $scope; |
|
46 | + $this->verified = $verified; |
|
47 | + } |
|
48 | 48 | |
49 | - public function jsonSerialize() { |
|
50 | - return [ |
|
51 | - 'name' => $this->getName(), |
|
52 | - 'value' => $this->getValue(), |
|
53 | - 'scope' => $this->getScope(), |
|
54 | - 'verified' => $this->getVerified() |
|
55 | - ]; |
|
56 | - } |
|
49 | + public function jsonSerialize() { |
|
50 | + return [ |
|
51 | + 'name' => $this->getName(), |
|
52 | + 'value' => $this->getValue(), |
|
53 | + 'scope' => $this->getScope(), |
|
54 | + 'verified' => $this->getVerified() |
|
55 | + ]; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Set the value of a property |
|
60 | - * |
|
61 | - * @since 15.0.0 |
|
62 | - * |
|
63 | - * @param string $value |
|
64 | - * @return IAccountProperty |
|
65 | - */ |
|
66 | - public function setValue(string $value): IAccountProperty { |
|
67 | - $this->value = $value; |
|
68 | - return $this; |
|
69 | - } |
|
58 | + /** |
|
59 | + * Set the value of a property |
|
60 | + * |
|
61 | + * @since 15.0.0 |
|
62 | + * |
|
63 | + * @param string $value |
|
64 | + * @return IAccountProperty |
|
65 | + */ |
|
66 | + public function setValue(string $value): IAccountProperty { |
|
67 | + $this->value = $value; |
|
68 | + return $this; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Set the scope of a property |
|
73 | - * |
|
74 | - * @since 15.0.0 |
|
75 | - * |
|
76 | - * @param string $scope |
|
77 | - * @return IAccountProperty |
|
78 | - */ |
|
79 | - public function setScope(string $scope): IAccountProperty { |
|
80 | - $this->scope = $scope; |
|
81 | - return $this; |
|
82 | - } |
|
71 | + /** |
|
72 | + * Set the scope of a property |
|
73 | + * |
|
74 | + * @since 15.0.0 |
|
75 | + * |
|
76 | + * @param string $scope |
|
77 | + * @return IAccountProperty |
|
78 | + */ |
|
79 | + public function setScope(string $scope): IAccountProperty { |
|
80 | + $this->scope = $scope; |
|
81 | + return $this; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Set the verification status of a property |
|
86 | - * |
|
87 | - * @since 15.0.0 |
|
88 | - * |
|
89 | - * @param string $verified |
|
90 | - * @return IAccountProperty |
|
91 | - */ |
|
92 | - public function setVerified(string $verified): IAccountProperty { |
|
93 | - $this->verified = $verified; |
|
94 | - return $this; |
|
95 | - } |
|
84 | + /** |
|
85 | + * Set the verification status of a property |
|
86 | + * |
|
87 | + * @since 15.0.0 |
|
88 | + * |
|
89 | + * @param string $verified |
|
90 | + * @return IAccountProperty |
|
91 | + */ |
|
92 | + public function setVerified(string $verified): IAccountProperty { |
|
93 | + $this->verified = $verified; |
|
94 | + return $this; |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * Get the name of a property |
|
99 | - * |
|
100 | - * @since 15.0.0 |
|
101 | - * |
|
102 | - * @return string |
|
103 | - */ |
|
104 | - public function getName(): string { |
|
105 | - return $this->name; |
|
106 | - } |
|
97 | + /** |
|
98 | + * Get the name of a property |
|
99 | + * |
|
100 | + * @since 15.0.0 |
|
101 | + * |
|
102 | + * @return string |
|
103 | + */ |
|
104 | + public function getName(): string { |
|
105 | + return $this->name; |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * Get the value of a property |
|
110 | - * |
|
111 | - * @since 15.0.0 |
|
112 | - * |
|
113 | - * @return string |
|
114 | - */ |
|
115 | - public function getValue(): string { |
|
116 | - return $this->value; |
|
117 | - } |
|
108 | + /** |
|
109 | + * Get the value of a property |
|
110 | + * |
|
111 | + * @since 15.0.0 |
|
112 | + * |
|
113 | + * @return string |
|
114 | + */ |
|
115 | + public function getValue(): string { |
|
116 | + return $this->value; |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * Get the scope of a property |
|
121 | - * |
|
122 | - * @since 15.0.0 |
|
123 | - * |
|
124 | - * @return string |
|
125 | - */ |
|
126 | - public function getScope(): string { |
|
127 | - return $this->scope; |
|
128 | - } |
|
119 | + /** |
|
120 | + * Get the scope of a property |
|
121 | + * |
|
122 | + * @since 15.0.0 |
|
123 | + * |
|
124 | + * @return string |
|
125 | + */ |
|
126 | + public function getScope(): string { |
|
127 | + return $this->scope; |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * Get the verification status of a property |
|
132 | - * |
|
133 | - * @since 15.0.0 |
|
134 | - * |
|
135 | - * @return string |
|
136 | - */ |
|
137 | - public function getVerified(): string { |
|
138 | - return $this->verified; |
|
139 | - } |
|
130 | + /** |
|
131 | + * Get the verification status of a property |
|
132 | + * |
|
133 | + * @since 15.0.0 |
|
134 | + * |
|
135 | + * @return string |
|
136 | + */ |
|
137 | + public function getVerified(): string { |
|
138 | + return $this->verified; |
|
139 | + } |
|
140 | 140 | } |
@@ -33,16 +33,16 @@ |
||
33 | 33 | */ |
34 | 34 | abstract class QueuedJob extends Job { |
35 | 35 | |
36 | - /** |
|
37 | - * run the job, then remove it from the joblist |
|
38 | - * |
|
39 | - * @param IJobList $jobList |
|
40 | - * @param ILogger|null $logger |
|
41 | - * |
|
42 | - * @since 15.0.0 |
|
43 | - */ |
|
44 | - final public function execute($jobList, ILogger $logger = null) { |
|
45 | - $jobList->remove($this, $this->argument); |
|
46 | - parent::execute($jobList, $logger); |
|
47 | - } |
|
36 | + /** |
|
37 | + * run the job, then remove it from the joblist |
|
38 | + * |
|
39 | + * @param IJobList $jobList |
|
40 | + * @param ILogger|null $logger |
|
41 | + * |
|
42 | + * @since 15.0.0 |
|
43 | + */ |
|
44 | + final public function execute($jobList, ILogger $logger = null) { |
|
45 | + $jobList->remove($this, $this->argument); |
|
46 | + parent::execute($jobList, $logger); |
|
47 | + } |
|
48 | 48 | } |
@@ -34,29 +34,29 @@ |
||
34 | 34 | * @since 15.0.0 |
35 | 35 | */ |
36 | 36 | abstract class TimedJob extends Job { |
37 | - /** @var int */ |
|
38 | - protected $interval = 0; |
|
37 | + /** @var int */ |
|
38 | + protected $interval = 0; |
|
39 | 39 | |
40 | - /** |
|
41 | - * set the interval for the job |
|
42 | - * |
|
43 | - * @since 15.0.0 |
|
44 | - */ |
|
45 | - public function setInterval(int $interval) { |
|
46 | - $this->interval = $interval; |
|
47 | - } |
|
40 | + /** |
|
41 | + * set the interval for the job |
|
42 | + * |
|
43 | + * @since 15.0.0 |
|
44 | + */ |
|
45 | + public function setInterval(int $interval) { |
|
46 | + $this->interval = $interval; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * run the job if the last run is is more than the interval ago |
|
51 | - * |
|
52 | - * @param JobList $jobList |
|
53 | - * @param ILogger|null $logger |
|
54 | - * |
|
55 | - * @since 15.0.0 |
|
56 | - */ |
|
57 | - final public function execute($jobList, ILogger $logger = null) { |
|
58 | - if (($this->time->getTime() - $this->lastRun) > $this->interval) { |
|
59 | - parent::execute($jobList, $logger); |
|
60 | - } |
|
61 | - } |
|
49 | + /** |
|
50 | + * run the job if the last run is is more than the interval ago |
|
51 | + * |
|
52 | + * @param JobList $jobList |
|
53 | + * @param ILogger|null $logger |
|
54 | + * |
|
55 | + * @since 15.0.0 |
|
56 | + */ |
|
57 | + final public function execute($jobList, ILogger $logger = null) { |
|
58 | + if (($this->time->getTime() - $this->lastRun) > $this->interval) { |
|
59 | + parent::execute($jobList, $logger); |
|
60 | + } |
|
61 | + } |
|
62 | 62 | } |
@@ -24,33 +24,33 @@ |
||
24 | 24 | use OCP\IUser; |
25 | 25 | |
26 | 26 | interface ITrashManager extends ITrashBackend { |
27 | - /** |
|
28 | - * Add a backend for the trashbin |
|
29 | - * |
|
30 | - * @param string $storageType |
|
31 | - * @param ITrashBackend $backend |
|
32 | - * @since 15.0.0 |
|
33 | - */ |
|
34 | - public function registerBackend(string $storageType, ITrashBackend $backend); |
|
27 | + /** |
|
28 | + * Add a backend for the trashbin |
|
29 | + * |
|
30 | + * @param string $storageType |
|
31 | + * @param ITrashBackend $backend |
|
32 | + * @since 15.0.0 |
|
33 | + */ |
|
34 | + public function registerBackend(string $storageType, ITrashBackend $backend); |
|
35 | 35 | |
36 | - /** |
|
37 | - * List all trash items in the root of the trashbin |
|
38 | - * |
|
39 | - * @param IUser $user |
|
40 | - * @return ITrashItem[] |
|
41 | - * @since 15.0.0 |
|
42 | - */ |
|
43 | - public function listTrashRoot(IUser $user): array; |
|
36 | + /** |
|
37 | + * List all trash items in the root of the trashbin |
|
38 | + * |
|
39 | + * @param IUser $user |
|
40 | + * @return ITrashItem[] |
|
41 | + * @since 15.0.0 |
|
42 | + */ |
|
43 | + public function listTrashRoot(IUser $user): array; |
|
44 | 44 | |
45 | - /** |
|
46 | - * Temporally prevent files from being moved to the trash |
|
47 | - * |
|
48 | - * @since 15.0.0 |
|
49 | - */ |
|
50 | - public function pauseTrash(); |
|
45 | + /** |
|
46 | + * Temporally prevent files from being moved to the trash |
|
47 | + * |
|
48 | + * @since 15.0.0 |
|
49 | + */ |
|
50 | + public function pauseTrash(); |
|
51 | 51 | |
52 | - /** |
|
53 | - * @since 15.0.0 |
|
54 | - */ |
|
55 | - public function resumeTrash(); |
|
52 | + /** |
|
53 | + * @since 15.0.0 |
|
54 | + */ |
|
55 | + public function resumeTrash(); |
|
56 | 56 | } |
@@ -31,54 +31,54 @@ |
||
31 | 31 | * @since 15.0.0 |
32 | 32 | */ |
33 | 33 | interface ITrashBackend { |
34 | - /** |
|
35 | - * List all trash items in the root of the trashbin |
|
36 | - * |
|
37 | - * @param IUser $user |
|
38 | - * @return ITrashItem[] |
|
39 | - * @since 15.0.0 |
|
40 | - */ |
|
41 | - public function listTrashRoot(IUser $user): array; |
|
34 | + /** |
|
35 | + * List all trash items in the root of the trashbin |
|
36 | + * |
|
37 | + * @param IUser $user |
|
38 | + * @return ITrashItem[] |
|
39 | + * @since 15.0.0 |
|
40 | + */ |
|
41 | + public function listTrashRoot(IUser $user): array; |
|
42 | 42 | |
43 | - /** |
|
44 | - * List all trash items in a subfolder in the trashbin |
|
45 | - * |
|
46 | - * @param ITrashItem $folder |
|
47 | - * @return ITrashItem[] |
|
48 | - * @since 15.0.0 |
|
49 | - */ |
|
50 | - public function listTrashFolder(ITrashItem $folder): array; |
|
43 | + /** |
|
44 | + * List all trash items in a subfolder in the trashbin |
|
45 | + * |
|
46 | + * @param ITrashItem $folder |
|
47 | + * @return ITrashItem[] |
|
48 | + * @since 15.0.0 |
|
49 | + */ |
|
50 | + public function listTrashFolder(ITrashItem $folder): array; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Restore a trashbin item |
|
54 | - * |
|
55 | - * @param ITrashItem $item |
|
56 | - * @since 15.0.0 |
|
57 | - */ |
|
58 | - public function restoreItem(ITrashItem $item); |
|
52 | + /** |
|
53 | + * Restore a trashbin item |
|
54 | + * |
|
55 | + * @param ITrashItem $item |
|
56 | + * @since 15.0.0 |
|
57 | + */ |
|
58 | + public function restoreItem(ITrashItem $item); |
|
59 | 59 | |
60 | - /** |
|
61 | - * Permanently remove an item from trash |
|
62 | - * |
|
63 | - * @param ITrashItem $item |
|
64 | - * @since 15.0.0 |
|
65 | - */ |
|
66 | - public function removeItem(ITrashItem $item); |
|
60 | + /** |
|
61 | + * Permanently remove an item from trash |
|
62 | + * |
|
63 | + * @param ITrashItem $item |
|
64 | + * @since 15.0.0 |
|
65 | + */ |
|
66 | + public function removeItem(ITrashItem $item); |
|
67 | 67 | |
68 | - /** |
|
69 | - * Move a file or folder to trash |
|
70 | - * |
|
71 | - * @param IStorage $storage |
|
72 | - * @param string $internalPath |
|
73 | - * @return boolean whether or not the file was moved to trash, if false then the file should be deleted normally |
|
74 | - * @since 15.0.0 |
|
75 | - */ |
|
76 | - public function moveToTrash(IStorage $storage, string $internalPath): bool; |
|
68 | + /** |
|
69 | + * Move a file or folder to trash |
|
70 | + * |
|
71 | + * @param IStorage $storage |
|
72 | + * @param string $internalPath |
|
73 | + * @return boolean whether or not the file was moved to trash, if false then the file should be deleted normally |
|
74 | + * @since 15.0.0 |
|
75 | + */ |
|
76 | + public function moveToTrash(IStorage $storage, string $internalPath): bool; |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param IUser $user |
|
80 | - * @param int $fileId |
|
81 | - * @return Node|null |
|
82 | - */ |
|
83 | - public function getTrashNodeById(IUser $user, int $fileId); |
|
78 | + /** |
|
79 | + * @param IUser $user |
|
80 | + * @param int $fileId |
|
81 | + * @return Node|null |
|
82 | + */ |
|
83 | + public function getTrashNodeById(IUser $user, int $fileId); |
|
84 | 84 | } |
@@ -31,69 +31,69 @@ |
||
31 | 31 | use Sabre\DAV\ICollection; |
32 | 32 | |
33 | 33 | class TrashHome implements ICollection { |
34 | - /** @var ITrashManager */ |
|
35 | - private $trashManager; |
|
36 | - |
|
37 | - /** @var array */ |
|
38 | - private $principalInfo; |
|
39 | - |
|
40 | - /** @var IUser */ |
|
41 | - private $user; |
|
42 | - |
|
43 | - public function __construct( |
|
44 | - array $principalInfo, |
|
45 | - ITrashManager $trashManager, |
|
46 | - IUser $user |
|
47 | - ) { |
|
48 | - $this->principalInfo = $principalInfo; |
|
49 | - $this->trashManager = $trashManager; |
|
50 | - $this->user = $user; |
|
51 | - } |
|
52 | - |
|
53 | - public function delete() { |
|
54 | - throw new Forbidden(); |
|
55 | - } |
|
56 | - |
|
57 | - public function getName(): string { |
|
58 | - list(, $name) = \Sabre\Uri\split($this->principalInfo['uri']); |
|
59 | - return $name; |
|
60 | - } |
|
61 | - |
|
62 | - public function setName($name) { |
|
63 | - throw new Forbidden('Permission denied to rename this trashbin'); |
|
64 | - } |
|
65 | - |
|
66 | - public function createFile($name, $data = null) { |
|
67 | - throw new Forbidden('Not allowed to create files in the trashbin'); |
|
68 | - } |
|
69 | - |
|
70 | - public function createDirectory($name) { |
|
71 | - throw new Forbidden('Not allowed to create folders in the trashbin'); |
|
72 | - } |
|
73 | - |
|
74 | - public function getChild($name) { |
|
75 | - if ($name === 'restore') { |
|
76 | - return new RestoreFolder(); |
|
77 | - } |
|
78 | - if ($name === 'trash') { |
|
79 | - return new TrashRoot($this->user, $this->trashManager); |
|
80 | - } |
|
81 | - |
|
82 | - throw new NotFound(); |
|
83 | - } |
|
84 | - |
|
85 | - public function getChildren(): array { |
|
86 | - return [ |
|
87 | - new RestoreFolder(), |
|
88 | - new TrashRoot($this->user, $this->trashManager) |
|
89 | - ]; |
|
90 | - } |
|
91 | - |
|
92 | - public function childExists($name): bool { |
|
93 | - return $name === 'restore' || $name === 'trash'; |
|
94 | - } |
|
95 | - |
|
96 | - public function getLastModified(): int { |
|
97 | - return 0; |
|
98 | - } |
|
34 | + /** @var ITrashManager */ |
|
35 | + private $trashManager; |
|
36 | + |
|
37 | + /** @var array */ |
|
38 | + private $principalInfo; |
|
39 | + |
|
40 | + /** @var IUser */ |
|
41 | + private $user; |
|
42 | + |
|
43 | + public function __construct( |
|
44 | + array $principalInfo, |
|
45 | + ITrashManager $trashManager, |
|
46 | + IUser $user |
|
47 | + ) { |
|
48 | + $this->principalInfo = $principalInfo; |
|
49 | + $this->trashManager = $trashManager; |
|
50 | + $this->user = $user; |
|
51 | + } |
|
52 | + |
|
53 | + public function delete() { |
|
54 | + throw new Forbidden(); |
|
55 | + } |
|
56 | + |
|
57 | + public function getName(): string { |
|
58 | + list(, $name) = \Sabre\Uri\split($this->principalInfo['uri']); |
|
59 | + return $name; |
|
60 | + } |
|
61 | + |
|
62 | + public function setName($name) { |
|
63 | + throw new Forbidden('Permission denied to rename this trashbin'); |
|
64 | + } |
|
65 | + |
|
66 | + public function createFile($name, $data = null) { |
|
67 | + throw new Forbidden('Not allowed to create files in the trashbin'); |
|
68 | + } |
|
69 | + |
|
70 | + public function createDirectory($name) { |
|
71 | + throw new Forbidden('Not allowed to create folders in the trashbin'); |
|
72 | + } |
|
73 | + |
|
74 | + public function getChild($name) { |
|
75 | + if ($name === 'restore') { |
|
76 | + return new RestoreFolder(); |
|
77 | + } |
|
78 | + if ($name === 'trash') { |
|
79 | + return new TrashRoot($this->user, $this->trashManager); |
|
80 | + } |
|
81 | + |
|
82 | + throw new NotFound(); |
|
83 | + } |
|
84 | + |
|
85 | + public function getChildren(): array { |
|
86 | + return [ |
|
87 | + new RestoreFolder(), |
|
88 | + new TrashRoot($this->user, $this->trashManager) |
|
89 | + ]; |
|
90 | + } |
|
91 | + |
|
92 | + public function childExists($name): bool { |
|
93 | + return $name === 'restore' || $name === 'trash'; |
|
94 | + } |
|
95 | + |
|
96 | + public function getLastModified(): int { |
|
97 | + return 0; |
|
98 | + } |
|
99 | 99 | } |