@@ -68,7 +68,7 @@ |
||
68 | 68 | |
69 | 69 | $query = $this->connection->getQueryBuilder(); |
70 | 70 | $query->update('share') |
71 | - ->set('share_type', $query->createNamedParameter(Share::SHARE_TYPE_GUEST)) |
|
71 | + ->set('share_type', $query->createNamedParameter(Share::SHARE_TYPE_GUEST)) |
|
72 | 72 | ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_EMAIL))); |
73 | 73 | $query->execute(); |
74 | 74 | } |
@@ -36,47 +36,47 @@ |
||
36 | 36 | */ |
37 | 37 | class OwncloudGuestShareType implements IRepairStep { |
38 | 38 | |
39 | - /** @var IDBConnection */ |
|
40 | - private $connection; |
|
39 | + /** @var IDBConnection */ |
|
40 | + private $connection; |
|
41 | 41 | |
42 | - /** @var IConfig */ |
|
43 | - private $config; |
|
42 | + /** @var IConfig */ |
|
43 | + private $config; |
|
44 | 44 | |
45 | 45 | |
46 | - public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | - $this->connection = $connection; |
|
48 | - $this->config = $config; |
|
49 | - } |
|
46 | + public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | + $this->connection = $connection; |
|
48 | + $this->config = $config; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Returns the step's name |
|
53 | - * |
|
54 | - * @return string |
|
55 | - * @since 9.1.0 |
|
56 | - */ |
|
57 | - public function getName() { |
|
58 | - return 'Fix the share type of guest shares when migrating from ownCloud'; |
|
59 | - } |
|
51 | + /** |
|
52 | + * Returns the step's name |
|
53 | + * |
|
54 | + * @return string |
|
55 | + * @since 9.1.0 |
|
56 | + */ |
|
57 | + public function getName() { |
|
58 | + return 'Fix the share type of guest shares when migrating from ownCloud'; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @param IOutput $output |
|
63 | - */ |
|
64 | - public function run(IOutput $output) { |
|
65 | - if (!$this->shouldRun()) { |
|
66 | - return; |
|
67 | - } |
|
61 | + /** |
|
62 | + * @param IOutput $output |
|
63 | + */ |
|
64 | + public function run(IOutput $output) { |
|
65 | + if (!$this->shouldRun()) { |
|
66 | + return; |
|
67 | + } |
|
68 | 68 | |
69 | - $query = $this->connection->getQueryBuilder(); |
|
70 | - $query->update('share') |
|
71 | - ->set('share_type', $query->createNamedParameter(Share::SHARE_TYPE_GUEST)) |
|
72 | - ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_EMAIL))); |
|
73 | - $query->execute(); |
|
74 | - } |
|
69 | + $query = $this->connection->getQueryBuilder(); |
|
70 | + $query->update('share') |
|
71 | + ->set('share_type', $query->createNamedParameter(Share::SHARE_TYPE_GUEST)) |
|
72 | + ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_EMAIL))); |
|
73 | + $query->execute(); |
|
74 | + } |
|
75 | 75 | |
76 | - protected function shouldRun() { |
|
77 | - $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
78 | - return $appVersion === '0.10.0' || |
|
79 | - $this->config->getAppValue('core', 'vendor', '') === 'owncloud'; |
|
80 | - } |
|
76 | + protected function shouldRun() { |
|
77 | + $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
78 | + return $appVersion === '0.10.0' || |
|
79 | + $this->config->getAppValue('core', 'vendor', '') === 'owncloud'; |
|
80 | + } |
|
81 | 81 | |
82 | 82 | } |
@@ -36,62 +36,62 @@ |
||
36 | 36 | */ |
37 | 37 | class SetPasswordColumn implements IRepairStep { |
38 | 38 | |
39 | - /** @var IDBConnection */ |
|
40 | - private $connection; |
|
41 | - |
|
42 | - /** @var IConfig */ |
|
43 | - private $config; |
|
44 | - |
|
45 | - |
|
46 | - public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | - $this->connection = $connection; |
|
48 | - $this->config = $config; |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * Returns the step's name |
|
53 | - * |
|
54 | - * @return string |
|
55 | - * @since 9.1.0 |
|
56 | - */ |
|
57 | - public function getName() { |
|
58 | - return 'Copy the share password into the dedicated column'; |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * @param IOutput $output |
|
63 | - */ |
|
64 | - public function run(IOutput $output) { |
|
65 | - if (!$this->shouldRun()) { |
|
66 | - return; |
|
67 | - } |
|
68 | - |
|
69 | - $query = $this->connection->getQueryBuilder(); |
|
70 | - $query |
|
71 | - ->update('share') |
|
72 | - ->set('password', 'share_with') |
|
73 | - ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_LINK))) |
|
74 | - ->andWhere($query->expr()->isNotNull('share_with')); |
|
75 | - $result = $query->execute(); |
|
76 | - |
|
77 | - if ($result === 0) { |
|
78 | - // No link updated, no need to run the second query |
|
79 | - return; |
|
80 | - } |
|
81 | - |
|
82 | - $clearQuery = $this->connection->getQueryBuilder(); |
|
83 | - $clearQuery |
|
84 | - ->update('share') |
|
85 | - ->set('share_with', $clearQuery->createNamedParameter(null)) |
|
86 | - ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(Share::SHARE_TYPE_LINK))); |
|
87 | - |
|
88 | - $clearQuery->execute(); |
|
89 | - |
|
90 | - } |
|
91 | - |
|
92 | - protected function shouldRun() { |
|
93 | - $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
94 | - return version_compare($appVersion, '1.4.0', '<'); |
|
95 | - } |
|
39 | + /** @var IDBConnection */ |
|
40 | + private $connection; |
|
41 | + |
|
42 | + /** @var IConfig */ |
|
43 | + private $config; |
|
44 | + |
|
45 | + |
|
46 | + public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | + $this->connection = $connection; |
|
48 | + $this->config = $config; |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * Returns the step's name |
|
53 | + * |
|
54 | + * @return string |
|
55 | + * @since 9.1.0 |
|
56 | + */ |
|
57 | + public function getName() { |
|
58 | + return 'Copy the share password into the dedicated column'; |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * @param IOutput $output |
|
63 | + */ |
|
64 | + public function run(IOutput $output) { |
|
65 | + if (!$this->shouldRun()) { |
|
66 | + return; |
|
67 | + } |
|
68 | + |
|
69 | + $query = $this->connection->getQueryBuilder(); |
|
70 | + $query |
|
71 | + ->update('share') |
|
72 | + ->set('password', 'share_with') |
|
73 | + ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_LINK))) |
|
74 | + ->andWhere($query->expr()->isNotNull('share_with')); |
|
75 | + $result = $query->execute(); |
|
76 | + |
|
77 | + if ($result === 0) { |
|
78 | + // No link updated, no need to run the second query |
|
79 | + return; |
|
80 | + } |
|
81 | + |
|
82 | + $clearQuery = $this->connection->getQueryBuilder(); |
|
83 | + $clearQuery |
|
84 | + ->update('share') |
|
85 | + ->set('share_with', $clearQuery->createNamedParameter(null)) |
|
86 | + ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(Share::SHARE_TYPE_LINK))); |
|
87 | + |
|
88 | + $clearQuery->execute(); |
|
89 | + |
|
90 | + } |
|
91 | + |
|
92 | + protected function shouldRun() { |
|
93 | + $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
94 | + return version_compare($appVersion, '1.4.0', '<'); |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * ubos-raspberry-pi.local and ubos-raspberry-pi-2.local |
68 | 68 | */ |
69 | 69 | 'trusted_domains' => |
70 | - array ( |
|
70 | + array( |
|
71 | 71 | 'demo.example.org', |
72 | 72 | 'otherdomain.example.org', |
73 | 73 | ), |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * |
193 | 193 | * Defaults to ``60*60*24*15`` seconds (15 days) |
194 | 194 | */ |
195 | -'remember_login_cookie_lifetime' => 60*60*24*15, |
|
195 | +'remember_login_cookie_lifetime' => 60 * 60 * 24 * 15, |
|
196 | 196 | |
197 | 197 | /** |
198 | 198 | * The lifetime of a session after inactivity. |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | * See https://redis.io/topics/cluster-spec for details about the Redis cluster |
1075 | 1075 | */ |
1076 | 1076 | 'redis.cluster' => [ |
1077 | - 'seeds' => [ // provide some/all of the cluster servers to bootstrap discovery, port required |
|
1077 | + 'seeds' => [// provide some/all of the cluster servers to bootstrap discovery, port required |
|
1078 | 1078 | 'localhost:7000', |
1079 | 1079 | 'localhost:7001' |
1080 | 1080 | ], |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | * |
1139 | 1139 | * Defaults to ``60*60*24`` (1 day) |
1140 | 1140 | */ |
1141 | -'cache_chunk_gc_ttl' => 60*60*24, |
|
1141 | +'cache_chunk_gc_ttl' => 60 * 60 * 24, |
|
1142 | 1142 | |
1143 | 1143 | /** |
1144 | 1144 | * Using Object Store with Nextcloud |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | * Defaults to ``60*60`` seconds (1 hour) or the php |
1463 | 1463 | * max_execution_time, whichever is higher. |
1464 | 1464 | */ |
1465 | -'filelocking.ttl' => 60*60, |
|
1465 | +'filelocking.ttl' => 60 * 60, |
|
1466 | 1466 | |
1467 | 1467 | /** |
1468 | 1468 | * Memory caching backend for file locking |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | */ |
42 | 42 | 'instanceid' => '', |
43 | 43 | |
44 | - /** |
|
45 | - * The salt used to hash all passwords, auto-generated by the Nextcloud |
|
46 | - * installer. (There are also per-user salts.) If you lose this salt you lose |
|
47 | - * all your passwords. This example is for documentation only, and you should |
|
48 | - * never use it. |
|
49 | - * |
|
50 | - * @deprecated This salt is deprecated and only used for legacy-compatibility, |
|
51 | - * developers should *NOT* use this value for anything nowadays. |
|
52 | - * |
|
53 | - * 'passwordsalt' => 'd3c944a9af095aa08f', |
|
54 | - */ |
|
44 | + /** |
|
45 | + * The salt used to hash all passwords, auto-generated by the Nextcloud |
|
46 | + * installer. (There are also per-user salts.) If you lose this salt you lose |
|
47 | + * all your passwords. This example is for documentation only, and you should |
|
48 | + * never use it. |
|
49 | + * |
|
50 | + * @deprecated This salt is deprecated and only used for legacy-compatibility, |
|
51 | + * developers should *NOT* use this value for anything nowadays. |
|
52 | + * |
|
53 | + * 'passwordsalt' => 'd3c944a9af095aa08f', |
|
54 | + */ |
|
55 | 55 | 'passwordsalt' => '', |
56 | 56 | |
57 | 57 | /** |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * ubos-raspberry-pi.local and ubos-raspberry-pi-2.local |
68 | 68 | */ |
69 | 69 | 'trusted_domains' => |
70 | - array ( |
|
70 | + array ( |
|
71 | 71 | 'demo.example.org', |
72 | 72 | 'otherdomain.example.org', |
73 | - ), |
|
73 | + ), |
|
74 | 74 | |
75 | 75 | |
76 | 76 | /** |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | * IMAP (OC_User_IMAP), SMB (OC_User_SMB), and FTP (OC_User_FTP). |
261 | 261 | */ |
262 | 262 | 'user_backends' => array( |
263 | - array( |
|
264 | - 'class' => 'OC_User_IMAP', |
|
265 | - 'arguments' => array('{imap.gmail.com:993/imap/ssl}INBOX') |
|
266 | - ) |
|
263 | + array( |
|
264 | + 'class' => 'OC_User_IMAP', |
|
265 | + 'arguments' => array('{imap.gmail.com:993/imap/ssl}INBOX') |
|
266 | + ) |
|
267 | 267 | ), |
268 | 268 | |
269 | 269 | /** |
@@ -736,9 +736,9 @@ discard block |
||
736 | 736 | * Defaults to an empty array. |
737 | 737 | */ |
738 | 738 | 'log.condition' => [ |
739 | - 'shared_secret' => '57b58edb6637fe3059b3595cf9c41b9', |
|
740 | - 'users' => ['sample-user'], |
|
741 | - 'apps' => ['files'], |
|
739 | + 'shared_secret' => '57b58edb6637fe3059b3595cf9c41b9', |
|
740 | + 'users' => ['sample-user'], |
|
741 | + 'apps' => ['files'], |
|
742 | 742 | ], |
743 | 743 | |
744 | 744 | /** |
@@ -792,18 +792,18 @@ discard block |
||
792 | 792 | * *iOS client app id: ``1125420102`` |
793 | 793 | */ |
794 | 794 | 'customclient_desktop' => |
795 | - 'https://nextcloud.com/install/#install-clients', |
|
795 | + 'https://nextcloud.com/install/#install-clients', |
|
796 | 796 | 'customclient_android' => |
797 | - 'https://play.google.com/store/apps/details?id=com.nextcloud.client', |
|
797 | + 'https://play.google.com/store/apps/details?id=com.nextcloud.client', |
|
798 | 798 | 'customclient_ios' => |
799 | - 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8', |
|
799 | + 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8', |
|
800 | 800 | 'customclient_ios_appid' => |
801 | - '1125420102', |
|
801 | + '1125420102', |
|
802 | 802 | /** |
803 | - * Apps |
|
804 | - * |
|
805 | - * Options for the Apps folder, Apps store, and App code checker. |
|
806 | - */ |
|
803 | + * Apps |
|
804 | + * |
|
805 | + * Options for the Apps folder, Apps store, and App code checker. |
|
806 | + */ |
|
807 | 807 | |
808 | 808 | /** |
809 | 809 | * When enabled, admins may install apps from the Nextcloud app store. |
@@ -821,11 +821,11 @@ discard block |
||
821 | 821 | * indicates if a Web server can write files to that folder. |
822 | 822 | */ |
823 | 823 | 'apps_paths' => array( |
824 | - array( |
|
825 | - 'path'=> '/var/www/nextcloud/apps', |
|
826 | - 'url' => '/apps', |
|
827 | - 'writable' => true, |
|
828 | - ), |
|
824 | + array( |
|
825 | + 'path'=> '/var/www/nextcloud/apps', |
|
826 | + 'url' => '/apps', |
|
827 | + 'writable' => true, |
|
828 | + ), |
|
829 | 829 | ), |
830 | 830 | |
831 | 831 | /** |
@@ -890,8 +890,8 @@ discard block |
||
890 | 890 | * Defaults to ``''`` (empty string) |
891 | 891 | */ |
892 | 892 | 'preview_office_cl_parameters' => |
893 | - ' --headless --nologo --nofirststartwizard --invisible --norestore '. |
|
894 | - '--convert-to pdf --outdir ', |
|
893 | + ' --headless --nologo --nofirststartwizard --invisible --norestore '. |
|
894 | + '--convert-to pdf --outdir ', |
|
895 | 895 | |
896 | 896 | /** |
897 | 897 | * Only register providers that have been explicitly enabled |
@@ -934,14 +934,14 @@ discard block |
||
934 | 934 | * - OC\Preview\XBitmap |
935 | 935 | */ |
936 | 936 | 'enabledPreviewProviders' => array( |
937 | - 'OC\Preview\PNG', |
|
938 | - 'OC\Preview\JPEG', |
|
939 | - 'OC\Preview\GIF', |
|
940 | - 'OC\Preview\BMP', |
|
941 | - 'OC\Preview\XBitmap', |
|
942 | - 'OC\Preview\MP3', |
|
943 | - 'OC\Preview\TXT', |
|
944 | - 'OC\Preview\MarkDown' |
|
937 | + 'OC\Preview\PNG', |
|
938 | + 'OC\Preview\JPEG', |
|
939 | + 'OC\Preview\GIF', |
|
940 | + 'OC\Preview\BMP', |
|
941 | + 'OC\Preview\XBitmap', |
|
942 | + 'OC\Preview\MP3', |
|
943 | + 'OC\Preview\TXT', |
|
944 | + 'OC\Preview\MarkDown' |
|
945 | 945 | ), |
946 | 946 | |
947 | 947 | /** |
@@ -1017,11 +1017,11 @@ discard block |
||
1017 | 1017 | |
1018 | 1018 | /** |
1019 | 1019 | * Extra SSL options to be used for configuration. |
1020 | - * |
|
1020 | + * |
|
1021 | 1021 | * Defaults to an empty array. |
1022 | 1022 | */ |
1023 | 1023 | 'openssl' => array( |
1024 | - 'config' => '/absolute/location/of/openssl.cnf', |
|
1024 | + 'config' => '/absolute/location/of/openssl.cnf', |
|
1025 | 1025 | ), |
1026 | 1026 | |
1027 | 1027 | /** |
@@ -1070,11 +1070,11 @@ discard block |
||
1070 | 1070 | * for more information. |
1071 | 1071 | */ |
1072 | 1072 | 'redis' => [ |
1073 | - 'host' => 'localhost', // can also be a unix domain socket: '/tmp/redis.sock' |
|
1074 | - 'port' => 6379, |
|
1075 | - 'timeout' => 0.0, |
|
1076 | - 'password' => '', // Optional, if not defined no password will be used. |
|
1077 | - 'dbindex' => 0, // Optional, if undefined SELECT will not run and will use Redis Server's default DB Index. |
|
1073 | + 'host' => 'localhost', // can also be a unix domain socket: '/tmp/redis.sock' |
|
1074 | + 'port' => 6379, |
|
1075 | + 'timeout' => 0.0, |
|
1076 | + 'password' => '', // Optional, if not defined no password will be used. |
|
1077 | + 'dbindex' => 0, // Optional, if undefined SELECT will not run and will use Redis Server's default DB Index. |
|
1078 | 1078 | ], |
1079 | 1079 | |
1080 | 1080 | /** |
@@ -1100,13 +1100,13 @@ discard block |
||
1100 | 1100 | * See https://redis.io/topics/cluster-spec for details about the Redis cluster |
1101 | 1101 | */ |
1102 | 1102 | 'redis.cluster' => [ |
1103 | - 'seeds' => [ // provide some/all of the cluster servers to bootstrap discovery, port required |
|
1104 | - 'localhost:7000', |
|
1105 | - 'localhost:7001' |
|
1106 | - ], |
|
1107 | - 'timeout' => 0.0, |
|
1108 | - 'read_timeout' => 0.0, |
|
1109 | - 'failover_mode' => \RedisCluster::FAILOVER_ERROR |
|
1103 | + 'seeds' => [ // provide some/all of the cluster servers to bootstrap discovery, port required |
|
1104 | + 'localhost:7000', |
|
1105 | + 'localhost:7001' |
|
1106 | + ], |
|
1107 | + 'timeout' => 0.0, |
|
1108 | + 'read_timeout' => 0.0, |
|
1109 | + 'failover_mode' => \RedisCluster::FAILOVER_ERROR |
|
1110 | 1110 | ], |
1111 | 1111 | |
1112 | 1112 | |
@@ -1114,35 +1114,35 @@ discard block |
||
1114 | 1114 | * Server details for one or more memcached servers to use for memory caching. |
1115 | 1115 | */ |
1116 | 1116 | 'memcached_servers' => array( |
1117 | - // hostname, port and optional weight. Also see: |
|
1118 | - // http://www.php.net/manual/en/memcached.addservers.php |
|
1119 | - // http://www.php.net/manual/en/memcached.addserver.php |
|
1120 | - array('localhost', 11211), |
|
1121 | - //array('other.host.local', 11211), |
|
1117 | + // hostname, port and optional weight. Also see: |
|
1118 | + // http://www.php.net/manual/en/memcached.addservers.php |
|
1119 | + // http://www.php.net/manual/en/memcached.addserver.php |
|
1120 | + array('localhost', 11211), |
|
1121 | + //array('other.host.local', 11211), |
|
1122 | 1122 | ), |
1123 | 1123 | |
1124 | 1124 | /** |
1125 | 1125 | * Connection options for memcached, see http://apprize.info/php/scaling/15.html |
1126 | 1126 | */ |
1127 | 1127 | 'memcached_options' => array( |
1128 | - // Set timeouts to 50ms |
|
1129 | - \Memcached::OPT_CONNECT_TIMEOUT => 50, |
|
1130 | - \Memcached::OPT_RETRY_TIMEOUT => 50, |
|
1131 | - \Memcached::OPT_SEND_TIMEOUT => 50, |
|
1132 | - \Memcached::OPT_RECV_TIMEOUT => 50, |
|
1133 | - \Memcached::OPT_POLL_TIMEOUT => 50, |
|
1128 | + // Set timeouts to 50ms |
|
1129 | + \Memcached::OPT_CONNECT_TIMEOUT => 50, |
|
1130 | + \Memcached::OPT_RETRY_TIMEOUT => 50, |
|
1131 | + \Memcached::OPT_SEND_TIMEOUT => 50, |
|
1132 | + \Memcached::OPT_RECV_TIMEOUT => 50, |
|
1133 | + \Memcached::OPT_POLL_TIMEOUT => 50, |
|
1134 | 1134 | |
1135 | - // Enable compression |
|
1136 | - \Memcached::OPT_COMPRESSION => true, |
|
1135 | + // Enable compression |
|
1136 | + \Memcached::OPT_COMPRESSION => true, |
|
1137 | 1137 | |
1138 | - // Turn on consistent hashing |
|
1139 | - \Memcached::OPT_LIBKETAMA_COMPATIBLE => true, |
|
1138 | + // Turn on consistent hashing |
|
1139 | + \Memcached::OPT_LIBKETAMA_COMPATIBLE => true, |
|
1140 | 1140 | |
1141 | - // Enable Binary Protocol |
|
1142 | - \Memcached::OPT_BINARY_PROTOCOL => true, |
|
1141 | + // Enable Binary Protocol |
|
1142 | + \Memcached::OPT_BINARY_PROTOCOL => true, |
|
1143 | 1143 | |
1144 | - // Binary serializer vill be enabled if the igbinary PECL module is available |
|
1145 | - //\Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_IGBINARY, |
|
1144 | + // Binary serializer vill be enabled if the igbinary PECL module is available |
|
1145 | + //\Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_IGBINARY, |
|
1146 | 1146 | ), |
1147 | 1147 | |
1148 | 1148 | |
@@ -1188,61 +1188,61 @@ discard block |
||
1188 | 1188 | * One way to test is applying for a trystack account at http://trystack.org/ |
1189 | 1189 | */ |
1190 | 1190 | 'objectstore' => [ |
1191 | - 'class' => 'OC\\Files\\ObjectStore\\Swift', |
|
1192 | - 'arguments' => [ |
|
1193 | - // trystack will use your facebook id as the user name |
|
1194 | - 'username' => 'facebook100000123456789', |
|
1195 | - // in the trystack dashboard go to user -> settings -> API Password to |
|
1196 | - // generate a password |
|
1197 | - 'password' => 'Secr3tPaSSWoRdt7', |
|
1198 | - // must already exist in the objectstore, name can be different |
|
1199 | - 'container' => 'nextcloud', |
|
1200 | - // prefix to prepend to the fileid, default is 'oid:urn:' |
|
1201 | - 'objectPrefix' => 'oid:urn:', |
|
1202 | - // create the container if it does not exist. default is false |
|
1203 | - 'autocreate' => true, |
|
1204 | - // required, dev-/trystack defaults to 'RegionOne' |
|
1205 | - 'region' => 'RegionOne', |
|
1206 | - // The Identity / Keystone endpoint |
|
1207 | - 'url' => 'http://8.21.28.222:5000/v2.0', |
|
1208 | - // required on dev-/trystack |
|
1209 | - 'tenantName' => 'facebook100000123456789', |
|
1210 | - // dev-/trystack uses swift by default, the lib defaults to 'cloudFiles' |
|
1211 | - // if omitted |
|
1212 | - 'serviceName' => 'swift', |
|
1213 | - // The Interface / url Type, optional |
|
1214 | - 'urlType' => 'internal' |
|
1215 | - ], |
|
1191 | + 'class' => 'OC\\Files\\ObjectStore\\Swift', |
|
1192 | + 'arguments' => [ |
|
1193 | + // trystack will use your facebook id as the user name |
|
1194 | + 'username' => 'facebook100000123456789', |
|
1195 | + // in the trystack dashboard go to user -> settings -> API Password to |
|
1196 | + // generate a password |
|
1197 | + 'password' => 'Secr3tPaSSWoRdt7', |
|
1198 | + // must already exist in the objectstore, name can be different |
|
1199 | + 'container' => 'nextcloud', |
|
1200 | + // prefix to prepend to the fileid, default is 'oid:urn:' |
|
1201 | + 'objectPrefix' => 'oid:urn:', |
|
1202 | + // create the container if it does not exist. default is false |
|
1203 | + 'autocreate' => true, |
|
1204 | + // required, dev-/trystack defaults to 'RegionOne' |
|
1205 | + 'region' => 'RegionOne', |
|
1206 | + // The Identity / Keystone endpoint |
|
1207 | + 'url' => 'http://8.21.28.222:5000/v2.0', |
|
1208 | + // required on dev-/trystack |
|
1209 | + 'tenantName' => 'facebook100000123456789', |
|
1210 | + // dev-/trystack uses swift by default, the lib defaults to 'cloudFiles' |
|
1211 | + // if omitted |
|
1212 | + 'serviceName' => 'swift', |
|
1213 | + // The Interface / url Type, optional |
|
1214 | + 'urlType' => 'internal' |
|
1215 | + ], |
|
1216 | 1216 | ], |
1217 | 1217 | |
1218 | 1218 | /** |
1219 | 1219 | * To use swift V3 |
1220 | 1220 | */ |
1221 | 1221 | 'objectstore' => [ |
1222 | - 'class' => 'OC\\Files\\ObjectStore\\Swift', |
|
1223 | - 'arguments' => [ |
|
1224 | - 'autocreate' => true, |
|
1225 | - 'user' => [ |
|
1226 | - 'name' => 'swift', |
|
1227 | - 'password' => 'swift', |
|
1228 | - 'domain' => [ |
|
1229 | - 'name' => 'default', |
|
1230 | - ], |
|
1231 | - ], |
|
1232 | - 'scope' => [ |
|
1233 | - 'project' => [ |
|
1234 | - 'name' => 'service', |
|
1235 | - 'domain' => [ |
|
1236 | - 'name' => 'default', |
|
1237 | - ], |
|
1238 | - ], |
|
1239 | - ], |
|
1240 | - 'tenantName' => 'service', |
|
1241 | - 'serviceName' => 'swift', |
|
1242 | - 'region' => 'regionOne', |
|
1243 | - 'url' => 'http://yourswifthost:5000/v3', |
|
1244 | - 'bucket' => 'nextcloud', |
|
1245 | - ], |
|
1222 | + 'class' => 'OC\\Files\\ObjectStore\\Swift', |
|
1223 | + 'arguments' => [ |
|
1224 | + 'autocreate' => true, |
|
1225 | + 'user' => [ |
|
1226 | + 'name' => 'swift', |
|
1227 | + 'password' => 'swift', |
|
1228 | + 'domain' => [ |
|
1229 | + 'name' => 'default', |
|
1230 | + ], |
|
1231 | + ], |
|
1232 | + 'scope' => [ |
|
1233 | + 'project' => [ |
|
1234 | + 'name' => 'service', |
|
1235 | + 'domain' => [ |
|
1236 | + 'name' => 'default', |
|
1237 | + ], |
|
1238 | + ], |
|
1239 | + ], |
|
1240 | + 'tenantName' => 'service', |
|
1241 | + 'serviceName' => 'swift', |
|
1242 | + 'region' => 'regionOne', |
|
1243 | + 'url' => 'http://yourswifthost:5000/v3', |
|
1244 | + 'bucket' => 'nextcloud', |
|
1245 | + ], |
|
1246 | 1246 | ], |
1247 | 1247 | |
1248 | 1248 | |
@@ -1282,8 +1282,8 @@ discard block |
||
1282 | 1282 | * encryption in MySQL or specify a custom wait timeout on a cheap hoster. |
1283 | 1283 | */ |
1284 | 1284 | 'dbdriveroptions' => array( |
1285 | - PDO::MYSQL_ATTR_SSL_CA => '/file/path/to/ca_cert.pem', |
|
1286 | - PDO::MYSQL_ATTR_INIT_COMMAND => 'SET wait_timeout = 28800' |
|
1285 | + PDO::MYSQL_ATTR_SSL_CA => '/file/path/to/ca_cert.pem', |
|
1286 | + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET wait_timeout = 28800' |
|
1287 | 1287 | ), |
1288 | 1288 | |
1289 | 1289 | /** |
@@ -1340,10 +1340,10 @@ discard block |
||
1340 | 1340 | * - pgsql (PostgreSQL) |
1341 | 1341 | */ |
1342 | 1342 | 'supportedDatabases' => array( |
1343 | - 'sqlite', |
|
1344 | - 'mysql', |
|
1345 | - 'pgsql', |
|
1346 | - 'oci', |
|
1343 | + 'sqlite', |
|
1344 | + 'mysql', |
|
1345 | + 'pgsql', |
|
1346 | + 'oci', |
|
1347 | 1347 | ), |
1348 | 1348 | |
1349 | 1349 | /** |
@@ -1603,8 +1603,8 @@ discard block |
||
1603 | 1603 | * WARNING: only use this if you know what you are doing |
1604 | 1604 | */ |
1605 | 1605 | 'csrf.optout' => array( |
1606 | - '/^WebDAVFS/', // OS X Finder |
|
1607 | - '/^Microsoft-WebDAV-MiniRedir/', // Windows webdav drive |
|
1606 | + '/^WebDAVFS/', // OS X Finder |
|
1607 | + '/^Microsoft-WebDAV-MiniRedir/', // Windows webdav drive |
|
1608 | 1608 | ), |
1609 | 1609 | |
1610 | 1610 | ); |
@@ -28,26 +28,26 @@ |
||
28 | 28 | use OCP\ILogger; |
29 | 29 | |
30 | 30 | class CategoryFetcher extends Fetcher { |
31 | - /** |
|
32 | - * @param Factory $appDataFactory |
|
33 | - * @param IClientService $clientService |
|
34 | - * @param ITimeFactory $timeFactory |
|
35 | - * @param IConfig $config |
|
36 | - * @param ILogger $logger |
|
37 | - */ |
|
38 | - public function __construct(Factory $appDataFactory, |
|
39 | - IClientService $clientService, |
|
40 | - ITimeFactory $timeFactory, |
|
41 | - IConfig $config, |
|
42 | - ILogger $logger) { |
|
43 | - parent::__construct( |
|
44 | - $appDataFactory, |
|
45 | - $clientService, |
|
46 | - $timeFactory, |
|
47 | - $config, |
|
48 | - $logger |
|
49 | - ); |
|
50 | - $this->fileName = 'categories.json'; |
|
51 | - $this->endpointUrl = 'https://apps.nextcloud.com/api/v1/categories.json'; |
|
52 | - } |
|
31 | + /** |
|
32 | + * @param Factory $appDataFactory |
|
33 | + * @param IClientService $clientService |
|
34 | + * @param ITimeFactory $timeFactory |
|
35 | + * @param IConfig $config |
|
36 | + * @param ILogger $logger |
|
37 | + */ |
|
38 | + public function __construct(Factory $appDataFactory, |
|
39 | + IClientService $clientService, |
|
40 | + ITimeFactory $timeFactory, |
|
41 | + IConfig $config, |
|
42 | + ILogger $logger) { |
|
43 | + parent::__construct( |
|
44 | + $appDataFactory, |
|
45 | + $clientService, |
|
46 | + $timeFactory, |
|
47 | + $config, |
|
48 | + $logger |
|
49 | + ); |
|
50 | + $this->fileName = 'categories.json'; |
|
51 | + $this->endpointUrl = 'https://apps.nextcloud.com/api/v1/categories.json'; |
|
52 | + } |
|
53 | 53 | } |
@@ -34,20 +34,20 @@ |
||
34 | 34 | * @method void setName(string $name) |
35 | 35 | */ |
36 | 36 | class Client extends Entity { |
37 | - /** @var string */ |
|
38 | - protected $name; |
|
39 | - /** @var string */ |
|
40 | - protected $redirectUri; |
|
41 | - /** @var string */ |
|
42 | - protected $clientIdentifier; |
|
43 | - /** @var string */ |
|
44 | - protected $secret; |
|
37 | + /** @var string */ |
|
38 | + protected $name; |
|
39 | + /** @var string */ |
|
40 | + protected $redirectUri; |
|
41 | + /** @var string */ |
|
42 | + protected $clientIdentifier; |
|
43 | + /** @var string */ |
|
44 | + protected $secret; |
|
45 | 45 | |
46 | - public function __construct() { |
|
47 | - $this->addType('id', 'int'); |
|
48 | - $this->addType('name', 'string'); |
|
49 | - $this->addType('redirect_uri', 'string'); |
|
50 | - $this->addType('client_identifier', 'string'); |
|
51 | - $this->addType('secret', 'string'); |
|
52 | - } |
|
46 | + public function __construct() { |
|
47 | + $this->addType('id', 'int'); |
|
48 | + $this->addType('name', 'string'); |
|
49 | + $this->addType('redirect_uri', 'string'); |
|
50 | + $this->addType('client_identifier', 'string'); |
|
51 | + $this->addType('secret', 'string'); |
|
52 | + } |
|
53 | 53 | } |
@@ -34,20 +34,20 @@ |
||
34 | 34 | * @method void setHashedCode(string $token) |
35 | 35 | */ |
36 | 36 | class AccessToken extends Entity { |
37 | - /** @var int */ |
|
38 | - protected $tokenId; |
|
39 | - /** @var int */ |
|
40 | - protected $clientId; |
|
41 | - /** @var string */ |
|
42 | - protected $hashedCode; |
|
43 | - /** @var string */ |
|
44 | - protected $encryptedToken; |
|
37 | + /** @var int */ |
|
38 | + protected $tokenId; |
|
39 | + /** @var int */ |
|
40 | + protected $clientId; |
|
41 | + /** @var string */ |
|
42 | + protected $hashedCode; |
|
43 | + /** @var string */ |
|
44 | + protected $encryptedToken; |
|
45 | 45 | |
46 | - public function __construct() { |
|
47 | - $this->addType('id', 'int'); |
|
48 | - $this->addType('token_id', 'int'); |
|
49 | - $this->addType('client_id', 'int'); |
|
50 | - $this->addType('hashed_code', 'string'); |
|
51 | - $this->addType('encrypted_token', 'string'); |
|
52 | - } |
|
46 | + public function __construct() { |
|
47 | + $this->addType('id', 'int'); |
|
48 | + $this->addType('token_id', 'int'); |
|
49 | + $this->addType('client_id', 'int'); |
|
50 | + $this->addType('hashed_code', 'string'); |
|
51 | + $this->addType('encrypted_token', 'string'); |
|
52 | + } |
|
53 | 53 | } |
@@ -31,31 +31,31 @@ |
||
31 | 31 | */ |
32 | 32 | interface ICredentials { |
33 | 33 | |
34 | - /** |
|
35 | - * Get the user UID |
|
36 | - * |
|
37 | - * @since 12 |
|
38 | - * |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public function getUID(); |
|
34 | + /** |
|
35 | + * Get the user UID |
|
36 | + * |
|
37 | + * @since 12 |
|
38 | + * |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public function getUID(); |
|
42 | 42 | |
43 | - /** |
|
44 | - * Get the login name the users used to login |
|
45 | - * |
|
46 | - * @since 12 |
|
47 | - * |
|
48 | - * @return string |
|
49 | - */ |
|
50 | - public function getLoginName(); |
|
43 | + /** |
|
44 | + * Get the login name the users used to login |
|
45 | + * |
|
46 | + * @since 12 |
|
47 | + * |
|
48 | + * @return string |
|
49 | + */ |
|
50 | + public function getLoginName(); |
|
51 | 51 | |
52 | - /** |
|
53 | - * Get the password |
|
54 | - * |
|
55 | - * @since 12 |
|
56 | - * |
|
57 | - * @return string |
|
58 | - * @throws PasswordUnavailableException |
|
59 | - */ |
|
60 | - public function getPassword(); |
|
52 | + /** |
|
53 | + * Get the password |
|
54 | + * |
|
55 | + * @since 12 |
|
56 | + * |
|
57 | + * @return string |
|
58 | + * @throws PasswordUnavailableException |
|
59 | + */ |
|
60 | + public function getPassword(); |
|
61 | 61 | } |
@@ -169,8 +169,8 @@ |
||
169 | 169 | 'mimetype', $update->createNamedParameter($folderMimeTypeId) |
170 | 170 | )) |
171 | 171 | ->andWhere($update->expr()->like( |
172 | - $update->createFunction('LOWER(' . $update->getColumnName('name') . ')'), |
|
173 | - $update->createNamedParameter('%' . $this->dbConnection->escapeLikeParameter('.' . $ext)) |
|
172 | + $update->createFunction('LOWER('.$update->getColumnName('name').')'), |
|
173 | + $update->createNamedParameter('%'.$this->dbConnection->escapeLikeParameter('.'.$ext)) |
|
174 | 174 | )); |
175 | 175 | return $update->execute(); |
176 | 176 | } |
@@ -33,150 +33,150 @@ |
||
33 | 33 | */ |
34 | 34 | class Loader implements IMimeTypeLoader { |
35 | 35 | |
36 | - /** @var IDBConnection */ |
|
37 | - private $dbConnection; |
|
38 | - |
|
39 | - /** @var array [id => mimetype] */ |
|
40 | - protected $mimetypes; |
|
41 | - |
|
42 | - /** @var array [mimetype => id] */ |
|
43 | - protected $mimetypeIds; |
|
44 | - |
|
45 | - /** |
|
46 | - * @param IDBConnection $dbConnection |
|
47 | - */ |
|
48 | - public function __construct(IDBConnection $dbConnection) { |
|
49 | - $this->dbConnection = $dbConnection; |
|
50 | - $this->mimetypes = []; |
|
51 | - $this->mimetypeIds = []; |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * Get a mimetype from its ID |
|
56 | - * |
|
57 | - * @param int $id |
|
58 | - * @return string|null |
|
59 | - */ |
|
60 | - public function getMimetypeById($id) { |
|
61 | - if (!$this->mimetypes) { |
|
62 | - $this->loadMimetypes(); |
|
63 | - } |
|
64 | - if (isset($this->mimetypes[$id])) { |
|
65 | - return $this->mimetypes[$id]; |
|
66 | - } |
|
67 | - return null; |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * Get a mimetype ID, adding the mimetype to the DB if it does not exist |
|
72 | - * |
|
73 | - * @param string $mimetype |
|
74 | - * @return int |
|
75 | - */ |
|
76 | - public function getId($mimetype) { |
|
77 | - if (!$this->mimetypeIds) { |
|
78 | - $this->loadMimetypes(); |
|
79 | - } |
|
80 | - if (isset($this->mimetypeIds[$mimetype])) { |
|
81 | - return $this->mimetypeIds[$mimetype]; |
|
82 | - } |
|
83 | - return $this->store($mimetype); |
|
84 | - } |
|
85 | - |
|
86 | - /** |
|
87 | - * Test if a mimetype exists in the database |
|
88 | - * |
|
89 | - * @param string $mimetype |
|
90 | - * @return bool |
|
91 | - */ |
|
92 | - public function exists($mimetype) { |
|
93 | - if (!$this->mimetypeIds) { |
|
94 | - $this->loadMimetypes(); |
|
95 | - } |
|
96 | - return isset($this->mimetypeIds[$mimetype]); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Clear all loaded mimetypes, allow for re-loading |
|
101 | - */ |
|
102 | - public function reset() { |
|
103 | - $this->mimetypes = []; |
|
104 | - $this->mimetypeIds = []; |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * Store a mimetype in the DB |
|
109 | - * |
|
110 | - * @param string $mimetype |
|
111 | - * @param int inserted ID |
|
112 | - */ |
|
113 | - protected function store($mimetype) { |
|
114 | - try { |
|
115 | - $qb = $this->dbConnection->getQueryBuilder(); |
|
116 | - $qb->insert('mimetypes') |
|
117 | - ->values([ |
|
118 | - 'mimetype' => $qb->createNamedParameter($mimetype) |
|
119 | - ]); |
|
120 | - $qb->execute(); |
|
121 | - } catch (UniqueConstraintViolationException $e) { |
|
122 | - if ($this->dbConnection->inTransaction()) { |
|
123 | - // if we're inside a transaction we can't recover safely |
|
124 | - throw $e; |
|
125 | - } |
|
126 | - // something inserted it before us |
|
127 | - } |
|
128 | - |
|
129 | - $fetch = $this->dbConnection->getQueryBuilder(); |
|
130 | - $fetch->select('id') |
|
131 | - ->from('mimetypes') |
|
132 | - ->where( |
|
133 | - $fetch->expr()->eq('mimetype', $fetch->createNamedParameter($mimetype) |
|
134 | - )); |
|
135 | - $row = $fetch->execute()->fetch(); |
|
136 | - |
|
137 | - $this->mimetypes[$row['id']] = $mimetype; |
|
138 | - $this->mimetypeIds[$mimetype] = $row['id']; |
|
139 | - return $row['id']; |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * Load all mimetypes from DB |
|
144 | - */ |
|
145 | - private function loadMimetypes() { |
|
146 | - $qb = $this->dbConnection->getQueryBuilder(); |
|
147 | - $qb->select('id', 'mimetype') |
|
148 | - ->from('mimetypes'); |
|
149 | - $results = $qb->execute()->fetchAll(); |
|
150 | - |
|
151 | - foreach ($results as $row) { |
|
152 | - $this->mimetypes[$row['id']] = $row['mimetype']; |
|
153 | - $this->mimetypeIds[$row['mimetype']] = $row['id']; |
|
154 | - } |
|
155 | - } |
|
156 | - |
|
157 | - /** |
|
158 | - * Update filecache mimetype based on file extension |
|
159 | - * |
|
160 | - * @param string $ext file extension |
|
161 | - * @param int $mimeTypeId |
|
162 | - * @return int number of changed rows |
|
163 | - */ |
|
164 | - public function updateFilecache($ext, $mimeTypeId) { |
|
165 | - $folderMimeTypeId = $this->getId('httpd/unix-directory'); |
|
166 | - $update = $this->dbConnection->getQueryBuilder(); |
|
167 | - $update->update('filecache') |
|
168 | - ->set('mimetype', $update->createNamedParameter($mimeTypeId)) |
|
169 | - ->where($update->expr()->neq( |
|
170 | - 'mimetype', $update->createNamedParameter($mimeTypeId) |
|
171 | - )) |
|
172 | - ->andWhere($update->expr()->neq( |
|
173 | - 'mimetype', $update->createNamedParameter($folderMimeTypeId) |
|
174 | - )) |
|
175 | - ->andWhere($update->expr()->like( |
|
176 | - $update->createFunction('LOWER(' . $update->getColumnName('name') . ')'), |
|
177 | - $update->createNamedParameter('%' . $this->dbConnection->escapeLikeParameter('.' . $ext)) |
|
178 | - )); |
|
179 | - return $update->execute(); |
|
180 | - } |
|
36 | + /** @var IDBConnection */ |
|
37 | + private $dbConnection; |
|
38 | + |
|
39 | + /** @var array [id => mimetype] */ |
|
40 | + protected $mimetypes; |
|
41 | + |
|
42 | + /** @var array [mimetype => id] */ |
|
43 | + protected $mimetypeIds; |
|
44 | + |
|
45 | + /** |
|
46 | + * @param IDBConnection $dbConnection |
|
47 | + */ |
|
48 | + public function __construct(IDBConnection $dbConnection) { |
|
49 | + $this->dbConnection = $dbConnection; |
|
50 | + $this->mimetypes = []; |
|
51 | + $this->mimetypeIds = []; |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * Get a mimetype from its ID |
|
56 | + * |
|
57 | + * @param int $id |
|
58 | + * @return string|null |
|
59 | + */ |
|
60 | + public function getMimetypeById($id) { |
|
61 | + if (!$this->mimetypes) { |
|
62 | + $this->loadMimetypes(); |
|
63 | + } |
|
64 | + if (isset($this->mimetypes[$id])) { |
|
65 | + return $this->mimetypes[$id]; |
|
66 | + } |
|
67 | + return null; |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * Get a mimetype ID, adding the mimetype to the DB if it does not exist |
|
72 | + * |
|
73 | + * @param string $mimetype |
|
74 | + * @return int |
|
75 | + */ |
|
76 | + public function getId($mimetype) { |
|
77 | + if (!$this->mimetypeIds) { |
|
78 | + $this->loadMimetypes(); |
|
79 | + } |
|
80 | + if (isset($this->mimetypeIds[$mimetype])) { |
|
81 | + return $this->mimetypeIds[$mimetype]; |
|
82 | + } |
|
83 | + return $this->store($mimetype); |
|
84 | + } |
|
85 | + |
|
86 | + /** |
|
87 | + * Test if a mimetype exists in the database |
|
88 | + * |
|
89 | + * @param string $mimetype |
|
90 | + * @return bool |
|
91 | + */ |
|
92 | + public function exists($mimetype) { |
|
93 | + if (!$this->mimetypeIds) { |
|
94 | + $this->loadMimetypes(); |
|
95 | + } |
|
96 | + return isset($this->mimetypeIds[$mimetype]); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Clear all loaded mimetypes, allow for re-loading |
|
101 | + */ |
|
102 | + public function reset() { |
|
103 | + $this->mimetypes = []; |
|
104 | + $this->mimetypeIds = []; |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * Store a mimetype in the DB |
|
109 | + * |
|
110 | + * @param string $mimetype |
|
111 | + * @param int inserted ID |
|
112 | + */ |
|
113 | + protected function store($mimetype) { |
|
114 | + try { |
|
115 | + $qb = $this->dbConnection->getQueryBuilder(); |
|
116 | + $qb->insert('mimetypes') |
|
117 | + ->values([ |
|
118 | + 'mimetype' => $qb->createNamedParameter($mimetype) |
|
119 | + ]); |
|
120 | + $qb->execute(); |
|
121 | + } catch (UniqueConstraintViolationException $e) { |
|
122 | + if ($this->dbConnection->inTransaction()) { |
|
123 | + // if we're inside a transaction we can't recover safely |
|
124 | + throw $e; |
|
125 | + } |
|
126 | + // something inserted it before us |
|
127 | + } |
|
128 | + |
|
129 | + $fetch = $this->dbConnection->getQueryBuilder(); |
|
130 | + $fetch->select('id') |
|
131 | + ->from('mimetypes') |
|
132 | + ->where( |
|
133 | + $fetch->expr()->eq('mimetype', $fetch->createNamedParameter($mimetype) |
|
134 | + )); |
|
135 | + $row = $fetch->execute()->fetch(); |
|
136 | + |
|
137 | + $this->mimetypes[$row['id']] = $mimetype; |
|
138 | + $this->mimetypeIds[$mimetype] = $row['id']; |
|
139 | + return $row['id']; |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * Load all mimetypes from DB |
|
144 | + */ |
|
145 | + private function loadMimetypes() { |
|
146 | + $qb = $this->dbConnection->getQueryBuilder(); |
|
147 | + $qb->select('id', 'mimetype') |
|
148 | + ->from('mimetypes'); |
|
149 | + $results = $qb->execute()->fetchAll(); |
|
150 | + |
|
151 | + foreach ($results as $row) { |
|
152 | + $this->mimetypes[$row['id']] = $row['mimetype']; |
|
153 | + $this->mimetypeIds[$row['mimetype']] = $row['id']; |
|
154 | + } |
|
155 | + } |
|
156 | + |
|
157 | + /** |
|
158 | + * Update filecache mimetype based on file extension |
|
159 | + * |
|
160 | + * @param string $ext file extension |
|
161 | + * @param int $mimeTypeId |
|
162 | + * @return int number of changed rows |
|
163 | + */ |
|
164 | + public function updateFilecache($ext, $mimeTypeId) { |
|
165 | + $folderMimeTypeId = $this->getId('httpd/unix-directory'); |
|
166 | + $update = $this->dbConnection->getQueryBuilder(); |
|
167 | + $update->update('filecache') |
|
168 | + ->set('mimetype', $update->createNamedParameter($mimeTypeId)) |
|
169 | + ->where($update->expr()->neq( |
|
170 | + 'mimetype', $update->createNamedParameter($mimeTypeId) |
|
171 | + )) |
|
172 | + ->andWhere($update->expr()->neq( |
|
173 | + 'mimetype', $update->createNamedParameter($folderMimeTypeId) |
|
174 | + )) |
|
175 | + ->andWhere($update->expr()->like( |
|
176 | + $update->createFunction('LOWER(' . $update->getColumnName('name') . ')'), |
|
177 | + $update->createNamedParameter('%' . $this->dbConnection->escapeLikeParameter('.' . $ext)) |
|
178 | + )); |
|
179 | + return $update->execute(); |
|
180 | + } |
|
181 | 181 | |
182 | 182 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | use OCP\Util; |
29 | 29 | |
30 | 30 | class Application extends App { |
31 | - public function __construct () { |
|
31 | + public function __construct() { |
|
32 | 32 | parent::__construct('twofactor_backupcodes'); |
33 | 33 | } |
34 | 34 |
@@ -28,27 +28,27 @@ |
||
28 | 28 | use OCP\Util; |
29 | 29 | |
30 | 30 | class Application extends App { |
31 | - public function __construct () { |
|
32 | - parent::__construct('twofactor_backupcodes'); |
|
33 | - } |
|
31 | + public function __construct () { |
|
32 | + parent::__construct('twofactor_backupcodes'); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Register the different app parts |
|
37 | - */ |
|
38 | - public function register() { |
|
39 | - $this->registerHooksAndEvents(); |
|
40 | - } |
|
35 | + /** |
|
36 | + * Register the different app parts |
|
37 | + */ |
|
38 | + public function register() { |
|
39 | + $this->registerHooksAndEvents(); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Register the hooks and events |
|
44 | - */ |
|
45 | - public function registerHooksAndEvents() { |
|
46 | - Util::connectHook('OC_User', 'post_deleteUser', $this, 'deleteUser'); |
|
47 | - } |
|
42 | + /** |
|
43 | + * Register the hooks and events |
|
44 | + */ |
|
45 | + public function registerHooksAndEvents() { |
|
46 | + Util::connectHook('OC_User', 'post_deleteUser', $this, 'deleteUser'); |
|
47 | + } |
|
48 | 48 | |
49 | - public function deleteUser($params) { |
|
50 | - /** @var BackupCodeMapper $mapper */ |
|
51 | - $mapper = $this->getContainer()->query(BackupCodeMapper::class); |
|
52 | - $mapper->deleteCodesByUserId($params['uid']); |
|
53 | - } |
|
49 | + public function deleteUser($params) { |
|
50 | + /** @var BackupCodeMapper $mapper */ |
|
51 | + $mapper = $this->getContainer()->query(BackupCodeMapper::class); |
|
52 | + $mapper->deleteCodesByUserId($params['uid']); |
|
53 | + } |
|
54 | 54 | } |