@@ -31,41 +31,41 @@ |
||
31 | 31 | */ |
32 | 32 | interface ICalendar { |
33 | 33 | |
34 | - /** |
|
35 | - * @return string defining the technical unique key |
|
36 | - * @since 13.0.0 |
|
37 | - */ |
|
38 | - public function getKey(); |
|
34 | + /** |
|
35 | + * @return string defining the technical unique key |
|
36 | + * @since 13.0.0 |
|
37 | + */ |
|
38 | + public function getKey(); |
|
39 | 39 | |
40 | - /** |
|
41 | - * In comparison to getKey() this function returns a human readable (maybe translated) name |
|
42 | - * @return null|string |
|
43 | - * @since 13.0.0 |
|
44 | - */ |
|
45 | - public function getDisplayName(); |
|
40 | + /** |
|
41 | + * In comparison to getKey() this function returns a human readable (maybe translated) name |
|
42 | + * @return null|string |
|
43 | + * @since 13.0.0 |
|
44 | + */ |
|
45 | + public function getDisplayName(); |
|
46 | 46 | |
47 | - /** |
|
48 | - * Calendar color |
|
49 | - * @return null|string |
|
50 | - * @since 13.0.0 |
|
51 | - */ |
|
52 | - public function getDisplayColor(); |
|
47 | + /** |
|
48 | + * Calendar color |
|
49 | + * @return null|string |
|
50 | + * @since 13.0.0 |
|
51 | + */ |
|
52 | + public function getDisplayColor(); |
|
53 | 53 | |
54 | - /** |
|
55 | - * @param string $pattern which should match within the $searchProperties |
|
56 | - * @param array $searchProperties defines the properties within the query pattern should match |
|
57 | - * @param array $options - optional parameters: |
|
58 | - * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] |
|
59 | - * @param integer|null $limit - limit number of search results |
|
60 | - * @param integer|null $offset - offset for paging of search results |
|
61 | - * @return array an array of events/journals/todos which are arrays of key-value-pairs |
|
62 | - * @since 13.0.0 |
|
63 | - */ |
|
64 | - public function search($pattern, array $searchProperties=[], array $options=[], $limit=null, $offset=null); |
|
54 | + /** |
|
55 | + * @param string $pattern which should match within the $searchProperties |
|
56 | + * @param array $searchProperties defines the properties within the query pattern should match |
|
57 | + * @param array $options - optional parameters: |
|
58 | + * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] |
|
59 | + * @param integer|null $limit - limit number of search results |
|
60 | + * @param integer|null $offset - offset for paging of search results |
|
61 | + * @return array an array of events/journals/todos which are arrays of key-value-pairs |
|
62 | + * @since 13.0.0 |
|
63 | + */ |
|
64 | + public function search($pattern, array $searchProperties=[], array $options=[], $limit=null, $offset=null); |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return integer build up using \OCP\Constants |
|
68 | - * @since 13.0.0 |
|
69 | - */ |
|
70 | - public function getPermissions(); |
|
66 | + /** |
|
67 | + * @return integer build up using \OCP\Constants |
|
68 | + * @since 13.0.0 |
|
69 | + */ |
|
70 | + public function getPermissions(); |
|
71 | 71 | } |
@@ -26,61 +26,61 @@ |
||
26 | 26 | |
27 | 27 | interface ILDAPGroupPlugin { |
28 | 28 | |
29 | - /** |
|
30 | - * Check if plugin implements actions |
|
31 | - * @return int |
|
32 | - * |
|
33 | - * Returns the supported actions as int to be |
|
34 | - * compared with OC_GROUP_BACKEND_CREATE_GROUP etc. |
|
35 | - */ |
|
36 | - public function respondToActions(); |
|
29 | + /** |
|
30 | + * Check if plugin implements actions |
|
31 | + * @return int |
|
32 | + * |
|
33 | + * Returns the supported actions as int to be |
|
34 | + * compared with OC_GROUP_BACKEND_CREATE_GROUP etc. |
|
35 | + */ |
|
36 | + public function respondToActions(); |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param string $gid |
|
40 | - * @return string|null The group DN if group creation was successful. |
|
41 | - */ |
|
42 | - public function createGroup($gid); |
|
38 | + /** |
|
39 | + * @param string $gid |
|
40 | + * @return string|null The group DN if group creation was successful. |
|
41 | + */ |
|
42 | + public function createGroup($gid); |
|
43 | 43 | |
44 | - /** |
|
45 | - * delete a group |
|
46 | - * @param string $gid gid of the group to delete |
|
47 | - * @return bool |
|
48 | - */ |
|
49 | - public function deleteGroup($gid); |
|
44 | + /** |
|
45 | + * delete a group |
|
46 | + * @param string $gid gid of the group to delete |
|
47 | + * @return bool |
|
48 | + */ |
|
49 | + public function deleteGroup($gid); |
|
50 | 50 | |
51 | - /** |
|
52 | - * Add a user to a group |
|
53 | - * @param string $uid Name of the user to add to group |
|
54 | - * @param string $gid Name of the group in which add the user |
|
55 | - * @return bool |
|
56 | - * |
|
57 | - * Adds a user to a group. |
|
58 | - */ |
|
59 | - public function addToGroup($uid, $gid); |
|
51 | + /** |
|
52 | + * Add a user to a group |
|
53 | + * @param string $uid Name of the user to add to group |
|
54 | + * @param string $gid Name of the group in which add the user |
|
55 | + * @return bool |
|
56 | + * |
|
57 | + * Adds a user to a group. |
|
58 | + */ |
|
59 | + public function addToGroup($uid, $gid); |
|
60 | 60 | |
61 | - /** |
|
62 | - * Removes a user from a group |
|
63 | - * @param string $uid Name of the user to remove from group |
|
64 | - * @param string $gid Name of the group from which remove the user |
|
65 | - * @return bool |
|
66 | - * |
|
67 | - * removes the user from a group. |
|
68 | - */ |
|
69 | - public function removeFromGroup($uid, $gid); |
|
61 | + /** |
|
62 | + * Removes a user from a group |
|
63 | + * @param string $uid Name of the user to remove from group |
|
64 | + * @param string $gid Name of the group from which remove the user |
|
65 | + * @return bool |
|
66 | + * |
|
67 | + * removes the user from a group. |
|
68 | + */ |
|
69 | + public function removeFromGroup($uid, $gid); |
|
70 | 70 | |
71 | - /** |
|
72 | - * get the number of all users matching the search string in a group |
|
73 | - * @param string $gid |
|
74 | - * @param string $search |
|
75 | - * @return int|false |
|
76 | - */ |
|
77 | - public function countUsersInGroup($gid, $search = ''); |
|
71 | + /** |
|
72 | + * get the number of all users matching the search string in a group |
|
73 | + * @param string $gid |
|
74 | + * @param string $search |
|
75 | + * @return int|false |
|
76 | + */ |
|
77 | + public function countUsersInGroup($gid, $search = ''); |
|
78 | 78 | |
79 | - /** |
|
80 | - * get an array with group details |
|
81 | - * @param string $gid |
|
82 | - * @return array|false |
|
83 | - */ |
|
84 | - public function getGroupDetails($gid); |
|
79 | + /** |
|
80 | + * get an array with group details |
|
81 | + * @param string $gid |
|
82 | + * @return array|false |
|
83 | + */ |
|
84 | + public function getGroupDetails($gid); |
|
85 | 85 | |
86 | 86 | } |
@@ -55,67 +55,67 @@ |
||
55 | 55 | */ |
56 | 56 | interface IManager { |
57 | 57 | |
58 | - /** |
|
59 | - * This function is used to search and find objects within the user's calendars. |
|
60 | - * In case $pattern is empty all events/journals/todos will be returned. |
|
61 | - * |
|
62 | - * @param string $pattern which should match within the $searchProperties |
|
63 | - * @param array $searchProperties defines the properties within the query pattern should match |
|
64 | - * @param array $options - optional parameters: |
|
65 | - * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] |
|
66 | - * @param integer|null $limit - limit number of search results |
|
67 | - * @param integer|null $offset - offset for paging of search results |
|
68 | - * @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs |
|
69 | - * @since 13.0.0 |
|
70 | - */ |
|
71 | - public function search($pattern, array $searchProperties=[], array $options=[], $limit=null, $offset=null); |
|
58 | + /** |
|
59 | + * This function is used to search and find objects within the user's calendars. |
|
60 | + * In case $pattern is empty all events/journals/todos will be returned. |
|
61 | + * |
|
62 | + * @param string $pattern which should match within the $searchProperties |
|
63 | + * @param array $searchProperties defines the properties within the query pattern should match |
|
64 | + * @param array $options - optional parameters: |
|
65 | + * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] |
|
66 | + * @param integer|null $limit - limit number of search results |
|
67 | + * @param integer|null $offset - offset for paging of search results |
|
68 | + * @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs |
|
69 | + * @since 13.0.0 |
|
70 | + */ |
|
71 | + public function search($pattern, array $searchProperties=[], array $options=[], $limit=null, $offset=null); |
|
72 | 72 | |
73 | - /** |
|
74 | - * Check if calendars are available |
|
75 | - * |
|
76 | - * @return bool true if enabled, false if not |
|
77 | - * @since 13.0.0 |
|
78 | - */ |
|
79 | - public function isEnabled(); |
|
73 | + /** |
|
74 | + * Check if calendars are available |
|
75 | + * |
|
76 | + * @return bool true if enabled, false if not |
|
77 | + * @since 13.0.0 |
|
78 | + */ |
|
79 | + public function isEnabled(); |
|
80 | 80 | |
81 | - /** |
|
82 | - * Registers a calendar |
|
83 | - * |
|
84 | - * @param ICalendar $calendar |
|
85 | - * @return void |
|
86 | - * @since 13.0.0 |
|
87 | - */ |
|
88 | - public function registerCalendar(ICalendar $calendar); |
|
81 | + /** |
|
82 | + * Registers a calendar |
|
83 | + * |
|
84 | + * @param ICalendar $calendar |
|
85 | + * @return void |
|
86 | + * @since 13.0.0 |
|
87 | + */ |
|
88 | + public function registerCalendar(ICalendar $calendar); |
|
89 | 89 | |
90 | - /** |
|
91 | - * Unregisters a calendar |
|
92 | - * |
|
93 | - * @param ICalendar $calendar |
|
94 | - * @return void |
|
95 | - * @since 13.0.0 |
|
96 | - */ |
|
97 | - public function unregisterCalendar(ICalendar $calendar); |
|
90 | + /** |
|
91 | + * Unregisters a calendar |
|
92 | + * |
|
93 | + * @param ICalendar $calendar |
|
94 | + * @return void |
|
95 | + * @since 13.0.0 |
|
96 | + */ |
|
97 | + public function unregisterCalendar(ICalendar $calendar); |
|
98 | 98 | |
99 | - /** |
|
100 | - * In order to improve lazy loading a closure can be registered which will be called in case |
|
101 | - * calendars are actually requested |
|
102 | - * |
|
103 | - * @param \Closure $callable |
|
104 | - * @return void |
|
105 | - * @since 13.0.0 |
|
106 | - */ |
|
107 | - public function register(\Closure $callable); |
|
99 | + /** |
|
100 | + * In order to improve lazy loading a closure can be registered which will be called in case |
|
101 | + * calendars are actually requested |
|
102 | + * |
|
103 | + * @param \Closure $callable |
|
104 | + * @return void |
|
105 | + * @since 13.0.0 |
|
106 | + */ |
|
107 | + public function register(\Closure $callable); |
|
108 | 108 | |
109 | - /** |
|
110 | - * @return ICalendar[] |
|
111 | - * @since 13.0.0 |
|
112 | - */ |
|
113 | - public function getCalendars(); |
|
109 | + /** |
|
110 | + * @return ICalendar[] |
|
111 | + * @since 13.0.0 |
|
112 | + */ |
|
113 | + public function getCalendars(); |
|
114 | 114 | |
115 | - /** |
|
116 | - * removes all registered calendar instances |
|
117 | - * @return void |
|
118 | - * @since 13.0.0 |
|
119 | - */ |
|
120 | - public function clear(); |
|
115 | + /** |
|
116 | + * removes all registered calendar instances |
|
117 | + * @return void |
|
118 | + * @since 13.0.0 |
|
119 | + */ |
|
120 | + public function clear(); |
|
121 | 121 | } |
@@ -30,12 +30,12 @@ |
||
30 | 30 | */ |
31 | 31 | interface IReporter { |
32 | 32 | |
33 | - /** |
|
34 | - * Report an (unhandled) exception |
|
35 | - * |
|
36 | - * @since 13.0.0 |
|
37 | - * @param Exception|Throwable $exception |
|
38 | - * @param array $context |
|
39 | - */ |
|
40 | - public function report($exception, array $context = []); |
|
33 | + /** |
|
34 | + * Report an (unhandled) exception |
|
35 | + * |
|
36 | + * @since 13.0.0 |
|
37 | + * @param Exception|Throwable $exception |
|
38 | + * @param array $context |
|
39 | + */ |
|
40 | + public function report($exception, array $context = []); |
|
41 | 41 | } |
@@ -27,17 +27,17 @@ |
||
27 | 27 | * @since 13.0.0 |
28 | 28 | */ |
29 | 29 | interface ICachedMountFileInfo extends ICachedMountInfo { |
30 | - /** |
|
31 | - * Return the path for the file within the cached mount |
|
32 | - * |
|
33 | - * @return string |
|
34 | - * @since 13.0.0 |
|
35 | - */ |
|
36 | - public function getInternalPath(); |
|
30 | + /** |
|
31 | + * Return the path for the file within the cached mount |
|
32 | + * |
|
33 | + * @return string |
|
34 | + * @since 13.0.0 |
|
35 | + */ |
|
36 | + public function getInternalPath(); |
|
37 | 37 | |
38 | - /** |
|
39 | - * @return string |
|
40 | - * @since 13.0.0 |
|
41 | - */ |
|
42 | - public function getPath(); |
|
38 | + /** |
|
39 | + * @return string |
|
40 | + * @since 13.0.0 |
|
41 | + */ |
|
42 | + public function getPath(); |
|
43 | 43 | } |
@@ -29,53 +29,53 @@ |
||
29 | 29 | |
30 | 30 | class Mount extends MountPoint implements MoveableMount { |
31 | 31 | |
32 | - /** |
|
33 | - * @var \OCA\Files_Sharing\External\Manager |
|
34 | - */ |
|
35 | - protected $manager; |
|
32 | + /** |
|
33 | + * @var \OCA\Files_Sharing\External\Manager |
|
34 | + */ |
|
35 | + protected $manager; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @param string|\OC\Files\Storage\Storage $storage |
|
39 | - * @param string $mountpoint |
|
40 | - * @param array $options |
|
41 | - * @param \OCA\Files_Sharing\External\Manager $manager |
|
42 | - * @param \OC\Files\Storage\StorageFactory $loader |
|
43 | - */ |
|
44 | - public function __construct($storage, $mountpoint, $options, $manager, $loader = null) { |
|
45 | - parent::__construct($storage, $mountpoint, $options, $loader); |
|
46 | - $this->manager = $manager; |
|
47 | - } |
|
37 | + /** |
|
38 | + * @param string|\OC\Files\Storage\Storage $storage |
|
39 | + * @param string $mountpoint |
|
40 | + * @param array $options |
|
41 | + * @param \OCA\Files_Sharing\External\Manager $manager |
|
42 | + * @param \OC\Files\Storage\StorageFactory $loader |
|
43 | + */ |
|
44 | + public function __construct($storage, $mountpoint, $options, $manager, $loader = null) { |
|
45 | + parent::__construct($storage, $mountpoint, $options, $loader); |
|
46 | + $this->manager = $manager; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Move the mount point to $target |
|
51 | - * |
|
52 | - * @param string $target the target mount point |
|
53 | - * @return bool |
|
54 | - */ |
|
55 | - public function moveMount($target) { |
|
56 | - $result = $this->manager->setMountPoint($this->mountPoint, $target); |
|
57 | - $this->setMountPoint($target); |
|
49 | + /** |
|
50 | + * Move the mount point to $target |
|
51 | + * |
|
52 | + * @param string $target the target mount point |
|
53 | + * @return bool |
|
54 | + */ |
|
55 | + public function moveMount($target) { |
|
56 | + $result = $this->manager->setMountPoint($this->mountPoint, $target); |
|
57 | + $this->setMountPoint($target); |
|
58 | 58 | |
59 | - return $result; |
|
60 | - } |
|
59 | + return $result; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Remove the mount points |
|
64 | - * |
|
65 | - * @return mixed |
|
66 | - * @return bool |
|
67 | - */ |
|
68 | - public function removeMount() { |
|
69 | - return $this->manager->removeShare($this->mountPoint); |
|
70 | - } |
|
62 | + /** |
|
63 | + * Remove the mount points |
|
64 | + * |
|
65 | + * @return mixed |
|
66 | + * @return bool |
|
67 | + */ |
|
68 | + public function removeMount() { |
|
69 | + return $this->manager->removeShare($this->mountPoint); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * Get the type of mount point, used to distinguish things like shares and external storages |
|
74 | - * in the web interface |
|
75 | - * |
|
76 | - * @return string |
|
77 | - */ |
|
78 | - public function getMountType() { |
|
79 | - return 'shared'; |
|
80 | - } |
|
72 | + /** |
|
73 | + * Get the type of mount point, used to distinguish things like shares and external storages |
|
74 | + * in the web interface |
|
75 | + * |
|
76 | + * @return string |
|
77 | + */ |
|
78 | + public function getMountType() { |
|
79 | + return 'shared'; |
|
80 | + } |
|
81 | 81 | } |
@@ -25,81 +25,81 @@ |
||
25 | 25 | |
26 | 26 | class DatabaseSchemaChecker { |
27 | 27 | |
28 | - /** |
|
29 | - * @param string $appId |
|
30 | - * @return array |
|
31 | - */ |
|
32 | - public function analyse($appId) { |
|
33 | - $appPath = \OC_App::getAppPath($appId); |
|
34 | - if ($appPath === false) { |
|
35 | - throw new \RuntimeException("No app with given id <$appId> known."); |
|
36 | - } |
|
37 | - |
|
38 | - if (!file_exists($appPath . '/appinfo/database.xml')) { |
|
39 | - return ['errors' => [], 'warnings' => []]; |
|
40 | - } |
|
41 | - |
|
42 | - libxml_use_internal_errors(true); |
|
43 | - $loadEntities = libxml_disable_entity_loader(false); |
|
44 | - $xml = simplexml_load_file($appPath . '/appinfo/database.xml'); |
|
45 | - libxml_disable_entity_loader($loadEntities); |
|
46 | - |
|
47 | - |
|
48 | - $errors = $warnings = []; |
|
49 | - |
|
50 | - foreach ($xml->table as $table) { |
|
51 | - // Table names |
|
52 | - if (strpos((string)$table->name, '*dbprefix*') !== 0) { |
|
53 | - $errors[] = 'Database schema error: name of table ' . (string)$table->name . ' does not start with *dbprefix*'; |
|
54 | - } |
|
55 | - $tableName = substr((string)$table->name, strlen('*dbprefix*')); |
|
56 | - if (strpos($tableName, '*dbprefix*') !== false) { |
|
57 | - $warnings[] = 'Database schema warning: *dbprefix* should only appear once in name of table ' . (string)$table->name; |
|
58 | - } |
|
59 | - |
|
60 | - if (strlen($tableName) > 27) { |
|
61 | - $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
62 | - } |
|
63 | - |
|
64 | - $hasAutoIncrement = false; |
|
65 | - |
|
66 | - // Column names |
|
67 | - foreach ($table->declaration->field as $column) { |
|
68 | - if (strpos((string)$column->name, '*dbprefix*') !== false) { |
|
69 | - $warnings[] = 'Database schema warning: *dbprefix* should not appear in name of column ' . (string)$column->name . ' on table ' . (string)$table->name; |
|
70 | - } |
|
71 | - |
|
72 | - if (strlen((string)$column->name) > 30) { |
|
73 | - $errors[] = 'Database schema error: Name of column ' . (string)$column->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 30 characters allowed'; |
|
74 | - } |
|
75 | - |
|
76 | - if ($column->autoincrement) { |
|
77 | - if ($hasAutoIncrement) { |
|
78 | - $errors[] = 'Database schema error: Table ' . (string)$table->name . ' has multiple autoincrement columns'; |
|
79 | - } |
|
80 | - |
|
81 | - if (strlen($tableName) > 21) { |
|
82 | - $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
83 | - } |
|
84 | - |
|
85 | - $hasAutoIncrement = true; |
|
86 | - } |
|
87 | - } |
|
88 | - |
|
89 | - // Index names |
|
90 | - foreach ($table->declaration->index as $index) { |
|
91 | - $hasPrefix = strpos((string)$index->name, '*dbprefix*'); |
|
92 | - if ($hasPrefix !== false && $hasPrefix !== 0) { |
|
93 | - $warnings[] = 'Database schema warning: *dbprefix* should only appear at the beginning in name of index ' . (string)$index->name . ' on table ' . (string)$table->name; |
|
94 | - } |
|
95 | - |
|
96 | - $indexName = $hasPrefix === 0 ? substr((string)$index->name, strlen('*dbprefix*')) : (string)$index->name; |
|
97 | - if (strlen($indexName) > 27) { |
|
98 | - $errors[] = 'Database schema error: Name of index ' . (string)$index->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters + *dbprefix* allowed'; |
|
99 | - } |
|
100 | - } |
|
101 | - } |
|
102 | - |
|
103 | - return ['errors' => $errors, 'warnings' => $warnings]; |
|
104 | - } |
|
28 | + /** |
|
29 | + * @param string $appId |
|
30 | + * @return array |
|
31 | + */ |
|
32 | + public function analyse($appId) { |
|
33 | + $appPath = \OC_App::getAppPath($appId); |
|
34 | + if ($appPath === false) { |
|
35 | + throw new \RuntimeException("No app with given id <$appId> known."); |
|
36 | + } |
|
37 | + |
|
38 | + if (!file_exists($appPath . '/appinfo/database.xml')) { |
|
39 | + return ['errors' => [], 'warnings' => []]; |
|
40 | + } |
|
41 | + |
|
42 | + libxml_use_internal_errors(true); |
|
43 | + $loadEntities = libxml_disable_entity_loader(false); |
|
44 | + $xml = simplexml_load_file($appPath . '/appinfo/database.xml'); |
|
45 | + libxml_disable_entity_loader($loadEntities); |
|
46 | + |
|
47 | + |
|
48 | + $errors = $warnings = []; |
|
49 | + |
|
50 | + foreach ($xml->table as $table) { |
|
51 | + // Table names |
|
52 | + if (strpos((string)$table->name, '*dbprefix*') !== 0) { |
|
53 | + $errors[] = 'Database schema error: name of table ' . (string)$table->name . ' does not start with *dbprefix*'; |
|
54 | + } |
|
55 | + $tableName = substr((string)$table->name, strlen('*dbprefix*')); |
|
56 | + if (strpos($tableName, '*dbprefix*') !== false) { |
|
57 | + $warnings[] = 'Database schema warning: *dbprefix* should only appear once in name of table ' . (string)$table->name; |
|
58 | + } |
|
59 | + |
|
60 | + if (strlen($tableName) > 27) { |
|
61 | + $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
62 | + } |
|
63 | + |
|
64 | + $hasAutoIncrement = false; |
|
65 | + |
|
66 | + // Column names |
|
67 | + foreach ($table->declaration->field as $column) { |
|
68 | + if (strpos((string)$column->name, '*dbprefix*') !== false) { |
|
69 | + $warnings[] = 'Database schema warning: *dbprefix* should not appear in name of column ' . (string)$column->name . ' on table ' . (string)$table->name; |
|
70 | + } |
|
71 | + |
|
72 | + if (strlen((string)$column->name) > 30) { |
|
73 | + $errors[] = 'Database schema error: Name of column ' . (string)$column->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 30 characters allowed'; |
|
74 | + } |
|
75 | + |
|
76 | + if ($column->autoincrement) { |
|
77 | + if ($hasAutoIncrement) { |
|
78 | + $errors[] = 'Database schema error: Table ' . (string)$table->name . ' has multiple autoincrement columns'; |
|
79 | + } |
|
80 | + |
|
81 | + if (strlen($tableName) > 21) { |
|
82 | + $errors[] = 'Database schema error: Name of table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters (21 characters for tables with autoincrement) + *dbprefix* allowed'; |
|
83 | + } |
|
84 | + |
|
85 | + $hasAutoIncrement = true; |
|
86 | + } |
|
87 | + } |
|
88 | + |
|
89 | + // Index names |
|
90 | + foreach ($table->declaration->index as $index) { |
|
91 | + $hasPrefix = strpos((string)$index->name, '*dbprefix*'); |
|
92 | + if ($hasPrefix !== false && $hasPrefix !== 0) { |
|
93 | + $warnings[] = 'Database schema warning: *dbprefix* should only appear at the beginning in name of index ' . (string)$index->name . ' on table ' . (string)$table->name; |
|
94 | + } |
|
95 | + |
|
96 | + $indexName = $hasPrefix === 0 ? substr((string)$index->name, strlen('*dbprefix*')) : (string)$index->name; |
|
97 | + if (strlen($indexName) > 27) { |
|
98 | + $errors[] = 'Database schema error: Name of index ' . (string)$index->name . ' on table ' . (string)$table->name . ' is too long (' . strlen($tableName) . '), max. 27 characters + *dbprefix* allowed'; |
|
99 | + } |
|
100 | + } |
|
101 | + } |
|
102 | + |
|
103 | + return ['errors' => $errors, 'warnings' => $warnings]; |
|
104 | + } |
|
105 | 105 | } |
@@ -33,26 +33,26 @@ |
||
33 | 33 | * @package OC\Security\RateLimiting\Backend |
34 | 34 | */ |
35 | 35 | interface IBackend { |
36 | - /** |
|
37 | - * Gets the amount of attempts within the last specified seconds |
|
38 | - * |
|
39 | - * @param string $methodIdentifier Identifier for the method |
|
40 | - * @param string $userIdentifier Identifier for the user |
|
41 | - * @param int $seconds Seconds to look back at |
|
42 | - * @return int |
|
43 | - */ |
|
44 | - public function getAttempts(string $methodIdentifier, |
|
45 | - string $userIdentifier, |
|
46 | - int $seconds): int; |
|
36 | + /** |
|
37 | + * Gets the amount of attempts within the last specified seconds |
|
38 | + * |
|
39 | + * @param string $methodIdentifier Identifier for the method |
|
40 | + * @param string $userIdentifier Identifier for the user |
|
41 | + * @param int $seconds Seconds to look back at |
|
42 | + * @return int |
|
43 | + */ |
|
44 | + public function getAttempts(string $methodIdentifier, |
|
45 | + string $userIdentifier, |
|
46 | + int $seconds): int; |
|
47 | 47 | |
48 | - /** |
|
49 | - * Registers an attempt |
|
50 | - * |
|
51 | - * @param string $methodIdentifier Identifier for the method |
|
52 | - * @param string $userIdentifier Identifier for the user |
|
53 | - * @param int $period Period in seconds how long this attempt should be stored |
|
54 | - */ |
|
55 | - public function registerAttempt(string $methodIdentifier, |
|
56 | - string $userIdentifier, |
|
57 | - int $period); |
|
48 | + /** |
|
49 | + * Registers an attempt |
|
50 | + * |
|
51 | + * @param string $methodIdentifier Identifier for the method |
|
52 | + * @param string $userIdentifier Identifier for the user |
|
53 | + * @param int $period Period in seconds how long this attempt should be stored |
|
54 | + */ |
|
55 | + public function registerAttempt(string $methodIdentifier, |
|
56 | + string $userIdentifier, |
|
57 | + int $period); |
|
58 | 58 | } |
@@ -23,19 +23,19 @@ |
||
23 | 23 | // WARNING: this should be moved to proper AppFramework handling |
24 | 24 | // Check if we are a user |
25 | 25 | if (!\OC::$server->getUserSession()->isLoggedIn()) { |
26 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute( |
|
27 | - 'core.login.showLoginForm', |
|
28 | - [ |
|
29 | - 'redirect_url' => \OC::$server->getRequest()->getRequestUri(), |
|
30 | - ] |
|
31 | - ) |
|
32 | - ); |
|
33 | - exit(); |
|
26 | + header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute( |
|
27 | + 'core.login.showLoginForm', |
|
28 | + [ |
|
29 | + 'redirect_url' => \OC::$server->getRequest()->getRequestUri(), |
|
30 | + ] |
|
31 | + ) |
|
32 | + ); |
|
33 | + exit(); |
|
34 | 34 | } |
35 | 35 | // Redirect to 2FA challenge selection if 2FA challenge was not solved yet |
36 | 36 | if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { |
37 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
38 | - exit(); |
|
37 | + header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
38 | + exit(); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $tmpl = new OCP\Template('systemtags', 'list', ''); |