Current File : /home/inlingua/public_html/decay_sym/root/var/softaculous/apps/sa/3/install.php |
<?php
function __sa_requirements(){
global $iapps, $globals, $sdata, $softpanel, $error, $centos_dist_ver;
// Check for distribution and architecture
$distro = $globals['WU_DISTRO'];
$arch = arch();
if($arch == 'i386'){
$error[] = 'SpamAssassin cannot be installed on 32-bit Systems';
return false;
}
if(empty($iapps['35_1'])){
$error[] = 'Exim is not installed. Please <a href="index.php?act=apps&app=35">Click Here</a> to install Exim.';
return false;
}
if($distro == 'ubuntu'){
//check whether Exim-Daemon is installed or not.
if($iapps['35_1']['mod'] < 13){
$error[] = 'Please update Exim to install SpamAssassin. <a href="index.php?act=apps_updates">Click Here</a> to update Exim';
return false;
}
// get the distro version(Ubuntu)
$ubuntu_dist_ver = explode('.',wexo('lsb_release -sr'));
$ubuntu_dist_ver = trim($ubuntu_dist_ver[0]);
// Check for incompatible versions
if($ubuntu_dist_ver == '15' || $ubuntu_dist_ver == '17'){
$error[] = 'SpamAssassin cannot be installed on your OS';
return false;
}
}else{
// get the distro version(CentOS)
$centos_dist_ver = trim(wexo("rpm -q --queryformat '%{VERSION}' centos-release"));
// Check for incompatible versions
if($centos_dist_ver == '5'){
$error[] = 'SpamAssassin cannot be installed on your OS';
return false;
}
}
}
function __sa_install(){
global $error, $softpanel, $infos, $iapps;
// Skip the installatiopn process if reinstalling for some reason.
if(file_exists('/usr/bin/spamassassin')){
return true;
}
yum('spamassassin');
if(!file_exists('/usr/bin/spamassassin') || !file_exists('/usr/bin/spamassassin')){
$error[] = "SpamAssassin was not installed, Check Webuzo Error logs for more details";
return false;
}
// Restart the service
vexec('service spamassassin restart');
}
function __sa_after_save_install(){
global $infos, $iapps, $fresh_install, $globals;
$service = 'service spamassassin restart';
$distro = $globals['WU_DISTRO'];
if($distro == 'ubuntu'){
vexec($service);
}else{
// Update SA database
vexec('sa-update --nogpg');
}
// Restart the service once more to be on the safe side
vexec($service);
}