These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of EC-CUBE |
||
5 | * |
||
6 | * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. |
||
7 | * |
||
8 | * http://www.ec-cube.co.jp/ |
||
9 | * |
||
10 | * For the full copyright and license information, please view the LICENSE |
||
11 | * file that was distributed with this source code. |
||
12 | */ |
||
13 | |||
14 | namespace Eccube\Plugin; |
||
15 | |||
16 | use Doctrine\DBAL\Connection; |
||
17 | use Doctrine\DBAL\Migrations\Migration; |
||
18 | use Doctrine\DBAL\Migrations\Configuration\Configuration; |
||
19 | use Symfony\Component\DependencyInjection\ContainerInterface; |
||
20 | |||
21 | abstract class AbstractPluginManager |
||
22 | { |
||
23 | const MIGRATION_TABLE_PREFIX = 'migration_'; |
||
24 | |||
25 | /** |
||
26 | * プラグインのマイグレーションを実行する. |
||
27 | * |
||
28 | * PluginManager 実行時に、 Doctrine SchemaUpdate が自動的に行なわれるため、 |
||
29 | * このメソッドは主にデータの更新に使用する. |
||
30 | * |
||
31 | * 引数 $version で指定したバージョンまでマイグレーションする. |
||
32 | * null を渡すと最新バージョンまでマイグレートする. |
||
33 | * 0 を渡すと最初に戻る。 |
||
34 | * |
||
35 | * @param Connection $connection Doctrine Connection |
||
36 | * @param string $pluginCode プラグインコード |
||
37 | * @param string $version マイグレーション先のバージョン |
||
38 | * @param string $migrationFilePath マイグレーションファイルを格納したファイルパス. 指定しない場合は app/Plugin/<pluginCode>/DoctrineMigrations を使用する |
||
39 | */ |
||
40 | public function migration(Connection $connection, $pluginCode, $version = null, $migrationFilePath = null) |
||
41 | { |
||
42 | if (null === $migrationFilePath) { |
||
43 | $migrationFilePath = __DIR__.'/../../../app/Plugin/'.$pluginCode.'/DoctrineMigrations'; |
||
44 | } |
||
45 | $config = new Configuration($connection); |
||
46 | $config->setMigrationsNamespace('\Plugin\\'.$pluginCode.'\DoctrineMigrations'); |
||
47 | $config->setMigrationsDirectory($migrationFilePath); |
||
48 | $config->registerMigrationsFromDirectory($migrationFilePath); |
||
49 | $config->setMigrationsTableName(self::MIGRATION_TABLE_PREFIX.$pluginCode); |
||
50 | $migration = new Migration($config); |
||
51 | $migration->migrate($version, false); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Install the plugin. |
||
56 | * |
||
57 | * @param array $meta |
||
58 | * @param ContainerInterface $container |
||
59 | */ |
||
60 | public function install(array $meta, ContainerInterface $container) |
||
0 ignored issues
–
show
|
|||
61 | { |
||
62 | // quiet. |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * Update the plugin. |
||
67 | * |
||
68 | * @param array $meta |
||
69 | * @param ContainerInterface $container |
||
70 | */ |
||
71 | public function update(array $meta, ContainerInterface $container) |
||
0 ignored issues
–
show
|
|||
72 | { |
||
73 | // quiet. |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * Enable the plugin. |
||
78 | * |
||
79 | * @param array $meta |
||
80 | * @param ContainerInterface $container |
||
81 | */ |
||
82 | public function enable(array $meta, ContainerInterface $container) |
||
0 ignored issues
–
show
|
|||
83 | { |
||
84 | // quiet. |
||
85 | } |
||
86 | |||
87 | /** |
||
88 | * Disable the plugin. |
||
89 | * |
||
90 | * @param array $meta |
||
91 | * @param ContainerInterface $container |
||
92 | */ |
||
93 | public function disable(array $meta, ContainerInterface $container) |
||
0 ignored issues
–
show
|
|||
94 | { |
||
95 | // quiet. |
||
96 | } |
||
97 | |||
98 | /** |
||
99 | * Uninstall the plugin. |
||
100 | * |
||
101 | * @param array $meta |
||
102 | * @param ContainerInterface $container |
||
103 | */ |
||
104 | public function uninstall(array $meta, ContainerInterface $container) |
||
0 ignored issues
–
show
|
|||
105 | { |
||
106 | // quiet. |
||
107 | } |
||
108 | } |
||
109 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.