Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
PluginManager | |
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCommandList | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getExpectedInterface | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * Console command plugin manager |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) Villanova University 2020. |
9 | * |
10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License version 2, |
12 | * as published by the Free Software Foundation. |
13 | * |
14 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | * GNU General Public License for more details. |
18 | * |
19 | * You should have received a copy of the GNU General Public License |
20 | * along with this program; if not, write to the Free Software |
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
22 | * |
23 | * @category VuFind |
24 | * @package Console |
25 | * @author Demian Katz <demian.katz@villanova.edu> |
26 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
27 | * @link https://vufind.org/wiki/development:plugins:ils_drivers Wiki |
28 | */ |
29 | |
30 | namespace VuFindConsole\Command; |
31 | |
32 | use Laminas\ServiceManager\Factory\InvokableFactory; |
33 | |
34 | /** |
35 | * Console command plugin manager |
36 | * |
37 | * @category VuFind |
38 | * @package Console |
39 | * @author Demian Katz <demian.katz@villanova.edu> |
40 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
41 | * @link https://vufind.org/wiki/development:plugins:ils_drivers Wiki |
42 | */ |
43 | class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager |
44 | { |
45 | /** |
46 | * Default plugin aliases. |
47 | * |
48 | * @var array |
49 | */ |
50 | protected $aliases = [ |
51 | 'compile/theme' => Compile\ThemeCommand::class, |
52 | 'generate/dynamicroute' => Generate\DynamicRouteCommand::class, |
53 | 'generate/extendclass' => Generate\ExtendClassCommand::class, |
54 | 'generate/extendservice' => Generate\ExtendServiceCommand::class, |
55 | 'generate/nontabrecordaction' => Generate\NonTabRecordActionCommand::class, |
56 | 'generate/plugin' => Generate\PluginCommand::class, |
57 | 'generate/recordroute' => Generate\RecordRouteCommand::class, |
58 | 'generate/staticroute' => Generate\StaticRouteCommand::class, |
59 | 'generate/theme' => Generate\ThemeCommand::class, |
60 | 'generate/thememixin' => Generate\ThemeMixinCommand::class, |
61 | 'harvest/harvest_oai' => Harvest\HarvestOaiCommand::class, |
62 | 'harvest/merge-marc' => Harvest\MergeMarcCommand::class, |
63 | 'import/import-csv' => Import\ImportCsvCommand::class, |
64 | 'import/import-xsl' => Import\ImportXslCommand::class, |
65 | 'import/webcrawl' => Import\WebCrawlCommand::class, |
66 | 'install/install' => Install\InstallCommand::class, |
67 | 'language/addusingtemplate' => Language\AddUsingTemplateCommand::class, |
68 | 'language/copystring' => Language\CopyStringCommand::class, |
69 | 'language/delete' => Language\DeleteCommand::class, |
70 | 'language/importlokalise' => Language\ImportLokaliseCommand::class, |
71 | 'language/normalize' => Language\NormalizeCommand::class, |
72 | 'scheduledsearch/notify' => ScheduledSearch\NotifyCommand::class, |
73 | 'util/browscap' => Util\BrowscapCommand::class, |
74 | 'util/cleanuprecordcache' => Util\CleanUpRecordCacheCommand::class, |
75 | 'util/cleanup_record_cache' => Util\CleanUpRecordCacheCommand::class, |
76 | 'util/commit' => Util\CommitCommand::class, |
77 | 'util/createHierarchyTrees' => Util\CreateHierarchyTreesCommand::class, |
78 | 'util/dedupe' => Util\DedupeCommand::class, |
79 | 'util/deletes' => Util\DeletesCommand::class, |
80 | 'util/expire_access_tokens' => Util\ExpireAccessTokensCommand::class, |
81 | 'util/expire_auth_hashes' => Util\ExpireAuthHashesCommand::class, |
82 | 'util/expire_external_sessions' => Util\ExpireExternalSessionsCommand::class, |
83 | 'util/expire_login_tokens' => Util\ExpireLoginTokensCommand::class, |
84 | 'util/expire_searches' => Util\ExpireSearchesCommand::class, |
85 | 'util/expire_sessions' => Util\ExpireSessionsCommand::class, |
86 | 'util/index_reserves' => Util\IndexReservesCommand::class, |
87 | 'util/lint_marc' => Util\LintMarcCommand::class, |
88 | 'util/optimize' => Util\OptimizeCommand::class, |
89 | 'util/purge_cached_record' => Util\PurgeCachedRecordCommand::class, |
90 | 'util/scssBuilder' => Util\ScssBuilderCommand::class, |
91 | 'util/sitemap' => Util\SitemapCommand::class, |
92 | 'util/suppressed' => Util\SuppressedCommand::class, |
93 | 'util/switch_db_hash' => Util\SwitchDbHashCommand::class, |
94 | ]; |
95 | |
96 | /** |
97 | * Default plugin factories. |
98 | * |
99 | * @var array |
100 | */ |
101 | protected $factories = [ |
102 | Compile\ThemeCommand::class => Compile\ThemeCommandFactory::class, |
103 | Generate\DynamicRouteCommand::class => |
104 | Generate\AbstractRouteCommandFactory::class, |
105 | Generate\ExtendClassCommand::class => |
106 | Generate\AbstractContainerAwareCommandFactory::class, |
107 | Generate\ExtendServiceCommand::class => |
108 | Generate\AbstractCommandFactory::class, |
109 | Generate\NonTabRecordActionCommand::class => |
110 | Generate\NonTabRecordActionCommandFactory::class, |
111 | Generate\PluginCommand::class => |
112 | Generate\AbstractContainerAwareCommandFactory::class, |
113 | Generate\RecordRouteCommand::class => |
114 | Generate\AbstractRouteCommandFactory::class, |
115 | Generate\StaticRouteCommand::class => |
116 | Generate\AbstractRouteCommandFactory::class, |
117 | Generate\ThemeCommand::class => |
118 | Generate\ThemeCommandFactory::class, |
119 | Generate\ThemeMixinCommand::class => |
120 | Generate\ThemeMixinCommandFactory::class, |
121 | Harvest\MergeMarcCommand::class => InvokableFactory::class, |
122 | Harvest\HarvestOaiCommand::class => Harvest\HarvestOaiCommandFactory::class, |
123 | Import\ImportCsvCommand::class => Import\ImportCsvCommandFactory::class, |
124 | Import\ImportXslCommand::class => Import\ImportXslCommandFactory::class, |
125 | Import\WebCrawlCommand::class => Import\WebCrawlCommandFactory::class, |
126 | Install\InstallCommand::class => InvokableFactory::class, |
127 | Language\AddUsingTemplateCommand::class => |
128 | Language\AbstractCommandFactory::class, |
129 | Language\CopyStringCommand::class => Language\AbstractCommandFactory::class, |
130 | Language\DeleteCommand::class => Language\AbstractCommandFactory::class, |
131 | Language\ImportLokaliseCommand::class => Language\AbstractCommandFactory::class, |
132 | Language\NormalizeCommand::class => Language\AbstractCommandFactory::class, |
133 | ScheduledSearch\NotifyCommand::class => |
134 | ScheduledSearch\NotifyCommandFactory::class, |
135 | Util\BrowscapCommand::class => Util\BrowscapCommandFactory::class, |
136 | Util\CleanUpRecordCacheCommand::class => |
137 | Util\CleanUpRecordCacheCommandFactory::class, |
138 | Util\CommitCommand::class => Util\AbstractSolrCommandFactory::class, |
139 | Util\CreateHierarchyTreesCommand::class => |
140 | Util\CreateHierarchyTreesCommandFactory::class, |
141 | Util\DedupeCommand::class => InvokableFactory::class, |
142 | Util\DeletesCommand::class => Util\AbstractSolrCommandFactory::class, |
143 | Util\ExpireAccessTokensCommand::class => |
144 | Util\ExpireAccessTokensCommandFactory::class, |
145 | Util\ExpireAuthHashesCommand::class => |
146 | Util\ExpireAuthHashesCommandFactory::class, |
147 | Util\ExpireExternalSessionsCommand::class => |
148 | Util\ExpireExternalSessionsCommandFactory::class, |
149 | Util\ExpireLoginTokensCommand::class => |
150 | Util\ExpireLoginTokensCommandFactory::class, |
151 | Util\ExpireSearchesCommand::class => |
152 | Util\ExpireSearchesCommandFactory::class, |
153 | Util\ExpireSessionsCommand::class => |
154 | Util\ExpireSessionsCommandFactory::class, |
155 | Util\IndexReservesCommand::class => |
156 | Util\AbstractSolrAndIlsCommandFactory::class, |
157 | Util\LintMarcCommand::class => InvokableFactory::class, |
158 | Util\OptimizeCommand::class => Util\AbstractSolrCommandFactory::class, |
159 | Util\PurgeCachedRecordCommand::class => Util\PurgeCachedRecordCommandFactory::class, |
160 | Util\ScssBuilderCommand::class => Util\ScssBuilderCommandFactory::class, |
161 | Util\SitemapCommand::class => Util\SitemapCommandFactory::class, |
162 | Util\SuppressedCommand::class => |
163 | Util\AbstractSolrAndIlsCommandFactory::class, |
164 | Util\SwitchDbHashCommand::class => Util\SwitchDbHashCommandFactory::class, |
165 | ]; |
166 | |
167 | /** |
168 | * Constructor |
169 | * |
170 | * Make sure plugins are properly initialized. |
171 | * |
172 | * @param mixed $configOrContainerInstance Configuration or container instance |
173 | * @param array $v3config If $configOrContainerInstance is a |
174 | * container, this value will be passed to the parent constructor. |
175 | */ |
176 | public function __construct( |
177 | $configOrContainerInstance = null, |
178 | array $v3config = [] |
179 | ) { |
180 | //$this->addAbstractFactory(PluginFactory::class); |
181 | parent::__construct($configOrContainerInstance, $v3config); |
182 | } |
183 | |
184 | /** |
185 | * Get a list of all available commands in the plugin manager. |
186 | * |
187 | * @return array |
188 | */ |
189 | public function getCommandList() |
190 | { |
191 | return array_keys($this->factories); |
192 | } |
193 | |
194 | /** |
195 | * Return the name of the base class or interface that plug-ins must conform |
196 | * to. |
197 | * |
198 | * @return string |
199 | */ |
200 | protected function getExpectedInterface() |
201 | { |
202 | return \Symfony\Component\Console\Command\Command::class; |
203 | } |
204 | } |