1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Vincent Petry <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @copyright Copyright (c) 2018, ownCloud GmbH |
6
|
|
|
* @license AGPL-3.0 |
7
|
|
|
* |
8
|
|
|
* This code is free software: you can redistribute it and/or modify |
9
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
10
|
|
|
* as published by the Free Software Foundation. |
11
|
|
|
* |
12
|
|
|
* This program is distributed in the hope that it will be useful, |
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15
|
|
|
* GNU Affero General Public License for more details. |
16
|
|
|
* |
17
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
18
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
19
|
|
|
* |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace OCA\activity\Migrations; |
23
|
|
|
|
24
|
|
|
use OCP\Migration\ISqlMigration; |
25
|
|
|
use Doctrine\DBAL\Platforms\MySqlPlatform; |
26
|
|
|
use Doctrine\DBAL\Platforms\SqlitePlatform; |
27
|
|
|
use Doctrine\DBAL\Platforms\PostgreSqlPlatform; |
28
|
|
|
use OCP\IDBConnection; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Adds migrations that were missing when running update. |
32
|
|
|
* |
33
|
|
|
* - set type to "longtext" for "subjectparams" and "messageparams" by increasing length |
34
|
|
|
* |
35
|
|
|
*/ |
36
|
|
|
class Version20181022150134 implements ISqlMigration { |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param Schema $schema |
|
|
|
|
40
|
|
|
* @param array $options |
|
|
|
|
41
|
|
|
*/ |
42
|
|
|
public function sql(IDBConnection $connection) { |
43
|
|
|
$platform = $connection->getDatabasePlatform(); |
44
|
|
|
$tableName = "*PREFIX*activity"; |
45
|
|
|
$tableName = $connection->getDatabasePlatform()->quoteIdentifier($tableName); |
46
|
|
|
|
47
|
|
|
if ($platform instanceof MySqlPlatform) { |
|
|
|
|
48
|
|
|
$sqls = [ |
49
|
|
|
"ALTER TABLE $tableName MODIFY COLUMN `subjectparams` LONGTEXT NOT NULL", |
50
|
|
|
"ALTER TABLE $tableName MODIFY COLUMN `messageparams` LONGTEXT NULL", |
51
|
|
|
]; |
52
|
|
|
} else { |
53
|
|
|
$sqls = []; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
return $sqls; |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.