1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Loading CommandController. |
5
|
|
|
*/ |
6
|
|
|
declare(strict_types = 1); |
7
|
|
|
|
8
|
|
|
namespace HDNET\Autoloader\Loader; |
9
|
|
|
|
10
|
|
|
use HDNET\Autoloader\Loader; |
11
|
|
|
use HDNET\Autoloader\LoaderInterface; |
12
|
|
|
use HDNET\Autoloader\Utility\ClassNamingUtility; |
13
|
|
|
use HDNET\Autoloader\Utility\FileUtility; |
14
|
|
|
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Loading CommandController. |
18
|
|
|
*/ |
19
|
|
|
class CommandController implements LoaderInterface |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* Get all the complex data for the loader. |
23
|
|
|
* This return value will be cached and stored in the database |
24
|
|
|
* There is no file monitoring for this cache. |
25
|
|
|
*/ |
26
|
|
|
public function prepareLoader(Loader $loader, int $type): array |
27
|
|
|
{ |
28
|
|
|
$classNames = []; |
29
|
|
|
$commandPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Command/'; |
30
|
|
|
$controllers = FileUtility::getBaseFilesInDir($commandPath, 'php'); |
31
|
|
|
foreach ($controllers as $controller) { |
32
|
|
|
if ('AbstractCommandController' === $controller) { |
33
|
|
|
continue; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
$className = ClassNamingUtility::getFqnByPath( |
37
|
|
|
$loader->getVendorName(), |
38
|
|
|
$loader->getExtensionKey(), |
39
|
|
|
'Command/' . $controller |
40
|
|
|
); |
41
|
|
|
if (!$loader->isInstantiableClass($className)) { |
42
|
|
|
continue; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
$classNames[] = $className; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
return $classNames; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Run the loading process for the ext_tables.php file. |
53
|
|
|
*/ |
54
|
|
|
public function loadExtensionTables(Loader $loader, array $loaderInformation): void |
55
|
|
|
{ |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Run the loading process for the ext_localconf.php file. |
60
|
|
|
*/ |
61
|
|
|
public function loadExtensionConfiguration(Loader $loader, array $loaderInformation): void |
62
|
|
|
{ |
63
|
|
|
foreach ($loaderInformation as $className) { |
64
|
|
|
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = $className; |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|