Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the acf domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/zycomsol/public_html/megawatt.com.do/wp-includes/functions.php on line 6131
HEX
HEX
Server: Apache
System: Linux host4.dnns.net 3.10.0-1160.144.1.el7.tuxcare.els5.x86_64 #1 SMP Wed May 13 12:31:54 UTC 2026 x86_64
User: zycomsol (1070)
PHP: 7.2.34
Disabled: NONE
Upload Files
File: //scripts/is_update_available
#!/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;