Skip to content

Commit 5d54be8

Browse files
author
pedro_morgan
committed
Tidy up theispconfig install function
1 parent 76b6b67 commit 5d54be8

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

install/lib/installer_base.lib.php

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -630,41 +630,37 @@ public function install_ispconfig()
630630
}
631631

632632
public function install_crontab()
633-
{
634-
global $conf;
635-
636-
// Root Crontab
637-
exec("crontab -u root -l > crontab.txt");
633+
{
634+
//* Root Crontab
635+
exec('crontab -u root -l > crontab.txt');
638636
$existing_root_cron_jobs = file('crontab.txt');
639637

640638
$root_cron_jobs = array('* * * * * /usr/bin/php -q /usr/local/ispconfig/server/server.php &> /dev/null');
641639
foreach($root_cron_jobs as $cron_job) {
642-
if(!in_array($cron_job."\n",$existing_root_cron_jobs)) {
640+
if(!in_array($cron_job."\n", $existing_root_cron_jobs)) {
643641
$existing_root_cron_jobs[] = $cron_job."\n";
644642
}
645643
}
646-
file_put_contents('crontab.txt',$existing_root_cron_jobs);
647-
exec("crontab -u root crontab.txt &> /dev/null");
644+
file_put_contents('crontab.txt', $existing_root_cron_jobs);
645+
exec('crontab -u root crontab.txt &> /dev/null');
648646
unlink('crontab.txt');
649647

650-
// Getmail crontab
651-
exec("crontab -u getmail -l > crontab.txt");
648+
//* Getmail crontab
649+
$cf = $this->conf['dist']['getmail'];
650+
exec('crontab -u getmail -l > crontab.txt');
652651
$existing_cron_jobs = file('crontab.txt');
653652

654-
$cron_jobs = array('*/5 * * * * '.$conf["dist"]["getmail"]["program"].' -g '.$conf["dist"]["getmail"]["config_dir"].' -r '.$conf["dist"]["getmail"]["config_dir"].'/*.conf &> /dev/null');
653+
$cron_jobs = array('*/5 * * * * '.$cf['program'].' -g '.$cf['config_dir'].' -r '.$cf['config_dir'].'/*.conf &> /dev/null');
655654
foreach($cron_jobs as $cron_job) {
656-
if(!in_array($cron_job."\n",$existing_cron_jobs)) {
655+
if(!in_array($cron_job."\n", $existing_cron_jobs)) {
657656
$existing_cron_jobs[] = $cron_job."\n";
658657
}
659658
}
660-
file_put_contents('crontab.txt',$existing_cron_jobs);
661-
exec("crontab -u getmail crontab.txt &> /dev/null");
659+
file_put_contents('crontab.txt', $existing_cron_jobs);
660+
exec('crontab -u getmail crontab.txt &> /dev/null');
662661
unlink('crontab.txt');
663-
664662
}
665663

666-
667-
668664
}
669665

670-
?>
666+
?>

0 commit comments

Comments
 (0)