Passed
Push — develop ( feccd5...fd2e7b )
by Портнов
04:48
created

UpdateConfigsUpToVer202301225   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 12
c 1
b 0
f 0
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A processUpdate() 0 14 1
1
<?php
2
/*
3
 * MikoPBX - free phone system for small business
4
 * Copyright (C) 2017-2020 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\Core\System\Upgrade\Releases;
21
22
use MikoPBX\Common\Models\Codecs;
23
use MikoPBX\Common\Models\Extensions;
24
use MikoPBX\Common\Models\FirewallRules;
25
use MikoPBX\Common\Models\NetworkFilters;
26
use MikoPBX\Common\Models\PbxSettings;
27
use MikoPBX\Common\Models\Sip;
28
use MikoPBX\Core\System\Processes;
29
use MikoPBX\Core\System\Upgrade\UpgradeSystemConfigInterface;
30
use MikoPBX\Core\System\Util;
31
use Phalcon\Di\Injectable;
32
33
class UpdateConfigsUpToVer202301225 extends Injectable implements UpgradeSystemConfigInterface
34
{
35
  	public const PBX_VERSION = '2023.1.225';
36
37
	/**
38
     * Class constructor.
39
     */
40
    public function __construct()
41
    {
42
    }
43
44
    /**
45
     * https://github.com/mikopbx/Core/issues/269
46
     */
47
    public function processUpdate():void
48
    {
49
        $pathCp = Util::which('cp');
50
        $pathRm = Util::which('rm');
51
        $converter = Util::which('wav2mp3.sh');
52
53
        $cmd = [
54
            "$pathRm /storage/usbdisk1/mikopbx/media/custom/miko_hello.* /storage/usbdisk1/mikopbx/media/custom/out_work_times.*" ,
55
            "$pathCp /offload/asterisk/sounds/other/* /storage/usbdisk1/mikopbx/media/custom/",
56
            "$converter /storage/usbdisk1/mikopbx/media/custom/out_work_times",
57
            "$converter /storage/usbdisk1/mikopbx/media/custom/miko_hello",
58
            "$pathCp /offload/asterisk/sounds/other/* /storage/usbdisk1/mikopbx/media/custom/",
59
        ];
60
        Processes::mwExecCommands($cmd);
61
    }
62
63
}