private function wipeOutOldConfigs()
 {
     fwrite($this->debugHandler, '  apache::wipeOutOldConfigs: cleaning ' . $this->settings['system']['apacheconf_vhost'] . "\n");
     $this->logger->logAction(CRON_ACTION, LOG_INFO, "cleaning " . $this->settings['system']['apacheconf_vhost']);
     if (isConfigDir($this->settings['system']['apacheconf_vhost']) && file_exists($this->settings['system']['apacheconf_vhost']) && is_dir($this->settings['system']['apacheconf_vhost'])) {
         $vhost_file_dirhandle = opendir($this->settings['system']['apacheconf_vhost']);
         while (false !== ($vhost_filename = readdir($vhost_file_dirhandle))) {
             if ($vhost_filename != '.' && $vhost_filename != '..' && !in_array($vhost_filename, $this->known_filenames) && preg_match('/^(10|20|30)_syscp_ipandport_(.+)\\.conf$/', $vhost_filename) && file_exists(makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/' . $vhost_filename))) {
                 fwrite($this->debugHandler, '  apache::wipeOutOldConfigs: unlinking ' . $vhost_filename . "\n");
                 $this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'unlinking ' . $vhost_filename);
                 unlink(makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/' . $vhost_filename));
             }
         }
     }
 }
Пример #2
0
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <*****@*****.**> (2003-2009)
 * @author     Froxlor team <*****@*****.**> (2010-)
 * @license    GPLv2 http://files.froxlor.org/misc/COPYING.txt
 * @package    Lib
 *
 */
$configcommand = array();
if (isConfigDir($settings['system']['apacheconf_vhost'])) {
    $configcommand['vhost'] = 'mkdir -p ' . $settings['system']['apacheconf_vhost'];
    $configcommand['include'] = 'echo -e "\\nInclude ' . makeCorrectDir($settings['system']['apacheconf_vhost']) . '*.conf" >> ' . makeCorrectFile(makeCorrectDir('/etc/apache2/httpd.conf'));
    $configcommand['v_inclighty'] = 'echo -e \'\\ninclude_shell "cat ' . makeCorrectDir($settings['system']['apacheconf_vhost']) . '*.conf"\' >> /etc/lighttpd/lighttpd.conf';
} else {
    $configcommand['vhost'] = 'touch ' . $settings['system']['apacheconf_vhost'];
    $configcommand['include'] = 'echo -e "\\nInclude ' . $settings['system']['apacheconf_vhost'] . '" >> ' . makeCorrectFile('/etc/apache2/httpd.conf');
    $configcommand['v_inclighty'] = 'echo -e \'\\ninclude "' . $settings['system']['apacheconf_vhost'] . '"\' >> /etc/lighttpd/lighttpd.conf';
}
if (isConfigDir($settings['system']['apacheconf_diroptions'])) {
    $configcommand['diroptions'] = 'mkdir -p ' . $settings['system']['apacheconf_diroptions'];
    $configcommand['d_inclighty'] = 'echo -e \'\\ninclude_shell "cat ' . makeCorrectDir($settings['system']['apacheconf_diroptions']) . '*.conf"\' >> /etc/lighttpd/lighttpd.conf';
} else {
    $configcommand['diroptions'] = 'touch ' . $settings['system']['apacheconf_diroptions'];
    $configcommand['d_inclighty'] = 'echo -e \'\\ninclude "' . $settings['system']['apacheconf_diroptions'] . '"\' >> /etc/lighttpd/lighttpd.conf';
}
$cfgPath = 'lib/configfiles/';
$configfiles = array();
$configfiles = array_merge(include $cfgPath . 'squeeze.inc.php', include $cfgPath . 'lenny.inc.php', include $cfgPath . 'lucid.inc.php', include $cfgPath . 'hardy.inc.php', include $cfgPath . 'gentoo.inc.php', include $cfgPath . 'suse11.inc.php', include $cfgPath . 'sle10.inc.php', include $cfgPath . 'freebsd.inc.php');
 protected function wipeOutOldHtpasswdConfigs()
 {
     fwrite($this->debugHandler, '  apache::wipeOutOldHtpasswdConfigs: cleaning ' . $this->settings['system']['apacheconf_htpasswddir'] . "\n");
     $this->logger->logAction(CRON_ACTION, LOG_INFO, "cleaning " . $this->settings['system']['apacheconf_htpasswddir']);
     if (isConfigDir($this->settings['system']['apacheconf_htpasswddir']) && file_exists($this->settings['system']['apacheconf_htpasswddir']) && is_dir($this->settings['system']['apacheconf_htpasswddir'])) {
         $htpasswds_file_dirhandle = opendir($this->settings['system']['apacheconf_htpasswddir']);
         while (false !== ($htpasswd_filename = readdir($htpasswds_file_dirhandle))) {
             if ($htpasswd_filename != '.' && $htpasswd_filename != '..' && !in_array($htpasswd_filename, $this->known_htpasswdsfilenames) && file_exists(makeCorrectFile($this->settings['system']['apacheconf_htpasswddir'] . '/' . $htpasswd_filename))) {
                 fwrite($this->debugHandler, '  apache::wipeOutOldHtpasswdConfigs: unlinking ' . $htpasswd_filename . "\n");
                 $this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'unlinking ' . $htpasswd_filename);
                 unlink(makeCorrectFile($this->settings['system']['apacheconf_htpasswddir'] . '/' . $htpasswd_filename));
             }
         }
     }
 }
 protected function wipeOutOldConfigs()
 {
     fwrite($this->debugHandler, '  lighttpd::wipeOutOldConfigs: cleaning ' . $this->settings['system']['apacheconf_vhost'] . "\n");
     $this->logger->logAction(CRON_ACTION, LOG_INFO, "cleaning " . $this->settings['system']['apacheconf_vhost']);
     if (isConfigDir($this->settings['system']['apacheconf_vhost'], true)) {
         $vhost_file_dirhandle = opendir($this->settings['system']['apacheconf_vhost']);
         while (false !== ($vhost_filename = readdir($vhost_file_dirhandle))) {
             if ($vhost_filename != '.' && $vhost_filename != '..' && !in_array($vhost_filename, $this->known_filenames) && preg_match('/^(05|10|20|21|22|30|50|51)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_(.+)\\.conf$/', $vhost_filename) && file_exists(makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/' . $vhost_filename))) {
                 fwrite($this->debugHandler, '  lighttpd::wipeOutOldConfigs: unlinking ' . $vhost_filename . "\n");
                 $this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'unlinking ' . $vhost_filename);
                 unlink(makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/' . $vhost_filename));
             }
         }
     }
     if ($this->settings['phpfpm']['enabled'] == '1') {
         foreach ($this->known_vhostfilenames as $vhostfilename) {
             $known_phpfpm_files[] = preg_replace('/^(05|10|20|21|22|30|50|51)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_/', '', $vhostfilename);
         }
         $configdir = $this->settings['phpfpm']['configdir'];
         $phpfpm_file_dirhandle = opendir($this->settings['phpfpm']['configdir']);
         while (false !== ($phpfpm_filename = readdir($phpfpm_file_dirhandle))) {
             if ($phpfpm_filename != '.' && $phpfpm_filename != '..' && !in_array($phpfpm_filename, $known_phpfpm_files) && file_exists(makeCorrectFile($this->settings['phpfpm']['configdir'] . '/' . $phpfpm_filename))) {
                 fwrite($this->debugHandler, '  lighttpd::wipeOutOldConfigs: unlinking PHP5-FPM ' . $phpfpm_filename . "\n");
                 $this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'unlinking ' . $phpfpm_filename);
                 unlink(makeCorrectFile($this->settings['phpfpm']['configdir'] . '/' . $phpfpm_filename));
             }
         }
     }
 }