Commit ccbf1497 authored by Till Brehm's avatar Till Brehm

- Added templating library to installer.

- Added function to detect the apache version to installer.
- Added support for apache 2.4 to vhots templates for ispconfig vhost and apps vhost in installer.
parent b846a278
......@@ -645,10 +645,12 @@ class installer_dist extends installer_base {
$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
// copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.conf.master', 'tpl/apache_ispconfig.conf.master');
$tpl = new tpl('apache_ispconfig.conf.master');
$tpl->setVar('apache_version',getapacheversion());
$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
$ip_addresses = array();
if(is_array($records) && count($records) > 0) {
foreach($records as $rec) {
if($rec['ip_type'] == 'IPv6') {
......@@ -661,15 +663,15 @@ class installer_dist extends installer_base {
foreach($ports as $port) {
$port = intval($port);
if($port > 0 && $port < 65536 && $ip_address != '') {
$content .= 'NameVirtualHost '.$ip_address.":".$port."\n";
$ip_addresses[] = array('ip_address' => $ip_address, 'port' => $port);
}
}
}
}
}
$content .= "\n";
wf($vhost_conf_dir.'/ispconfig.conf', $content);
wf($vhost_conf_dir.'/ispconfig.conf', $tpl->grab());
unset($tpl);
if(!@is_link($vhost_conf_enabled_dir."/000-ispconfig.conf")) {
exec("ln -s ".$vhost_conf_dir."/ispconfig.conf ".$vhost_conf_enabled_dir."/000-ispconfig.conf");
......@@ -1033,28 +1035,30 @@ class installer_dist extends installer_base {
// Dont just copy over the virtualhost template but add some custom settings
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.vhost.master', "tpl/apache_ispconfig.vhost.master");
$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
$tpl = new tpl('apache_ispconfig.vhost.master');
$tpl->setVar('vhost_port',$conf['apache']['vhost_port']);
// comment out the listen directive if port is 80 or 443
if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
$content = str_replace('{vhost_port_listen}', '#', $content);
$tpl->setVar('vhost_port_listen','#');
} else {
$content = str_replace('{vhost_port_listen}', '', $content);
$tpl->setVar('vhost_port_listen','');
}
if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
$content = str_replace('{ssl_comment}', '', $content);
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
$tpl->setVar('ssl_comment','');
} else {
$content = str_replace('{ssl_comment}', '#', $content);
$tpl->setVar('ssl_comment','#');
}
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key') && is_file($install_dir.'/interface/ssl/ispserver.bundle')) {
$content = str_replace('{ssl_bundle_comment}', '', $content);
$tpl->setVar('ssl_bundle_comment','');
} else {
$content = str_replace('{ssl_bundle_comment}', '#', $content);
$tpl->setVar('ssl_bundle_comment','#');
}
$tpl->setVar('apache_version',getapacheversion());
wf("$vhost_conf_dir/ispconfig.vhost", $content);
wf($vhost_conf_dir.'/ispconfig.vhost', $tpl->grab());
//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
//* and create the symlink
......
......@@ -495,6 +495,7 @@ class installer extends installer_base
//* Copy the ISPConfig configuration include
/*
$content = $this->get_template_file('apache_ispconfig.conf', true);
$records = $this->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ".$conf["server_id"]." AND virtualhost = 'y'");
......@@ -507,6 +508,35 @@ class installer extends installer_base
}
$this->write_config_file($conf['apache']['vhost_conf_dir'].'/000-ispconfig.conf', $content);
*/
$tpl = new tpl('apache_ispconfig.conf.master');
$tpl->setVar('apache_version',getapacheversion());
$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
$ip_addresses = array();
if(is_array($records) && count($records) > 0) {
foreach($records as $rec) {
if($rec['ip_type'] == 'IPv6') {
$ip_address = '['.$rec['ip_address'].']';
} else {
$ip_address = $rec['ip_address'];
}
$ports = explode(',', $rec['virtualhost_port']);
if(is_array($ports)) {
foreach($ports as $port) {
$port = intval($port);
if($port > 0 && $port < 65536 && $ip_address != '') {
$ip_addresses[] = array('ip_address' => $ip_address, 'port' => $port);
}
}
}
}
}
wf($conf['apache']['vhost_conf_dir'].'/000-ispconfig.conf', $tpl->grab());
unset($tpl);
//* Gentoo by default does not include .vhost files. Add include line to config file.
$content = rf($conf['apache']['config_file']);
......
......@@ -660,10 +660,12 @@ class installer_dist extends installer_base {
$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
//copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.conf.master', 'tpl/apache_ispconfig.conf.master');
$tpl = new tpl('apache_ispconfig.conf.master');
$tpl->setVar('apache_version',getapacheversion());
$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
$ip_addresses = array();
if(is_array($records) && count($records) > 0) {
foreach($records as $rec) {
if($rec['ip_type'] == 'IPv6') {
......@@ -676,15 +678,15 @@ class installer_dist extends installer_base {
foreach($ports as $port) {
$port = intval($port);
if($port > 0 && $port < 65536 && $ip_address != '') {
$content .= 'NameVirtualHost '.$ip_address.":".$port."\n";
$ip_addresses[] = array('ip_address' => $ip_address, 'port' => $port);
}
}
}
}
}
$content .= "\n";
wf($vhost_conf_dir.'/ispconfig.conf', $content);
wf($vhost_conf_dir.'/ispconfig.conf', $tpl->grab());
unset($tpl);
if(!@is_link($vhost_conf_enabled_dir."/000-ispconfig.conf")) {
exec("ln -s ".$vhost_conf_dir."/ispconfig.conf ".$vhost_conf_enabled_dir."/000-ispconfig.conf");
......@@ -1089,31 +1091,30 @@ class installer_dist extends installer_base {
// Dont just copy over the virtualhost template but add some custom settings
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.vhost.master', "tpl/apache_ispconfig.vhost.master");
$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
$tpl = new tpl('apache_ispconfig.vhost.master');
$tpl->setVar('vhost_port',$conf['apache']['vhost_port']);
// comment out the listen directive if port is 80 or 443
if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
$content = str_replace('{vhost_port_listen}', '#', $content);
$tpl->setVar('vhost_port_listen','#');
} else {
$content = str_replace('{vhost_port_listen}', '', $content);
$tpl->setVar('vhost_port_listen','');
}
if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
$content = str_replace('{ssl_comment}', '', $content);
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
$tpl->setVar('ssl_comment','');
} else {
$content = str_replace('{ssl_comment}', '#', $content);
$tpl->setVar('ssl_comment','#');
}
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key') && is_file($install_dir.'/interface/ssl/ispserver.bundle')) {
$content = str_replace('{ssl_bundle_comment}', '', $content);
$tpl->setVar('ssl_bundle_comment','');
} else {
$content = str_replace('{ssl_bundle_comment}', '#', $content);
$tpl->setVar('ssl_bundle_comment','#');
}
$tpl->setVar('apache_version',getapacheversion());
$content = str_replace('/var/www/', '/srv/www/', $content);
wf("$vhost_conf_dir/ispconfig.vhost", $content);
wf($vhost_conf_dir.'/ispconfig.vhost', $tpl->grab());
//if(!is_file('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
......
......@@ -65,6 +65,9 @@ if(realpath(dirname(__FILE__)) != $cur_dir) {
define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log');
define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../'));
//** Include the templating lib
require_once 'lib/classes/tpl.inc.php';
//** Check for existing installation
/*if(is_dir("/usr/local/ispconfig")) {
die('We will stop here. There is already a ISPConfig installation, use the update script to update this installation.');
......
This diff is collapsed.
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP version 4.0 |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002 Active Fish Group |
// +----------------------------------------------------------------------+
// | Authors: Kelvin Jones <kelvin@kelvinjones.co.uk> |
// +----------------------------------------------------------------------+
//
// $Id: cache.php,v 1.1 2003/07/08 12:32:06 platinum Exp $
/**
* Class uses all of vlibTemplate's functionality but caches the template files.
* It creates an identical tree structure to your filesystem but with cached files.
*
* @author Kelvin Jones <kelvin@kelvinjones.co.uk>
* @since 22/02/2002
* @package vLIB
* @access public
*/
class tplc extends tpl {
/*-----------------------------------------------------------------------------\
| DO NOT TOUCH ANYTHING IN THIS CLASS, IT MAY NOT WORK OTHERWISE |
\-----------------------------------------------------------------------------*/
var $_cache = 1; // tells vlibTemplate that we're caching
var $_cachefile; // full path to current cache file (even if it doesn't yet exist)
var $_cacheexists; // has this file been cached before
var $_cachefilelocked; // is this file currently locked whilst writing
var $_cachefiledir; // dir of current cache file
var $_clearcache = 0;
/**
* FUNCTION: clearCache
* will unset a file, and set $this->_cacheexists to 0.
*
* @access public
* @return boolean
*/
function clearCache() {
$this->_clearcache = 1;
return true;
}
/**
* FUNCTION: recache
* alias for clearCache().
*
* @access public
* @return boolean
*/
function recache() {
return $this->clearCache();
}
/**
* FUNCTION: setCacheLifeTime
* sets the lifetime of the cached file
*
* @param int $int number of seconds to set lifetime to
* @access public
* @return boolean
*/
function setCacheLifeTime($int = null) {
if ($int == null || !is_int($int)) return false;
if ($int == 0) $int = 60;
if ($int == -1) $int = 157680000; // set to 5 yrs time
$this->OPTIONS['CACHE_LIFETIME'] = $int;
return true;
}
/**
* FUNCTION: setCacheExtension
* sets the extention of the cache file
*
* @param str $str name of new cache extention
* @access public
* @return boolean
*/
function setCacheExtension($str = null) {
if ($str == null || !preg_match('/^[a-z0-9]+$/', strtolower($str))) return false;
$this->OPTIONS['CACHE_EXTENSION'] = strtolower($str);
return true;
}
/*----------------------------------------\
Private Functions
-----------------------------------------*/
/**
* FUNCTION: _checkCache
* checks if there's a cache, if there is then it will read the cache file as the template.
*/
function _checkCache ($tmplfile) {
$this->_cachefile = $this->_getFilename($tmplfile);
if ($this->_clearcache) {
if (file_exists($this->_cachefile)) unlink($this->_cachefile);
return false;
}
if (file_exists($this->_cachefile)) {
$this->_cacheexists = 1;
// if it's expired
if ((filemtime($this->_cachefile) + $this->OPTIONS['CACHE_LIFETIME']) < date('U')
|| filectime($this->_cachefile) < filemtime($tmplfile)) {
$this->_cacheexists = 0;
return false; // so that we know to recache
}
else {
return true;
}
} else {
$this->_cacheexists = 0;
return false;
}
}
/**
* FUNCTION: _getFilename
* gets the full pathname for the cached file
*
*/
function _getFilename($tmplfile) {
return $this->OPTIONS['CACHE_DIRECTORY'].'/'.md5('vlibCachestaR'.realpath($tmplfile)).'.'.$this->OPTIONS['CACHE_EXTENSION'];
}
/**
* FUNCTION: _createCache
* creates the cached file
*
*/
function _createCache($data) {
$cache_file = $this->_cachefile;
if(!$this->_prepareDirs($cache_file)) return false; // prepare all of the directories
$f = fopen($cache_file, "w");
flock($f, 2); // set an EXclusive lock
if (!$f) vlibTemplateError::raiseError('VT_ERROR_NO_CACHE_WRITE', KILL, $cache_file);
fputs($f, $data); // write the parsed string from vlibTemplate
flock($f, 3); // UNlock file
fclose($f);
touch($cache_file);
return true;
}
/**
* FUNCTION: _prepareDirs
* prepares the directory structure
*
*/
function _prepareDirs($file) {
if (empty($file)) die('no filename'); //do error in future
$filepath = dirname($file);
if (is_dir($filepath)) return true;
$dirs = preg_split('/[\\/]/', $filepath);
$currpath;
foreach ($dirs as $dir) {
$currpath .= $dir .'/';
$type = @filetype($currpath);
($type=='link') and $type = 'dir';
if ($type != 'dir' && $type != false && !empty($type)) {
vlibTemplateError::raiseError('VT_ERROR_WRONG_CACHE_TYPE', KILL, 'directory: '.$currpath.', type: '.$type);
}
if ($type == 'dir') {
continue;
}
else {
$s = @mkdir($currpath, 0775);
if (!$s) vlibTemplateError::raiseError('VT_ERROR_CACHE_MKDIR_FAILURE', KILL, 'directory: '.$currpath);
}
}
return true;
}
} // -- end vlibTemplateCache class
?>
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP version 4.0 |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002 Active Fish Group |
// +----------------------------------------------------------------------+
// | Authors: Kelvin Jones <kelvin@kelvinjones.co.uk> |
// +----------------------------------------------------------------------+
//
// $Id: error.php,v 1.1 2003/07/08 12:32:06 platinum Exp $
define('FATAL', E_USER_ERROR);
define('WARNING', E_USER_WARNING);
define('NOTICE', E_USER_NOTICE);
define('KILL', -1); // used for killing inside parsing.
/**
* Class is used by vlibTemplate.
* It handles all of the error reporting for vlibTemplate.
*
* @author Kelvin Jones <kelvin@kelvinjones.co.uk>
* @since 06/03/2002
* @package vLIB
* @access private
*/
class vlibTemplateError {
/*-----------------------------------------------------------------------------\
| DO NOT TOUCH ANYTHING IN THIS CLASS IT MAY NOT WORK OTHERWISE |
\-----------------------------------------------------------------------------*/
public static function raiseError ($code, $level = null, $extra=null) {
if (!($level & error_reporting())&& $level != KILL) return; // binary AND checks for reporting level
$error_codes = array(
'VT_ERROR_NOFILE' => 'vlibTemplate Error: Template ('.$extra.') file not found.',
'VT_ERROR_PARSE' => 'vlibTemplate Error: Parse error!<br>To debug this file, use vlibTemplateDebug instead of vlibTemplate in the class instantiation(i.e. new vlibTemplateDebug).',
'VT_NOTICE_INVALID_TAG' => 'vlibTemplate Notice: Invalid tag ('.$extra.').',
'VT_ERROR_INVALID_TAG' => 'vlibTemplate Error: Invalid tag ('.$extra.'). To disable this you must turn of the STRICT option.',
'VT_NOTICE_INVALID_ATT' => 'vlibTemplate Notice: Invalid attribute ('.$extra.').',
'VT_WARNING_INVALID_ARR' => 'vlibTemplate Warning: Invalid loop structure passed to vlibTemplate::setLoop() (loop name: '.$extra.').',
'VT_ERROR_INVALID_ERROR_CODE' => 'vlibTemplate Error: Invalid error raised.',
'VT_ERROR_WRONG_NO_PARAMS' => 'vlibTemplate Warning: Wrond parameter count passed to '.$extra.'.',
'VT_ERROR_UNKNOWN_VAR' => 'vlibTemplate Error: template var not found.',
'VT_ERROR_NO_CACHE_WRITE' => 'vlibTemplate Error: unable to write to cache file ('.$extra.').',
'VT_ERROR_WRONG_CACHE_TYPE' => 'vlibTemplate Error: non-directory file found in cache root with same name as directory ('.$extra.').',
'VT_ERROR_CACHE_MKDIR_FAILURE' => 'vlibTemplate Error: failed to create directory in cache root ('.$extra.').',
'VT_WARNING_NOT_CACHE_OBJ' => 'vlibTemplate Warning: called a vlibTemplateCache function ('.$extra.') without instantiating the vlibTemplateCache class.',
'VT_WARNING_LOOP_NOT_SET' => 'vlibTemplate Warning: called vlibTemplate::addRow() or vlibTemplate::addLoop() with an invalid loop name.',
'VT_WARNING_INVALID_RESOURCE' => 'vlibTemplate Warning: Invalid resource type passed to vlibTemplate::setDbLoop() for Db "'.$extra.'".',
'VT_WARNING_INVALID_LOOP_DB' => 'vlibTemplate Warning: Invalid Db type passed to vlibTemplate::setDbLoop(), "'.$extra.'" not currently available.',
'VT_WARNING_INVALID_IF_OP' => 'vlibTemplate Warning: The Operator "'.$extra.'" is not supported by vlibTemplate.'
);
$error_levels = array(
'VT_ERROR_NOFILE' => FATAL,
'VT_ERROR_PARSE' => FATAL,
'VT_NOTICE_INVALID_TAG' => NOTICE,
'VT_ERROR_INVALID_TAG' => FATAL,
'VT_NOTICE_INVALID_ATT' => NOTICE,
'VT_WARNING_INVALID_ARR' => WARNING,
'VT_ERROR_INVALID_ERROR_CODE' => FATAL,
'VT_ERROR_WRONG_NO_PARAMS' => WARNING,
'VT_ERROR_UNKNOWN_VAR' => WARNING,
'VT_ERROR_NO_CACHE_WRITE' => KILL,
'VT_ERROR_WRONG_CACHE_TYPE' => KILL,
'VT_ERROR_CACHE_MKDIR_FAILURE' => KILL,
'VT_WARNING_NOT_CACHE_OBJ' => WARNING,
'VT_WARNING_LOOP_NOT_SET' => WARNING,
'VT_WARNING_INVALID_RESOURCE' => WARNING,
'VT_WARNING_INVALID_LOOP_DB' => WARNING,
'VT_WARNING_INVALID_IF_OP' => WARNING
);
($level === null) and $level = $error_levels[$code];
if ($level == KILL) {
die ($error_codes[$code]);
}
if ($msg = $error_codes[$code]) {
trigger_error($msg, $level);
} else {
$level = $error_levels['VT_ERROR_INVALID_ERROR_CODE'];
$msg = $error_codes['VT_ERROR_INVALID_ERROR_CODE'];
trigger_error($msg, $level);
}
return;
}
}
?>
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP version 4.0 |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002 Active Fish Group |
// +----------------------------------------------------------------------+
// | Authors: Kelvin Jones <kelvin@kelvinjones.co.uk> |
// +----------------------------------------------------------------------+
//
// $Id: vlibIni.php,v 1.1 2003/07/08 12:31:10 platinum Exp $
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This file contains configuration parametres for use ;
; with the vLIB library. [ NOW A CLASS!! ] ;
; ;
; vLIB uses this file so that for future releases, you ;
; will not have to delve through all the php script ;
; again to set your specific variable/properties ..etc ;
; ;
; ---------------------------------------------------- ;
; ATTENTION: Do NOT remove any variable given in the ;
; configurations below as they will probably still be ;
; needed by vLIB. If you do not need a variable simply ;
; let it be. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
*/
if (!defined('vlibIniClassLoaded')) {
define('vlibIniClassLoaded', 1);
/**
* vlibIni is a class used to store configuration parameters
* for the vLIB library.
*
* @since 21/07/2002
* @author Kelvin Jones <kelvin@kelvinjones.co.uk>
* @package vLIB
* @access private
*/
class vlibIni {
/** config vars for vlibTemplate */
public static function vlibTemplate () {
global $conf;
$tpl_dir = ISPC_INSTALL_ROOT."/install/tpl";
$include_paths = array('/usr/local/ispconfig/server/conf-custom/install');
return array(
'TEMPLATE_DIR' => $tpl_dir, // Default directory for your template files (full path)
// leave the '/' or '\' off the end of the directory.
'INCLUDE_PATHS' => $include_paths, // The include path is always searched first for a template file before the template_dir is checked
'MAX_INCLUDES' => 10, // Drill depth for tmpl_include's
'GLOBAL_VARS' => 1, // if set to 1, any variables not found in a
// loop will search for a global var as well
'GLOBAL_CONTEXT_VARS' => 1, // if set to 1, vlibTemplate will add global vars
// reflecting the environment.
'LOOP_CONTEXT_VARS' => 1, // if set to 1, vlibTemplate will add loop specific vars
// on each row of the loop.
'SET_LOOP_VAR' => 1, // Sets a global variable for each top level loops
'DEFAULT_ESCAPE' => 'none', // 1 of the following: html, url, sq, dq, none
'STRICT' => 0, // Dies when encountering an incorrect tmpl_*
// style tags i.e. tmpl_vae
'CASELESS' => 0, // Removes case sensitivity on all variables
'UNKNOWNS' => 'ignore', // How to handle unknown variables.
// 1 of the following: ignore, remove, leave,print, comment
// 1 of the following: ignore, remove, leave, print, comment
'TIME_PARSE' => '0', // Will enable you to time how long vlibTemplate takes to parse
// your template. You then use the function: getParseTime().
'ENABLE_PHPINCLUDE' => '1', // Will allow template to include a php file using <TMPL_PHPINCLUDE>
/* the following are only used by the vlibTemplateCache class. */
'CACHE_DIRECTORY' => '/tmp',
// Directory where the cached filesystem
// will be set up (full path, and must be writable)
// '/' or '\' off the end of the directory.
'CACHE_LIFETIME' => 604800, // Duration until file is re-cached in seconds (604800 = 1 week)
'CACHE_EXTENSION' => 'vtc' // extention to be used by the cached file i.e. index.php will become
// index.vtc (vlibTemplate Compiled)
);
} // << end function vlibTemplate
/** config vars for vlibDate */
public function vlibDate () {
return array(
'DEFAULT_LANG' => 'de' // default language for the date displays
);
}// << end function vlibDate
}// << end class vlibIni
}
?>
......@@ -828,5 +828,30 @@ function get_system_timezone() {
return $timezone;
}
function getapacheversion($get_minor = false) {
global $app;
$cmd = '';
if(is_installed('apache2ctl')) $cmd = 'apache2ctl -v';
elseif(is_installed('apachectl')) $cmd = 'apachectl -v';
else {
$app->log("Could not check apache version, apachectl not found.", LOGLEVEL_WARN);
return '2.2';
}
exec($cmd, $output, $return_var);
if($return_var != 0 || !$output[0]) {
$app->log("Could not check apache version, apachectl did not return any data.", LOGLEVEL_WARN);
return '2.2';
}
if(preg_match('/version:\s*Apache\/(\d+)(\.(\d+)(\.(\d+))*)?(\D|$)/i', $output[0], $matches)) {
return $matches[1] . (isset($matches[3]) ? '.' . $matches[3] : '') . (isset($matches[5]) && $get_minor == true ? '.' . $matches[5] : '');
} else {
$app->log("Could not check apache version, did not find version string in apachectl output.", LOGLEVEL_WARN);
return '2.2';
}
}
?>
......@@ -1251,11 +1251,12 @@ class installer_base {
$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
// copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.conf.master', 'tpl/apache_ispconfig.conf.master');
$tpl = new tpl('apache_ispconfig.conf.master');
$tpl->setVar('apache_version',getapacheversion());