| Server IP : 162.214.74.102 / Your IP : 216.73.217.80 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/scripts/ |
Upload File : |
#!/usr/local/cpanel/3rdparty/bin/perl
# Copyright 2026 WebPros International, LLC
# All rights reserved.
# copyright@cpanel.net http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited.
package scripts::is_update_available;
use strict;
use warnings;
use Cpanel::Update::Tiers ();
use Cpanel::Update::Config ();
use Cpanel::Update::Logger ();
use Cpanel::Version::Tiny ();
exit( __PACKAGE__->script(@ARGV) ) unless caller;
sub script {
my ( $class, @args ) = @_;
my $verbose = 0;
foreach my $arg (@args) {
if ( $arg eq '-v' || $arg eq '--verbose' ) {
$verbose = 1;
}
elsif ( $arg eq '-h' || $arg eq '--help' ) {
print _usage();
return 0;
}
else {
print STDERR "Unknown argument: $arg\n\n" . _usage();
return 2;
}
}
my $current_tier = Cpanel::Update::Config::load()->{'CPANEL'} // 'unknown';
my $our_version = $Cpanel::Version::Tiny::VERSION_BUILD;
my $target_version;
if ( Cpanel::Update::Tiers->is_explicit_version($current_tier) ) {
# CPANEL is pinned to an explicit 11.X.X.X build, so the tier
# itself is the target. Skip the mirror sync entirely.
$target_version = $current_tier;
}
else {
# Cpanel::HttpRequest (called from sync_tiers_file) emits
# info-level messages through this logger. Raise the threshold
# to 'fatal' so info()/warning()/error() short-circuit and
# never reach the log() path, keeping the script silent by
# default.
my $logger = Cpanel::Update::Logger->new( { stdout => 0, log_level => 'fatal' } );
my $tiers = Cpanel::Update::Tiers->new( logger => $logger );
# Force a fresh fetch from the mirrors so the answer reflects
# the current upstream state regardless of any local cache age.
eval { $tiers->sync_tiers_file(); 1 } or do {
warn $@ if $verbose;
return 1;
};
$target_version = $tiers->get_remote_version_for_tier($current_tier);
}
if ( !defined $target_version ) {
print "Unable to determine target version for tier '$current_tier'\n";
return 1;
}
if ( $target_version eq $our_version ) {
print "Up to date\n" if $verbose;
return 1;
}
print "New Version $target_version available\n" if $verbose;
return 0;
}
sub _usage {
return <<'EOM';
Usage: is_update_available [--verbose|-v]
Determines whether the installed cPanel & WHM version matches the
version currently advertised by the httpupdate mirrors. If the
CPANEL setting in /etc/cpupdate.conf is pinned to an explicit
11.X.X.X build, that build is compared directly without contacting
the mirrors.
Exit status:
0 An update is available (installed version does not match).
1 No update is available (installed version matches, or the
target could not be determined).
2 Invalid command-line arguments.
Options:
-v, --verbose Print "Up to date" or "New Version X.X.X.X available"
before exiting.
-h, --help Show this help and exit 0.
EOM
}
1;