#!/usr/bin/perl
#
#Copyright (c) 2001-2005 cPanel, Inc.
#
#This auto install script, "upgrade" is hereinafter referred to as the "Software."  No other parts of this package
#will be considered, infered or implied to be part of the the "Software."
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
#documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
#rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
#permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
#Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
#WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
#COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
#OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
######################################################################################
                                                                                                                             
BEGIN {
	push(@INC,"/usr/local/cpanel");
}

use IPC::Open3;
use SafeFile;
require '/scripts/regsrep.pl';

#VARIBLES
my $domain = '%domain%';
my $installpath = '%installpath%';
my $modulename = '%modulename%';
my $modulepath = '%modulepath%';
my $homedir = '%homedir%';
my $user = '%user%';
my $installdir = '%installdir%';
my $publichtml = '%public_html%';
my $sqldb = '%sqldb%';
my $sqluser = '%sqluser%';
my $sqlpass = '%sqlpass%';
my $sqlserver = '%sqlhost%';
my $username = '%username%';
my $password = '%password%';
my $system = `uname -s`;
chomp($system);

print "We are installing in $installdir...\n";

rename("${installdir}/nucleus/libs/xmlrpc.inc.php","${installdir}/nucleus/libs/xmlrpc.inc.php.up");
rename("${installdir}/nucleus/libs/xmlrpcs.inc.php","${installdir}/nucleus/libs/xmlrpcs.inc.php.up");
rename("${installdir}/nucleus/xmlrpc/server.php","${installdir}/nucleus/xmlrpc/server.php.up");
rename("${installdir}/nucleus/libs/globalfunctions.php","${installdir}/nucleus/libs/globalfunctions.php.up");

rename("${installdir}/cpanel-upgrade/pkg/nucleus/libs/xmlrpc.inc.php","${installdir}/nucleus/libs/xmlrpc.inc.php");
rename("${installdir}/cpanel-upgrade/pkg/nucleus/libs/xmlrpcs.inc.php","${installdir}/nucleus/libs/xmlrpcs.inc.php");
rename("${installdir}/cpanel-upgrade/pkg/nucleus/libs/globalfunctions.php","${installdir}/nucleus/libs/globalfunctions.php");
rename("${installdir}/cpanel-upgrade/pkg/nucleus/xmlrpc/server.php","${installdir}/nucleus/xmlrpc/server.php");

print "<b>Complete!</b>\n";

print "<br>You can access your upgraded Nucleus installation at: <a href=\"http://$domain$installpath/\">http://${domain}${installpath}/</a><br>\n";
print "<br><br>\n";
