whoami7 - Manager
:
/
proc
/
self
/
root
/
usr
/
local
/
nexuscore
/
plugin
/
cpanel
/
nexuscore-stats
/
Upload File:
files >> //proc/self/root/usr/local/nexuscore/plugin/cpanel/nexuscore-stats/NexuscoreMssqlStats.pm
package Cpanel::ResourceUsage::Custom::NexuscoreMssqlStats; use strict; use warnings; use Cpanel (); use Cpanel::API (); use Cpanel::Locale (); use Cpanel::Logger (); use Cpanel::AdminBin::Call (); # This feature expects each custom module to contain a "get_usages" function # that returns an array of hashes, with each hash matching the parameters below: sub get_usages { my ($username) = @_; my $sqlEnabled = _get_package_variable($username,"enable_sql_server="); my $maxDatabases = _get_package_variable($username,"sql_server_max_databases="); my $currentDbCount = Cpanel::AdminBin::Call::call('NexusCore', 'SqlServer', 'COUNTDBS', $username); if($sqlEnabled eq 'y') { return ( { id => 'nexuscore_mssql_limit', #string, not displayed description => 'SQL ServerĀ® Databases', #string, displayed usage => $currentDbCount, #nonnegative integer maximum => $maxDatabases, #optional, nonnegative integer before => 'mysql_databases', #optional, to display immediately before another entry url => 'mssql/index.live.php', #optional, to display immediately before another entry }, ); } return; } sub _get_package_variable { my ($username,$variable) = @_; Cpanel::Logger->new()->warn("Starting SQL check"); my $filename = "/var/cpanel/users/$username"; my $found; open( my $fh, '<', $filename ) or ( Cpanel::Logger->new()->warn("can't open file $filename: $!") && die "Can't open $filename: $!" ); while ( my $line = <$fh> ) { if ( $line =~ /$variable/ ) { $line =~ s/$variable//; $line =~ s/\s+//g; $found = $line; last; } } close $fh; return $found; } 1;
Copyright ©2021 || Defacer Indonesia