|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* MikoPBX - free phone system for small business |
|
5
|
|
|
* Copyright © 2017-2023 Alexey Portnov and Nikolay Beketov |
|
6
|
|
|
* |
|
7
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
8
|
|
|
* it under the terms of the GNU General Public License as published by |
|
9
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
|
10
|
|
|
* (at your option) any later version. |
|
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 General Public License for more details. |
|
16
|
|
|
* |
|
17
|
|
|
* You should have received a copy of the GNU General Public License along with this program. |
|
18
|
|
|
* If not, see <https://www.gnu.org/licenses/>. |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace MikoPBX\PBXCoreREST\Controllers\Modules; |
|
22
|
|
|
|
|
23
|
|
|
use MikoPBX\PBXCoreREST\Controllers\BaseController; |
|
24
|
|
|
use MikoPBX\PBXCoreREST\Lib\ModulesManagementProcessor; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Handles the POST request for module manipulation actions. |
|
28
|
|
|
* |
|
29
|
|
|
* @RoutePrefix("/pbxcore/api/modules/core") |
|
30
|
|
|
*/ |
|
31
|
|
|
class CorePostController extends BaseController |
|
32
|
|
|
{ |
|
33
|
|
|
/** |
|
34
|
|
|
* Handles the call to different actions based on the action name for core |
|
35
|
|
|
* |
|
36
|
|
|
* @param string $actionName The name of the action |
|
37
|
|
|
* |
|
38
|
|
|
* Starts the module download in a separate background process. |
|
39
|
|
|
* @Post("/moduleStartDownload") |
|
40
|
|
|
* |
|
41
|
|
|
* Returns the download status of a module. |
|
42
|
|
|
* @Post("/moduleDownloadStatus") |
|
43
|
|
|
* |
|
44
|
|
|
* Installs a new additional extension module from an early uploaded zip archive. |
|
45
|
|
|
* @Post("/installNewModule") |
|
46
|
|
|
* |
|
47
|
|
|
* Checks the status of a module installation by the provided zip file path. |
|
48
|
|
|
* @Post("/statusOfModuleInstallation") |
|
49
|
|
|
* |
|
50
|
|
|
* Enables an extension module. |
|
51
|
|
|
* @Post("/enableModule") |
|
52
|
|
|
* |
|
53
|
|
|
* Disables an extension module. |
|
54
|
|
|
* @Post("/disableModule") |
|
55
|
|
|
* |
|
56
|
|
|
* Uninstall an extension module. |
|
57
|
|
|
* @Post("/uninstallModule") |
|
58
|
|
|
* |
|
59
|
|
|
* @return void |
|
60
|
|
|
*/ |
|
61
|
|
|
public function callAction(string $actionName): void |
|
62
|
|
|
{ |
|
63
|
|
|
$data = $this->request->getPost(); |
|
64
|
|
|
$this->sendRequestToBackendWorker(ModulesManagementProcessor::class, $actionName, $data); |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|