Skip to content

Commit 793a905

Browse files
Fix usage of DBAL types
Signed-off-by: Christoph Wurst <[email protected]>
1 parent 552c1dc commit 793a905

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

lib/Handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function count(INotification $notification): int {
7373
$this->sqlWhere($sql, $notification);
7474

7575
$statement = $sql->execute();
76-
$count = (int) $statement->fetchColumn();
76+
$count = (int) $statement->fetchOne();
7777
$statement->closeCursor();
7878

7979
return $count;

lib/Migration/Version2004Date20190107135757.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
namespace OCA\Notifications\Migration;
2525

2626
use Closure;
27-
use Doctrine\DBAL\Types\Type;
27+
use Doctrine\DBAL\Types\Types;
2828
use OCP\DB\ISchemaWrapper;
2929
use OCP\Migration\SimpleMigrationStep;
3030
use OCP\Migration\IOutput;
@@ -43,55 +43,55 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
4343

4444
if (!$schema->hasTable('notifications')) {
4545
$table = $schema->createTable('notifications');
46-
$table->addColumn('notification_id', Type::INTEGER, [
46+
$table->addColumn('notification_id', Types::INTEGER, [
4747
'autoincrement' => true,
4848
'notnull' => true,
4949
'length' => 4,
5050
]);
51-
$table->addColumn('app', Type::STRING, [
51+
$table->addColumn('app', Types::STRING, [
5252
'notnull' => true,
5353
'length' => 32,
5454
]);
55-
$table->addColumn('user', Type::STRING, [
55+
$table->addColumn('user', Types::STRING, [
5656
'notnull' => true,
5757
'length' => 64,
5858
]);
59-
$table->addColumn('timestamp', Type::INTEGER, [
59+
$table->addColumn('timestamp', Types::INTEGER, [
6060
'notnull' => true,
6161
'length' => 4,
6262
'default' => 0,
6363
]);
64-
$table->addColumn('object_type', Type::STRING, [
64+
$table->addColumn('object_type', Types::STRING, [
6565
'notnull' => true,
6666
'length' => 64,
6767
]);
68-
$table->addColumn('object_id', Type::STRING, [
68+
$table->addColumn('object_id', Types::STRING, [
6969
'notnull' => true,
7070
'length' => 64,
7171
]);
72-
$table->addColumn('subject', Type::STRING, [
72+
$table->addColumn('subject', Types::STRING, [
7373
'notnull' => true,
7474
'length' => 64,
7575
]);
76-
$table->addColumn('subject_parameters', Type::TEXT, [
76+
$table->addColumn('subject_parameters', Types::TEXT, [
7777
'notnull' => false,
7878
]);
79-
$table->addColumn('message', Type::STRING, [
79+
$table->addColumn('message', Types::STRING, [
8080
'notnull' => false,
8181
'length' => 64,
8282
]);
83-
$table->addColumn('message_parameters', Type::TEXT, [
83+
$table->addColumn('message_parameters', Types::TEXT, [
8484
'notnull' => false,
8585
]);
86-
$table->addColumn('link', Type::STRING, [
86+
$table->addColumn('link', Types::STRING, [
8787
'notnull' => false,
8888
'length' => 4000,
8989
]);
90-
$table->addColumn('icon', Type::STRING, [
90+
$table->addColumn('icon', Types::STRING, [
9191
'notnull' => false,
9292
'length' => 4000,
9393
]);
94-
$table->addColumn('actions', Type::TEXT, [
94+
$table->addColumn('actions', Types::TEXT, [
9595
'notnull' => false,
9696
]);
9797
$table->setPrimaryKey(['notification_id']);
@@ -103,36 +103,36 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
103103

104104
if (!$schema->hasTable('notifications_pushtokens')) {
105105
$table = $schema->createTable('notifications_pushtokens');
106-
$table->addColumn('uid', Type::STRING, [
106+
$table->addColumn('uid', Types::STRING, [
107107
'notnull' => true,
108108
'length' => 64,
109109
]);
110-
$table->addColumn('token', Type::INTEGER, [
110+
$table->addColumn('token', Types::INTEGER, [
111111
'notnull' => true,
112112
'length' => 4,
113113
'default' => 0,
114114
]);
115-
$table->addColumn('deviceidentifier', Type::STRING, [
115+
$table->addColumn('deviceidentifier', Types::STRING, [
116116
'notnull' => true,
117117
'length' => 128,
118118
]);
119-
$table->addColumn('devicepublickey', Type::STRING, [
119+
$table->addColumn('devicepublickey', Types::STRING, [
120120
'notnull' => true,
121121
'length' => 512,
122122
]);
123-
$table->addColumn('devicepublickeyhash', Type::STRING, [
123+
$table->addColumn('devicepublickeyhash', Types::STRING, [
124124
'notnull' => true,
125125
'length' => 128,
126126
]);
127-
$table->addColumn('pushtokenhash', Type::STRING, [
127+
$table->addColumn('pushtokenhash', Types::STRING, [
128128
'notnull' => true,
129129
'length' => 128,
130130
]);
131-
$table->addColumn('proxyserver', Type::STRING, [
131+
$table->addColumn('proxyserver', Types::STRING, [
132132
'notnull' => true,
133133
'length' => 256,
134134
]);
135-
$table->addColumn('apptype', Type::STRING, [
135+
$table->addColumn('apptype', Types::STRING, [
136136
'notnull' => true,
137137
'length' => 32,
138138
'default' => 'unknown',

lib/Push.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ public function pushToDevice(int $id, INotification $notification, ?OutputInterf
146146
$devices = $this->getDevicesForUser($notification->getUser());
147147
if (empty($devices)) {
148148
$this->printInfo('No devices found for user');
149-
return;
150149
}
151150

152151
$this->printInfo('Trying to push to ' . count($devices) . ' devices');

0 commit comments

Comments
 (0)