MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //proc/self/root/proc/self/root/scripts.20110531.215904.25158/check_system_storable
#!/usr/bin/perl
# cpanel - check_system_storable                  Copyright(c) 2010 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

BEGIN { unshift @INC, '/usr/local/cpanel'; }

use strict;
use warnings;
use Storable;

my $unlink = 0;
my $file   = "/tmp/ensure_store.$$";

if ( @ARGV && -e $ARGV[0] ) {
    $file = $ARGV[0];
}
else {
    warn "Specified file does not exist, defaulting to $file...";
    $unlink = 1;
}

if ( !-e $file ) {

    # create cPanel Storable data store
    system '/usr/local/cpanel/whostmgr/bin/whostmgr', '--make_test_store', $file;
    die "Could not make $file" if !-e $file;
}

my $hr;

# Load cPanel Storable data store with system's Storable
eval {
    $hr = retrieve($file);    # load it with 'binary's Storbale'
};

unlink $file if $unlink;      # quietly remove it if we created it

if ( $@ =~ m{Byte order} || ref $hr ne 'hashref' || $hr->{'test'} ne 'storable' ) {

    # down load and untar tarball

    print "Incompatibility between system Storable and cPanel's Storable detected!\n";

    #require '/scripts/Cpanel/HttpRequest.pm';
    #
    #my $os = 'TODO';
    #my $targz = "$file.tar.gz";
    #
    #Cpanel::HttpRequest->new()->request(
    #    'host'     => 'layer1.cpanel.net',
    #    'url'      => '/perl/$os/perl.tar.gz',
    #    'destfile' => $targz,
    #) || die 'Could not download tarball';
    #
    #die 'Tarball download failed' if !-e $targz || -z $targz;
    #
    #chdir '/usr/local/cpanel' or die "Could not go intop /usr/local : $!";
    #
    #system qw(tar xzf), $targz;
    #
    #unlink $targz or warn "Unable to remove $targz: $!";
}