Issues (2963)

app/Http/Controllers/AboutController.php (1 issue)

1
<?php
2
/**
3
 * AboutController.php
4
 *
5
 * -Description-
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
18
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19
 *
20
 * @link       https://www.librenms.org
21
 *
22
 * @copyright  2018 Tony Murray
23
 * @author     Tony Murray <[email protected]>
24
 */
25
26
namespace App\Http\Controllers;
27
28
use App;
29
use App\Models\Application;
30
use App\Models\Callback;
31
use App\Models\Device;
32
use App\Models\DiskIo;
33
use App\Models\EntPhysical;
34
use App\Models\Eventlog;
35
use App\Models\HrDevice;
36
use App\Models\Ipv4Address;
37
use App\Models\Ipv4Network;
38
use App\Models\Ipv6Address;
39
use App\Models\Ipv6Network;
40
use App\Models\Mempool;
41
use App\Models\Port;
42
use App\Models\PrinterSupply;
43
use App\Models\Processor;
44
use App\Models\Pseudowire;
45
use App\Models\Sensor;
46
use App\Models\Service;
47
use App\Models\Sla;
48
use App\Models\Storage;
49
use App\Models\Syslog;
50
use App\Models\Vlan;
51
use App\Models\Vrf;
52
use App\Models\WirelessSensor;
53
use Illuminate\Http\Request;
54
use LibreNMS\Config;
55
use LibreNMS\DB\Eloquent;
56
use LibreNMS\Util\Version;
57
58
class AboutController extends Controller
59
{
60
    public function index(Request $request)
61
    {
62
        $callback_status = Callback::get('enabled') === '1';
63
        $version = Version::get();
64
65
        return view('about.index', [
66
            'callback_status' => $callback_status,
67
            'callback_uuid'   => $callback_status ? Callback::get('uuid') : null,
0 ignored issues
show
The condition $callback_status is always false.
Loading history...
68
69
            'db_schema' => vsprintf('%s (%s)', $version->database()),
70
            'git_log'   => $version->gitChangelog(),
71
            'git_date'  => $version->gitDate(),
72
            'project_name' => Config::get('project_name'),
73
74
            'version_local'     => $version->local(),
75
            'version_mysql'     => Eloquent::version(),
76
            'version_php'       => phpversion(),
77
            'version_laravel'   => App::VERSION(),
78
            'version_python'    => Version::python(),
79
            'version_webserver' => $request->server('SERVER_SOFTWARE'),
80
            'version_rrdtool'   => str_replace('1.7.01.7.0', '1.7.0', implode(' ', array_slice(explode(' ', shell_exec(
81
                Config::get('rrdtool', 'rrdtool') . ' --version | head -n1'
82
            )), 1, 1))),
83
            'version_netsnmp'   => str_replace('version: ', '', rtrim(shell_exec(Config::get('snmpget', 'snmpget') . ' -V 2>&1'))),
84
85
            'stat_apps'       => Application::count(),
86
            'stat_devices'    => Device::count(),
87
            'stat_diskio'     => DiskIo::count(),
88
            'stat_entphys'    => EntPhysical::count(),
89
            'stat_events'     => Eventlog::count(),
90
            'stat_hrdev'      => HrDevice::count(),
91
            'stat_ipv4_addy'  => Ipv4Address::count(),
92
            'stat_ipv4_nets'  => Ipv4Network::count(),
93
            'stat_ipv6_addy'  => Ipv6Address::count(),
94
            'stat_ipv6_nets'  => Ipv6Network::count(),
95
            'stat_memory'     => Mempool::count(),
96
            'stat_ports'      => Port::count(),
97
            'stat_processors' => Processor::count(),
98
            'stat_pw'         => Pseudowire::count(),
99
            'stat_sensors'    => Sensor::count(),
100
            'stat_services'   => Service::count(),
101
            'stat_slas'       => Sla::count(),
102
            'stat_storage'    => Storage::count(),
103
            'stat_syslog'     => Syslog::count(),
104
            'stat_toner'      => PrinterSupply::count(),
105
            'stat_vlans'      => Vlan::count(),
106
            'stat_vrf'        => Vrf::count(),
107
            'stat_wireless'   => WirelessSensor::count(),
108
        ]);
109
    }
110
}
111