|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* MikoPBX - free phone system for small business |
|
4
|
|
|
* Copyright © 2017-2024 Alexey Portnov and Nikolay Beketov |
|
5
|
|
|
* |
|
6
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
7
|
|
|
* it under the terms of the GNU General Public License as published by |
|
8
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
|
9
|
|
|
* (at your option) any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* This program is distributed in the hope that it will be useful, |
|
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14
|
|
|
* GNU General Public License for more details. |
|
15
|
|
|
* |
|
16
|
|
|
* You should have received a copy of the GNU General Public License along with this program. |
|
17
|
|
|
* If not, see <https://www.gnu.org/licenses/>. |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
namespace MikoPBX\PBXCoreREST\Lib\License; |
|
21
|
|
|
|
|
22
|
|
|
use MikoPBX\Common\Models\PbxSettingsConstants; |
|
23
|
|
|
use MikoPBX\Common\Providers\MarketPlaceProvider; |
|
24
|
|
|
use MikoPBX\Core\System\MikoPBXConfig; |
|
25
|
|
|
use MikoPBX\PBXCoreREST\Lib\PBXApiResult; |
|
26
|
|
|
use Phalcon\Di; |
|
27
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Class ResetLicenseAction |
|
31
|
|
|
* Reset license key. |
|
32
|
|
|
* |
|
33
|
|
|
* @property \MikoPBX\Common\Providers\MarketPlaceProvider license |
|
34
|
|
|
* @package MikoPBX\PBXCoreREST\Lib\Modules |
|
35
|
|
|
*/ |
|
36
|
|
|
class ResetLicenseAction extends \Phalcon\Di\Injectable |
|
37
|
|
|
{ |
|
38
|
|
|
/** |
|
39
|
|
|
* Reset license key. |
|
40
|
|
|
* |
|
41
|
|
|
* @return PBXApiResult An object containing the result of the API call. |
|
42
|
|
|
*/ |
|
43
|
|
|
public static function main(array $data): PBXApiResult |
|
|
|
|
|
|
44
|
|
|
{ |
|
45
|
|
|
$mikoPBXConfig = new MikoPBXConfig(); |
|
46
|
|
|
$res = new PBXApiResult(); |
|
47
|
|
|
$res->processor = __METHOD__; |
|
48
|
|
|
$mikoPBXConfig->resetGeneralSettings(PbxSettingsConstants::PBX_LICENSE); |
|
49
|
|
|
$res->success = true; |
|
50
|
|
|
$di = Di::getDefault(); |
|
51
|
|
|
$license = $di->get(MarketPlaceProvider::SERVICE_NAME); |
|
52
|
|
|
$license->changeLicenseKey(''); |
|
53
|
|
|
return $res; |
|
54
|
|
|
} |
|
55
|
|
|
} |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.