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/scripts.20110531.215904.25158/cleangd
#!/usr/bin/perl
# cpanel10 - cleangd                         Copyright(c) 1997-2006 cPanel, Inc.
#                                                           All Rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

use strict;
use warnings;
use File::Find;

my $verbose    = ( @ARGV && grep { /--verbose/ } @ARGV ) ? 1 : 0;
my $clean_only = ( @ARGV && grep { /--quit/ } @ARGV )    ? 1 : 0;

### Clean CPAN cache
print 'Resetting CPAN caches ...';
print "\n" if $verbose;
foreach my $dir (qw( /root/.cpan /home/.cpan )) {
    if ( -d $dir ) {
        print "Removing directory $dir\n" if $verbose;
        system 'rm', '-rf', $dir;
    }
}
print "Done\n";

### Check compilers
system '/scripts/checkccompiler';

### Perl Module
print 'Cleaning old Perl GD installation ...';
print "\n" if $verbose;
my @items_to_remove;
my $cleangd = sub {
    return if ( $_ ne 'GD' && $_ ne 'GD.pm' );
    push @items_to_remove, $File::Find::name;
};
foreach my $dir (qw( /usr/lib/perl5 /usr/local/lib/perl5 /usr/lib64/perl5 )) {
    next if !-d $dir;
    File::Find::find( $cleangd, $dir );
}
foreach my $item (@items_to_remove) {
    if ( -d $item ) {
        print "Removing directory $item\n" if $verbose;
        system 'rm', '-rf', $item;
    }
    else {
        print "Removing file $item\n" if $verbose;
        unlink $item;
    }
}
print "Done\n";

### Clean System Files
print 'Cleaning GD libraries and include files ...';
print "\n" if $verbose;
my @gd_files = qw(
  entities.h
  gd.h
  gd_io.h
  gdcache.h
  gdfontg.h
  gdfontl.h
  gdfontmb.h
  gdfonts.h
  gdfontt.h
  gdfx.h
  gdhelpers.h
  libgd.a
  libgd.so
  libgd.so.2
  libgd.so.2.0.0
  annotate
  bdftogd
  gd2copypal
  gd2topng
  gdlib-config
  gdparttopng
  gdtopng
  pngtogd
  pngtogd2
  webpng
);

foreach my $dir (qw( /usr/bin /usr/local/bin /usr/lib /usr/local/lib /usr/include /usr/local/include )) {
    foreach my $file (@gd_files) {
        if ( -e $dir . '/' . $file && -f _ ) {
            print "Removing $dir/$file\n" if $verbose;
            unlink $dir . '/' . $file;
        }
    }
}
print "Done\n";

### Reinstall
if ($clean_only) {
    exit 0;
}
else {
    exec '/scripts/installgd';
}

die "Failed to reinstall GD: $!";