fix up some cron related things
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -207,7 +207,7 @@ if ($page == 'overview') {
|
|||||||
$count = 0;
|
$count = 0;
|
||||||
$htaccess = '';
|
$htaccess = '';
|
||||||
|
|
||||||
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
|
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
|
||||||
|
|
||||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
if ($paging->checkDisplay($i)) {
|
if ($paging->checkDisplay($i)) {
|
||||||
@@ -270,7 +270,7 @@ if ($page == 'overview') {
|
|||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
|
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
|
||||||
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
|
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
|
||||||
|
|
||||||
$htaccess_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_add.php';
|
$htaccess_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_add.php';
|
||||||
$htaccess_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_add_data);
|
$htaccess_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_add_data);
|
||||||
@@ -309,7 +309,7 @@ if ($page == 'overview') {
|
|||||||
$result['error404path'] = $result['error404path'];
|
$result['error404path'] = $result['error404path'];
|
||||||
$result['error403path'] = $result['error403path'];
|
$result['error403path'] = $result['error403path'];
|
||||||
$result['error500path'] = $result['error500path'];
|
$result['error500path'] = $result['error500path'];
|
||||||
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
|
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
|
||||||
/*
|
/*
|
||||||
* $options_indexes = \Froxlor\UI\HTML::makeyesno('options_indexes', '1', '0', $result['options_indexes']);
|
* $options_indexes = \Froxlor\UI\HTML::makeyesno('options_indexes', '1', '0', $result['options_indexes']);
|
||||||
* $options_cgi = \Froxlor\UI\HTML::makeyesno('options_cgi', '1', '0', $result['options_cgi']);
|
* $options_cgi = \Froxlor\UI\HTML::makeyesno('options_cgi', '1', '0', $result['options_cgi']);
|
||||||
|
|||||||
@@ -59,14 +59,14 @@ class Apache extends HttpConfigBase
|
|||||||
// so we need to create a dummy
|
// so we need to create a dummy
|
||||||
$_conffiles = glob(\Froxlor\FileDir::makeCorrectFile($restart_cmd['config_dir'] . "/*.conf"));
|
$_conffiles = glob(\Froxlor\FileDir::makeCorrectFile($restart_cmd['config_dir'] . "/*.conf"));
|
||||||
if ($_conffiles === false || empty($_conffiles)) {
|
if ($_conffiles === false || empty($_conffiles)) {
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_INFO, 'apache::reload: fpm config directory "' . $restart_cmd['config_dir'] . '" is empty. Creating dummy.');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'apache::reload: fpm config directory "' . $restart_cmd['config_dir'] . '" is empty. Creating dummy.');
|
||||||
Fpm::createDummyPool($restart_cmd['config_dir']);
|
Fpm::createDummyPool($restart_cmd['config_dir']);
|
||||||
}
|
}
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_INFO, 'apache::reload: running ' . $restart_cmd['reload_cmd']);
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'apache::reload: running ' . $restart_cmd['reload_cmd']);
|
||||||
\Froxlor\FileDir::safe_exec(escapeshellcmd($restart_cmd['reload_cmd']));
|
\Froxlor\FileDir::safe_exec(escapeshellcmd($restart_cmd['reload_cmd']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_INFO, 'apache::reload: reloading apache');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'apache::reload: reloading apache');
|
||||||
\Froxlor\FileDir::safe_exec(escapeshellcmd(Settings::Get('system.apachereload_command')));
|
\Froxlor\FileDir::safe_exec(escapeshellcmd(Settings::Get('system.apachereload_command')));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ class Apache extends HttpConfigBase
|
|||||||
$this->virtualhosts_data[$ocsp_cache_filename] = 'SSLStaplingCache ' . Settings::Get('system.apache24_ocsp_cache_path') . "\n";
|
$this->virtualhosts_data[$ocsp_cache_filename] = 'SSLStaplingCache ' . Settings::Get('system.apache24_ocsp_cache_path') . "\n";
|
||||||
} else {
|
} else {
|
||||||
if (file_exists($ocsp_cache_filename)) {
|
if (file_exists($ocsp_cache_filename)) {
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_NOTICE, 'apache::_createStandardDirectoryEntry: unlinking ' . basename($ocsp_cache_filename));
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_NOTICE, 'apache::_createStandardDirectoryEntry: unlinking ' . basename($ocsp_cache_filename));
|
||||||
unlink(\Froxlor\FileDir::makeCorrectFile($ocsp_cache_filename));
|
unlink(\Froxlor\FileDir::makeCorrectFile($ocsp_cache_filename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ class Apache extends HttpConfigBase
|
|||||||
$ipport = $row_ipsandports['ip'] . ':' . $row_ipsandports['port'];
|
$ipport = $row_ipsandports['ip'] . ':' . $row_ipsandports['port'];
|
||||||
}
|
}
|
||||||
|
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_INFO, 'apache::createIpPort: creating ip/port settings for ' . $ipport);
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'apache::createIpPort: creating ip/port settings for ' . $ipport);
|
||||||
$vhosts_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/10_froxlor_ipandport_' . trim(str_replace(':', '.', $row_ipsandports['ip']), '.') . '.' . $row_ipsandports['port'] . '.conf');
|
$vhosts_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/10_froxlor_ipandport_' . trim(str_replace(':', '.', $row_ipsandports['ip']), '.') . '.' . $row_ipsandports['port'] . '.conf');
|
||||||
|
|
||||||
if (! isset($this->virtualhosts_data[$vhosts_filename])) {
|
if (! isset($this->virtualhosts_data[$vhosts_filename])) {
|
||||||
@@ -175,16 +175,16 @@ class Apache extends HttpConfigBase
|
|||||||
|
|
||||||
if ($row_ipsandports['listen_statement'] == '1') {
|
if ($row_ipsandports['listen_statement'] == '1') {
|
||||||
$this->virtualhosts_data[$vhosts_filename] .= 'Listen ' . $ipport . "\n";
|
$this->virtualhosts_data[$vhosts_filename] .= 'Listen ' . $ipport . "\n";
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_DEBUG, $ipport . ' :: inserted listen-statement');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_DEBUG, $ipport . ' :: inserted listen-statement');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row_ipsandports['namevirtualhost_statement'] == '1') {
|
if ($row_ipsandports['namevirtualhost_statement'] == '1') {
|
||||||
// >=apache-2.4 enabled?
|
// >=apache-2.4 enabled?
|
||||||
if (Settings::Get('system.apache24') == '1') {
|
if (Settings::Get('system.apache24') == '1') {
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_NOTICE, $ipport . ' :: namevirtualhost-statement no longer needed for apache-2.4');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_NOTICE, $ipport . ' :: namevirtualhost-statement no longer needed for apache-2.4');
|
||||||
} else {
|
} else {
|
||||||
$this->virtualhosts_data[$vhosts_filename] .= 'NameVirtualHost ' . $ipport . "\n";
|
$this->virtualhosts_data[$vhosts_filename] .= 'NameVirtualHost ' . $ipport . "\n";
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_DEBUG, $ipport . ' :: inserted namevirtualhost-statement');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_DEBUG, $ipport . ' :: inserted namevirtualhost-statement');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,7 +423,7 @@ class Apache extends HttpConfigBase
|
|||||||
if (! file_exists($row_ipsandports['ssl_cert_file'])) {
|
if (! file_exists($row_ipsandports['ssl_cert_file'])) {
|
||||||
// explicitly disable ssl for this vhost
|
// explicitly disable ssl for this vhost
|
||||||
$row_ipsandports['ssl_cert_file'] = "";
|
$row_ipsandports['ssl_cert_file'] = "";
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_DEBUG, 'System certificate file "' . Settings::Get('system.ssl_cert_file') . '" does not seem to exist. Disabling SSL-vhost for "' . Settings::Get('system.hostname') . '"');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_DEBUG, 'System certificate file "' . Settings::Get('system.ssl_cert_file') . '" does not seem to exist. Disabling SSL-vhost for "' . Settings::Get('system.hostname') . '"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,7 +466,7 @@ class Apache extends HttpConfigBase
|
|||||||
|
|
||||||
// check for existence, #1485
|
// check for existence, #1485
|
||||||
if (! file_exists($domain['ssl_cert_file'])) {
|
if (! file_exists($domain['ssl_cert_file'])) {
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_ERR, $ipport . ' :: certificate file "' . $domain['ssl_cert_file'] . '" does not exist! Cannot create ssl-directives');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_ERR, $ipport . ' :: certificate file "' . $domain['ssl_cert_file'] . '" does not exist! Cannot create ssl-directives');
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->virtualhosts_data[$vhosts_filename] .= ' SSLEngine On' . "\n";
|
$this->virtualhosts_data[$vhosts_filename] .= ' SSLEngine On' . "\n";
|
||||||
@@ -493,7 +493,7 @@ class Apache extends HttpConfigBase
|
|||||||
if ($domain['ssl_key_file'] != '') {
|
if ($domain['ssl_key_file'] != '') {
|
||||||
// check for existence, #1485
|
// check for existence, #1485
|
||||||
if (! file_exists($domain['ssl_key_file'])) {
|
if (! file_exists($domain['ssl_key_file'])) {
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_ERR, $ipport . ' :: certificate key file "' . $domain['ssl_key_file'] . '" does not exist! Cannot create ssl-directives');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_ERR, $ipport . ' :: certificate key file "' . $domain['ssl_key_file'] . '" does not exist! Cannot create ssl-directives');
|
||||||
} else {
|
} else {
|
||||||
$this->virtualhosts_data[$vhosts_filename] .= ' SSLCertificateKeyFile ' . \Froxlor\FileDir::makeCorrectFile($domain['ssl_key_file']) . "\n";
|
$this->virtualhosts_data[$vhosts_filename] .= ' SSLCertificateKeyFile ' . \Froxlor\FileDir::makeCorrectFile($domain['ssl_key_file']) . "\n";
|
||||||
}
|
}
|
||||||
@@ -502,7 +502,7 @@ class Apache extends HttpConfigBase
|
|||||||
if ($domain['ssl_ca_file'] != '') {
|
if ($domain['ssl_ca_file'] != '') {
|
||||||
// check for existence, #1485
|
// check for existence, #1485
|
||||||
if (! file_exists($domain['ssl_ca_file'])) {
|
if (! file_exists($domain['ssl_ca_file'])) {
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_ERR, $ipport . ' :: certificate CA file "' . $domain['ssl_ca_file'] . '" does not exist! Cannot create ssl-directives');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_ERR, $ipport . ' :: certificate CA file "' . $domain['ssl_ca_file'] . '" does not exist! Cannot create ssl-directives');
|
||||||
} else {
|
} else {
|
||||||
$this->virtualhosts_data[$vhosts_filename] .= ' SSLCACertificateFile ' . \Froxlor\FileDir::makeCorrectFile($domain['ssl_ca_file']) . "\n";
|
$this->virtualhosts_data[$vhosts_filename] .= ' SSLCACertificateFile ' . \Froxlor\FileDir::makeCorrectFile($domain['ssl_ca_file']) . "\n";
|
||||||
}
|
}
|
||||||
@@ -512,7 +512,7 @@ class Apache extends HttpConfigBase
|
|||||||
if ($domain['ssl_cert_chainfile'] != '') {
|
if ($domain['ssl_cert_chainfile'] != '') {
|
||||||
// check for existence, #1485
|
// check for existence, #1485
|
||||||
if (! file_exists($domain['ssl_cert_chainfile'])) {
|
if (! file_exists($domain['ssl_cert_chainfile'])) {
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_ERR, $ipport . ' :: certificate chain file "' . $domain['ssl_cert_chainfile'] . '" does not exist! Cannot create ssl-directives');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_ERR, $ipport . ' :: certificate chain file "' . $domain['ssl_cert_chainfile'] . '" does not exist! Cannot create ssl-directives');
|
||||||
} else {
|
} else {
|
||||||
$this->virtualhosts_data[$vhosts_filename] .= ' SSLCertificateChainFile ' . \Froxlor\FileDir::makeCorrectFile($domain['ssl_cert_chainfile']) . "\n";
|
$this->virtualhosts_data[$vhosts_filename] .= ' SSLCertificateChainFile ' . \Froxlor\FileDir::makeCorrectFile($domain['ssl_cert_chainfile']) . "\n";
|
||||||
}
|
}
|
||||||
@@ -521,7 +521,7 @@ class Apache extends HttpConfigBase
|
|||||||
} else {
|
} else {
|
||||||
// if there is no cert-file specified but we are generating a ssl-vhost,
|
// if there is no cert-file specified but we are generating a ssl-vhost,
|
||||||
// we should return an empty string because this vhost would suck dick, ref #1583
|
// we should return an empty string because this vhost would suck dick, ref #1583
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_ERR, $domain['domain'] . ' :: empty certificate file! Cannot create ssl-directives');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_ERR, $domain['domain'] . ' :: empty certificate file! Cannot create ssl-directives');
|
||||||
$this->virtualhosts_data[$vhosts_filename] = $without_vhost;
|
$this->virtualhosts_data[$vhosts_filename] = $without_vhost;
|
||||||
$this->virtualhosts_data[$vhosts_filename] .= '# no ssl-certificate was specified for this domain, therefore no explicit vhost-container is being generated';
|
$this->virtualhosts_data[$vhosts_filename] .= '# no ssl-certificate was specified for this domain, therefore no explicit vhost-container is being generated';
|
||||||
$close_vhost = false;
|
$close_vhost = false;
|
||||||
@@ -531,7 +531,7 @@ class Apache extends HttpConfigBase
|
|||||||
if ($close_vhost) {
|
if ($close_vhost) {
|
||||||
$this->virtualhosts_data[$vhosts_filename] .= '</VirtualHost>' . "\n";
|
$this->virtualhosts_data[$vhosts_filename] .= '</VirtualHost>' . "\n";
|
||||||
}
|
}
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_DEBUG, $ipport . ' :: inserted vhostcontainer');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_DEBUG, $ipport . ' :: inserted vhostcontainer');
|
||||||
}
|
}
|
||||||
unset($vhosts_filename);
|
unset($vhosts_filename);
|
||||||
}
|
}
|
||||||
@@ -566,14 +566,14 @@ class Apache extends HttpConfigBase
|
|||||||
|
|
||||||
if ($domain['openbasedir'] == '1') {
|
if ($domain['openbasedir'] == '1') {
|
||||||
if ($domain['openbasedir_path'] == '1' || strstr($domain['documentroot'], ":") !== false) {
|
if ($domain['openbasedir_path'] == '1' || strstr($domain['documentroot'], ":") !== false) {
|
||||||
$_phpappendopenbasedir = appendOpenBasedirPath($domain['customerroot'], true);
|
$_phpappendopenbasedir = \Froxlor\Domain\Domain::appendOpenBasedirPath($domain['customerroot'], true);
|
||||||
} else {
|
} else {
|
||||||
$_phpappendopenbasedir = appendOpenBasedirPath($domain['documentroot'], true);
|
$_phpappendopenbasedir = \Froxlor\Domain\Domain::appendOpenBasedirPath($domain['documentroot'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_custom_openbasedir = explode(':', Settings::Get('system.phpappendopenbasedir'));
|
$_custom_openbasedir = explode(':', Settings::Get('system.phpappendopenbasedir'));
|
||||||
foreach ($_custom_openbasedir as $cobd) {
|
foreach ($_custom_openbasedir as $cobd) {
|
||||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
$_phpappendopenbasedir .= \Froxlor\Domain\Domain::appendOpenBasedirPath($cobd);
|
||||||
}
|
}
|
||||||
|
|
||||||
$php_options_text .= ' php_admin_value open_basedir "' . $_phpappendopenbasedir . '"' . "\n";
|
$php_options_text .= ' php_admin_value open_basedir "' . $_phpappendopenbasedir . '"' . "\n";
|
||||||
@@ -821,7 +821,7 @@ class Apache extends HttpConfigBase
|
|||||||
// be sure to build the awstats conf file as well
|
// be sure to build the awstats conf file as well
|
||||||
// and chown it using $awstats_params, #258
|
// and chown it using $awstats_params, #258
|
||||||
// Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the informations
|
// Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the informations
|
||||||
createAWStatsConf(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log', $domain['domain'], $alias . $server_alias, $domain['customerroot'], $domain);
|
\Froxlor\Http\Statistics::createAWStatsConf(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log', $domain['domain'], $alias . $server_alias, $domain['customerroot'], $domain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -944,7 +944,7 @@ class Apache extends HttpConfigBase
|
|||||||
if (! file_exists($domain['ssl_cert_file'])) {
|
if (! file_exists($domain['ssl_cert_file'])) {
|
||||||
// explicitly disable ssl for this vhost
|
// explicitly disable ssl for this vhost
|
||||||
$domain['ssl_cert_file'] = "";
|
$domain['ssl_cert_file'] = "";
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_DEBUG, 'System certificate file "' . Settings::Get('system.ssl_cert_file') . '" does not seem to exist. Disabling SSL-vhost for "' . $domain['domain'] . '"');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_DEBUG, 'System certificate file "' . Settings::Get('system.ssl_cert_file') . '" does not seem to exist. Disabling SSL-vhost for "' . $domain['domain'] . '"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1013,7 +1013,7 @@ class Apache extends HttpConfigBase
|
|||||||
} else {
|
} else {
|
||||||
// if there is no cert-file specified but we are generating a ssl-vhost,
|
// if there is no cert-file specified but we are generating a ssl-vhost,
|
||||||
// we should return an empty string because this vhost would suck dick, ref #1583
|
// we should return an empty string because this vhost would suck dick, ref #1583
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_ERR, $domain['domain'] . ' :: empty certificate file! Cannot create ssl-directives');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_ERR, $domain['domain'] . ' :: empty certificate file! Cannot create ssl-directives');
|
||||||
return '# no ssl-certificate was specified for this domain, therefore no explicit vhost is being generated';
|
return '# no ssl-certificate was specified for this domain, therefore no explicit vhost is being generated';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1047,7 +1047,7 @@ class Apache extends HttpConfigBase
|
|||||||
$vhost_content .= ' </IfModule>' . "\n";
|
$vhost_content .= ' </IfModule>' . "\n";
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true, true);
|
\Froxlor\FileDir::mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true, true);
|
||||||
$vhost_content .= $this->getWebroot($domain);
|
$vhost_content .= $this->getWebroot($domain);
|
||||||
if ($this->_deactivated == false) {
|
if ($this->_deactivated == false) {
|
||||||
$vhost_content .= $this->composePhpOptions($domain, $ssl_vhost);
|
$vhost_content .= $this->composePhpOptions($domain, $ssl_vhost);
|
||||||
@@ -1081,7 +1081,7 @@ class Apache extends HttpConfigBase
|
|||||||
$domains = WebserverBase::getVhostsToCreate();
|
$domains = WebserverBase::getVhostsToCreate();
|
||||||
foreach ($domains as $domain) {
|
foreach ($domains as $domain) {
|
||||||
|
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_INFO, 'apache::createVirtualHosts: creating vhost container for domain ' . $domain['id'] . ', customer ' . $domain['loginname']);
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'apache::createVirtualHosts: creating vhost container for domain ' . $domain['id'] . ', customer ' . $domain['loginname']);
|
||||||
$vhosts_filename = $this->getVhostFilename($domain);
|
$vhosts_filename = $this->getVhostFilename($domain);
|
||||||
|
|
||||||
// Apply header
|
// Apply header
|
||||||
@@ -1146,7 +1146,7 @@ class Apache extends HttpConfigBase
|
|||||||
|
|
||||||
foreach ($diroptions as $row_diroptions) {
|
foreach ($diroptions as $row_diroptions) {
|
||||||
$row_diroptions['path'] = \Froxlor\FileDir::makeCorrectDir($row_diroptions['path']);
|
$row_diroptions['path'] = \Froxlor\FileDir::makeCorrectDir($row_diroptions['path']);
|
||||||
mkDirWithCorrectOwnership($row_diroptions['customerroot'], $row_diroptions['path'], $row_diroptions['guid'], $row_diroptions['guid']);
|
\Froxlor\FileDir::mkDirWithCorrectOwnership($row_diroptions['customerroot'], $row_diroptions['path'], $row_diroptions['guid'], $row_diroptions['guid']);
|
||||||
$diroptions_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_diroptions') . '/40_froxlor_diroption_' . md5($row_diroptions['path']) . '.conf');
|
$diroptions_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_diroptions') . '/40_froxlor_diroption_' . md5($row_diroptions['path']) . '.conf');
|
||||||
|
|
||||||
if (! isset($this->diroptions_data[$diroptions_filename])) {
|
if (! isset($this->diroptions_data[$diroptions_filename])) {
|
||||||
@@ -1154,7 +1154,7 @@ class Apache extends HttpConfigBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_dir($row_diroptions['path'])) {
|
if (is_dir($row_diroptions['path'])) {
|
||||||
$cperlenabled = customerHasPerlEnabled($row_diroptions['customerid']);
|
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($row_diroptions['customerid']);
|
||||||
|
|
||||||
$this->diroptions_data[$diroptions_filename] .= '<Directory "' . $row_diroptions['path'] . '">' . "\n";
|
$this->diroptions_data[$diroptions_filename] .= '<Directory "' . $row_diroptions['path'] . '">' . "\n";
|
||||||
|
|
||||||
@@ -1167,7 +1167,7 @@ class Apache extends HttpConfigBase
|
|||||||
} else {
|
} else {
|
||||||
$this->diroptions_data[$diroptions_filename] .= "\n";
|
$this->diroptions_data[$diroptions_filename] .= "\n";
|
||||||
}
|
}
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_INFO, 'Setting Options +Indexes for ' . $row_diroptions['path']);
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'Setting Options +Indexes for ' . $row_diroptions['path']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($row_diroptions['options_indexes']) && $row_diroptions['options_indexes'] == '0') {
|
if (isset($row_diroptions['options_indexes']) && $row_diroptions['options_indexes'] == '0') {
|
||||||
@@ -1179,7 +1179,7 @@ class Apache extends HttpConfigBase
|
|||||||
} else {
|
} else {
|
||||||
$this->diroptions_data[$diroptions_filename] .= "\n";
|
$this->diroptions_data[$diroptions_filename] .= "\n";
|
||||||
}
|
}
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_INFO, 'Setting Options -Indexes for ' . $row_diroptions['path']);
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'Setting Options -Indexes for ' . $row_diroptions['path']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$statusCodes = array(
|
$statusCodes = array(
|
||||||
@@ -1215,7 +1215,7 @@ class Apache extends HttpConfigBase
|
|||||||
$this->diroptions_data[$diroptions_filename] .= ' Order allow,deny' . "\n";
|
$this->diroptions_data[$diroptions_filename] .= ' Order allow,deny' . "\n";
|
||||||
$this->diroptions_data[$diroptions_filename] .= ' Allow from all' . "\n";
|
$this->diroptions_data[$diroptions_filename] .= ' Allow from all' . "\n";
|
||||||
}
|
}
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_INFO, 'Enabling perl execution for ' . $row_diroptions['path']);
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'Enabling perl execution for ' . $row_diroptions['path']);
|
||||||
|
|
||||||
// check for suexec-workaround, #319
|
// check for suexec-workaround, #319
|
||||||
if ((int) Settings::Get('perl.suexecworkaround') == 1) {
|
if ((int) Settings::Get('perl.suexecworkaround') == 1) {
|
||||||
@@ -1283,7 +1283,7 @@ class Apache extends HttpConfigBase
|
|||||||
public function writeConfigs()
|
public function writeConfigs()
|
||||||
{
|
{
|
||||||
// Write diroptions
|
// Write diroptions
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_INFO, "apache::writeConfigs: rebuilding " . Settings::Get('system.apacheconf_diroptions'));
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, "apache::writeConfigs: rebuilding " . Settings::Get('system.apacheconf_diroptions'));
|
||||||
|
|
||||||
if (count($this->diroptions_data) > 0) {
|
if (count($this->diroptions_data) > 0) {
|
||||||
$optsDir = new \Froxlor\Http\Directory(Settings::Get('system.apacheconf_diroptions'));
|
$optsDir = new \Froxlor\Http\Directory(Settings::Get('system.apacheconf_diroptions'));
|
||||||
@@ -1304,7 +1304,7 @@ class Apache extends HttpConfigBase
|
|||||||
fclose($diroptions_file_handler);
|
fclose($diroptions_file_handler);
|
||||||
} else {
|
} else {
|
||||||
if (! file_exists(Settings::Get('system.apacheconf_diroptions'))) {
|
if (! file_exists(Settings::Get('system.apacheconf_diroptions'))) {
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_NOTICE, 'apache::writeConfigs: mkdir ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_diroptions'))));
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_NOTICE, 'apache::writeConfigs: mkdir ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_diroptions'))));
|
||||||
\Froxlor\FileDir::safe_exec('mkdir ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_diroptions'))));
|
\Froxlor\FileDir::safe_exec('mkdir ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_diroptions'))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1322,7 +1322,7 @@ class Apache extends HttpConfigBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write htpasswds
|
// Write htpasswds
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_INFO, "apache::writeConfigs: rebuilding " . Settings::Get('system.apacheconf_htpasswddir'));
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, "apache::writeConfigs: rebuilding " . Settings::Get('system.apacheconf_htpasswddir'));
|
||||||
|
|
||||||
if (count($this->htpasswds_data) > 0) {
|
if (count($this->htpasswds_data) > 0) {
|
||||||
if (! file_exists(Settings::Get('system.apacheconf_htpasswddir'))) {
|
if (! file_exists(Settings::Get('system.apacheconf_htpasswddir'))) {
|
||||||
@@ -1341,12 +1341,12 @@ class Apache extends HttpConfigBase
|
|||||||
fclose($htpasswd_file_handler);
|
fclose($htpasswd_file_handler);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_WARNING, 'WARNING!!! ' . Settings::Get('system.apacheconf_htpasswddir') . ' is not a directory. htpasswd directory protection is disabled!!!');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_WARNING, 'WARNING!!! ' . Settings::Get('system.apacheconf_htpasswddir') . ' is not a directory. htpasswd directory protection is disabled!!!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write virtualhosts
|
// Write virtualhosts
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_INFO, "apache::writeConfigs: rebuilding " . Settings::Get('system.apacheconf_vhost'));
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, "apache::writeConfigs: rebuilding " . Settings::Get('system.apacheconf_vhost'));
|
||||||
|
|
||||||
if (count($this->virtualhosts_data) > 0) {
|
if (count($this->virtualhosts_data) > 0) {
|
||||||
$vhostDir = new \Froxlor\Http\Directory(Settings::Get('system.apacheconf_vhost'));
|
$vhostDir = new \Froxlor\Http\Directory(Settings::Get('system.apacheconf_vhost'));
|
||||||
@@ -1379,7 +1379,7 @@ class Apache extends HttpConfigBase
|
|||||||
fclose($vhosts_file_handler);
|
fclose($vhosts_file_handler);
|
||||||
} else {
|
} else {
|
||||||
if (! file_exists(Settings::Get('system.apacheconf_vhost'))) {
|
if (! file_exists(Settings::Get('system.apacheconf_vhost'))) {
|
||||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_NOTICE, 'apache::writeConfigs: mkdir ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_NOTICE, 'apache::writeConfigs: mkdir ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
||||||
\Froxlor\FileDir::safe_exec('mkdir ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
\Froxlor\FileDir::safe_exec('mkdir ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class ApacheFcgi extends Apache
|
|||||||
}
|
}
|
||||||
// #1317 - perl is executed via apache and therefore, when using fpm, does not know the user
|
// #1317 - perl is executed via apache and therefore, when using fpm, does not know the user
|
||||||
// which perl is supposed to run as, hence the need for Suexec need
|
// which perl is supposed to run as, hence the need for Suexec need
|
||||||
if (customerHasPerlEnabled($domain['customerid'])) {
|
if (\Froxlor\Customer\Customer::customerHasPerlEnabled($domain['customerid'])) {
|
||||||
$php_options_text .= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";
|
$php_options_text .= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ class HttpConfigBase
|
|||||||
{
|
{
|
||||||
if (! empty($ip_port) && $ip_port['docroot'] == '') {
|
if (! empty($ip_port) && $ip_port['docroot'] == '') {
|
||||||
if (Settings::Get('system.froxlordirectlyviahostname')) {
|
if (Settings::Get('system.froxlordirectlyviahostname')) {
|
||||||
$mypath = \Froxlor\FileDir::makeCorrectDir(dirname(dirname(dirname(__FILE__))));
|
$mypath = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir());
|
||||||
} else {
|
} else {
|
||||||
$mypath = \Froxlor\FileDir::makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
|
$mypath = \Froxlor\FileDir::makeCorrectDir(dirname(\Froxlor\Froxlor::getInstallDir()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// user-defined docroot, #417
|
// user-defined docroot, #417
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ class Lighttpd extends HttpConfigBase
|
|||||||
$htaccess_text = '';
|
$htaccess_text = '';
|
||||||
while ($row_htpasswds = $result_htpasswds_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
while ($row_htpasswds = $result_htpasswds_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||||
$row_htpasswds['path'] = \Froxlor\FileDir::makeCorrectDir($row_htpasswds['path']);
|
$row_htpasswds['path'] = \Froxlor\FileDir::makeCorrectDir($row_htpasswds['path']);
|
||||||
mkDirWithCorrectOwnership($domain['documentroot'], $row_htpasswds['path'], $domain['guid'], $domain['guid']);
|
\Froxlor\FileDir::mkDirWithCorrectOwnership($domain['documentroot'], $row_htpasswds['path'], $domain['guid'], $domain['guid']);
|
||||||
|
|
||||||
$filename = $row_htpasswds['customerid'] . '-' . md5($row_htpasswds['path']) . '.htpasswd';
|
$filename = $row_htpasswds['customerid'] . '-' . md5($row_htpasswds['path']) . '.htpasswd';
|
||||||
|
|
||||||
@@ -491,7 +491,7 @@ class Lighttpd extends HttpConfigBase
|
|||||||
$vhost_content .= ' )' . "\n";
|
$vhost_content .= ' )' . "\n";
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true, true);
|
\Froxlor\FileDir::mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true, true);
|
||||||
|
|
||||||
$only_webroot = false;
|
$only_webroot = false;
|
||||||
if ($ssl_vhost === false && $domain['ssl_redirect'] == '1') {
|
if ($ssl_vhost === false && $domain['ssl_redirect'] == '1') {
|
||||||
@@ -677,7 +677,7 @@ class Lighttpd extends HttpConfigBase
|
|||||||
// be sure to build the awstats conf file as well
|
// be sure to build the awstats conf file as well
|
||||||
// and chown it using $awstats_params, #258
|
// and chown it using $awstats_params, #258
|
||||||
// Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the informations
|
// Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the informations
|
||||||
createAWStatsConf(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log', $domain['domain'], $alias . $server_alias, $domain['customerroot'], $domain);
|
\Froxlor\Http\Statistics::createAWStatsConf(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log', $domain['domain'], $alias . $server_alias, $domain['customerroot'], $domain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -715,7 +715,7 @@ class Lighttpd extends HttpConfigBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
$path = \Froxlor\FileDir::makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
$path = \Froxlor\FileDir::makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
||||||
mkDirWithCorrectOwnership($domain['documentroot'], $row['path'], $domain['guid'], $domain['guid']);
|
\Froxlor\FileDir::mkDirWithCorrectOwnership($domain['documentroot'], $row['path'], $domain['guid'], $domain['guid']);
|
||||||
|
|
||||||
// We need to remove the last slash, otherwise the regex wouldn't work
|
// We need to remove the last slash, otherwise the regex wouldn't work
|
||||||
if ($row['path'] != $domain['documentroot']) {
|
if ($row['path'] != $domain['documentroot']) {
|
||||||
@@ -728,9 +728,9 @@ class Lighttpd extends HttpConfigBase
|
|||||||
$path_options = $error_string;
|
$path_options = $error_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (customerHasPerlEnabled($domain['customerid']) && $row['options_cgi'] != '0') {
|
if (\Froxlor\Customer\Customer::customerHasPerlEnabled($domain['customerid']) && $row['options_cgi'] != '0') {
|
||||||
$path = \Froxlor\FileDir::makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
$path = \Froxlor\FileDir::makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
||||||
mkDirWithCorrectOwnership($domain['documentroot'], $row['path'], $domain['guid'], $domain['guid']);
|
\Froxlor\FileDir::mkDirWithCorrectOwnership($domain['documentroot'], $row['path'], $domain['guid'], $domain['guid']);
|
||||||
|
|
||||||
// We need to remove the last slash, otherwise the regex wouldn't work
|
// We need to remove the last slash, otherwise the regex wouldn't work
|
||||||
if ($row['path'] != $domain['documentroot']) {
|
if ($row['path'] != $domain['documentroot']) {
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ class Nginx extends HttpConfigBase
|
|||||||
$vhost_content .= "\t\t" . 'return ' . $code . ' ' . $uri . '$request_uri;' . "\n";
|
$vhost_content .= "\t\t" . 'return ' . $code . ' ' . $uri . '$request_uri;' . "\n";
|
||||||
$vhost_content .= "\t" . '}' . "\n";
|
$vhost_content .= "\t" . '}' . "\n";
|
||||||
} else {
|
} else {
|
||||||
mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true);
|
\Froxlor\FileDir::mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true);
|
||||||
|
|
||||||
$vhost_content .= $this->getLogFiles($domain);
|
$vhost_content .= $this->getLogFiles($domain);
|
||||||
$vhost_content .= $this->getWebroot($domain, $ssl_vhost);
|
$vhost_content .= $this->getWebroot($domain, $ssl_vhost);
|
||||||
@@ -728,7 +728,7 @@ class Nginx extends HttpConfigBase
|
|||||||
// if ($row['options_indexes'] != '0') {
|
// if ($row['options_indexes'] != '0') {
|
||||||
$path = \Froxlor\FileDir::makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
$path = \Froxlor\FileDir::makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
||||||
|
|
||||||
mkDirWithCorrectOwnership($domain['documentroot'], $row['path'], $domain['guid'], $domain['guid']);
|
\Froxlor\FileDir::mkDirWithCorrectOwnership($domain['documentroot'], $row['path'], $domain['guid'], $domain['guid']);
|
||||||
|
|
||||||
$path_options .= "\t" . '# ' . $path . "\n";
|
$path_options .= "\t" . '# ' . $path . "\n";
|
||||||
if ($path == '/') {
|
if ($path == '/') {
|
||||||
@@ -786,9 +786,9 @@ class Nginx extends HttpConfigBase
|
|||||||
* Perl support
|
* Perl support
|
||||||
* required the fastCGI wrapper to be running to receive the CGI requests.
|
* required the fastCGI wrapper to be running to receive the CGI requests.
|
||||||
*/
|
*/
|
||||||
if (customerHasPerlEnabled($domain['customerid']) && $row['options_cgi'] != '0') {
|
if (\Froxlor\Customer\Customer::customerHasPerlEnabled($domain['customerid']) && $row['options_cgi'] != '0') {
|
||||||
$path = \Froxlor\FileDir::makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
$path = \Froxlor\FileDir::makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
||||||
mkDirWithCorrectOwnership($domain['documentroot'], $row['path'], $domain['guid'], $domain['guid']);
|
\Froxlor\FileDir::mkDirWithCorrectOwnership($domain['documentroot'], $row['path'], $domain['guid'], $domain['guid']);
|
||||||
|
|
||||||
// We need to remove the last slash, otherwise the regex wouldn't work
|
// We need to remove the last slash, otherwise the regex wouldn't work
|
||||||
if ($row['path'] != $domain['documentroot']) {
|
if ($row['path'] != $domain['documentroot']) {
|
||||||
@@ -1082,7 +1082,7 @@ class Nginx extends HttpConfigBase
|
|||||||
// be sure to build the awstats conf file as well
|
// be sure to build the awstats conf file as well
|
||||||
// and chown it using $awstats_params, #258
|
// and chown it using $awstats_params, #258
|
||||||
// Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the informations
|
// Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the informations
|
||||||
createAWStatsConf(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log', $domain['domain'], $alias . $server_alias, $domain['customerroot'], $domain);
|
\Froxlor\Http\Statistics::createAWStatsConf(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log', $domain['domain'], $alias . $server_alias, $domain['customerroot'], $domain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Froxlor\Cron\Http\Php;
|
namespace Froxlor\Cron\Http\Php;
|
||||||
|
|
||||||
use Froxlor\Database;
|
use Froxlor\Database\Database;
|
||||||
use Froxlor\Settings;
|
use Froxlor\Settings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,21 +124,21 @@ class Fcgid
|
|||||||
|
|
||||||
$_custom_openbasedir = explode(':', Settings::Get('system.mod_fcgid_peardir'));
|
$_custom_openbasedir = explode(':', Settings::Get('system.mod_fcgid_peardir'));
|
||||||
foreach ($_custom_openbasedir as $cobd) {
|
foreach ($_custom_openbasedir as $cobd) {
|
||||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
$_phpappendopenbasedir .= \Froxlor\Domain\Domain::appendOpenBasedirPath($cobd);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_custom_openbasedir = explode(':', Settings::Get('system.phpappendopenbasedir'));
|
$_custom_openbasedir = explode(':', Settings::Get('system.phpappendopenbasedir'));
|
||||||
foreach ($_custom_openbasedir as $cobd) {
|
foreach ($_custom_openbasedir as $cobd) {
|
||||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
$_phpappendopenbasedir .= \Froxlor\Domain\Domain::appendOpenBasedirPath($cobd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_domain['openbasedir_path'] == '0' && strstr($this->_domain['documentroot'], ":") === false) {
|
if ($this->_domain['openbasedir_path'] == '0' && strstr($this->_domain['documentroot'], ":") === false) {
|
||||||
$openbasedir = appendOpenBasedirPath($this->_domain['documentroot'], true);
|
$openbasedir = \Froxlor\Domain\Domain::appendOpenBasedirPath($this->_domain['documentroot'], true);
|
||||||
} else {
|
} else {
|
||||||
$openbasedir = appendOpenBasedirPath($this->_domain['customerroot'], true);
|
$openbasedir = \Froxlor\Domain\Domain::appendOpenBasedirPath($this->_domain['customerroot'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$openbasedir .= appendOpenBasedirPath($this->getTempDir());
|
$openbasedir .= \Froxlor\Domain\Domain::appendOpenBasedirPath($this->getTempDir());
|
||||||
$openbasedir .= $_phpappendopenbasedir;
|
$openbasedir .= $_phpappendopenbasedir;
|
||||||
} else {
|
} else {
|
||||||
$openbasedir = 'none';
|
$openbasedir = 'none';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Froxlor\Cron\Http\Php;
|
namespace Froxlor\Cron\Http\Php;
|
||||||
|
|
||||||
use Froxlor\Database;
|
use Froxlor\Database\Database;
|
||||||
use Froxlor\Settings;
|
use Froxlor\Settings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -199,21 +199,21 @@ class Fpm
|
|||||||
$_phpappendopenbasedir = '';
|
$_phpappendopenbasedir = '';
|
||||||
$_custom_openbasedir = explode(':', Settings::Get('phpfpm.peardir'));
|
$_custom_openbasedir = explode(':', Settings::Get('phpfpm.peardir'));
|
||||||
foreach ($_custom_openbasedir as $cobd) {
|
foreach ($_custom_openbasedir as $cobd) {
|
||||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
$_phpappendopenbasedir .= \Froxlor\Domain\Domain::appendOpenBasedirPath($cobd);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_custom_openbasedir = explode(':', Settings::Get('system.phpappendopenbasedir'));
|
$_custom_openbasedir = explode(':', Settings::Get('system.phpappendopenbasedir'));
|
||||||
foreach ($_custom_openbasedir as $cobd) {
|
foreach ($_custom_openbasedir as $cobd) {
|
||||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
$_phpappendopenbasedir .= \Froxlor\Domain\Domain::appendOpenBasedirPath($cobd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_domain['openbasedir_path'] == '0' && strstr($this->_domain['documentroot'], ":") === false) {
|
if ($this->_domain['openbasedir_path'] == '0' && strstr($this->_domain['documentroot'], ":") === false) {
|
||||||
$openbasedir = appendOpenBasedirPath($this->_domain['documentroot'], true);
|
$openbasedir = \Froxlor\Domain\Domain::appendOpenBasedirPath($this->_domain['documentroot'], true);
|
||||||
} else {
|
} else {
|
||||||
$openbasedir = appendOpenBasedirPath($this->_domain['customerroot'], true);
|
$openbasedir = \Froxlor\Domain\Domain::appendOpenBasedirPath($this->_domain['customerroot'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$openbasedir .= appendOpenBasedirPath($this->getTempDir());
|
$openbasedir .= \Froxlor\Domain\Domain::appendOpenBasedirPath($this->getTempDir());
|
||||||
$openbasedir .= $_phpappendopenbasedir;
|
$openbasedir .= $_phpappendopenbasedir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Froxlor\Cron\Http\Php;
|
namespace Froxlor\Cron\Http\Php;
|
||||||
|
|
||||||
use Froxlor\Database;
|
use Froxlor\Database\Database;
|
||||||
use Froxlor\Settings;
|
use Froxlor\Settings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,6 +20,13 @@ use Froxlor\Database\Database;
|
|||||||
class MasterCron extends \Froxlor\Cron\FroxlorCron
|
class MasterCron extends \Froxlor\Cron\FroxlorCron
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static $argv = null;
|
||||||
|
|
||||||
|
public static function setArguments($argv = null)
|
||||||
|
{
|
||||||
|
self::$argv = $argv;
|
||||||
|
}
|
||||||
|
|
||||||
public static function run()
|
public static function run()
|
||||||
{
|
{
|
||||||
define('MASTER_CRONJOB', 1);
|
define('MASTER_CRONJOB', 1);
|
||||||
@@ -28,6 +35,7 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
|
|
||||||
$jobs_to_run = array();
|
$jobs_to_run = array();
|
||||||
|
|
||||||
|
$argv = self::$argv;
|
||||||
/**
|
/**
|
||||||
* check for --help
|
* check for --help
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +69,7 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
\Froxlor\System\Cronjob::inserttask('10');
|
\Froxlor\System\Cronjob::inserttask('10');
|
||||||
// also regenerate cron.d-file
|
// also regenerate cron.d-file
|
||||||
\Froxlor\System\Cronjob::inserttask('99');
|
\Froxlor\System\Cronjob::inserttask('99');
|
||||||
addToQueue($jobs_to_run, 'tasks');
|
array_push($jobs_to_run, 'tasks');
|
||||||
} elseif (strtolower($argv[$x]) == '--debug') {
|
} elseif (strtolower($argv[$x]) == '--debug') {
|
||||||
define('CRON_DEBUG_FLAG', 1);
|
define('CRON_DEBUG_FLAG', 1);
|
||||||
} elseif (strtolower($argv[$x]) == '--no-fork') {
|
} elseif (strtolower($argv[$x]) == '--no-fork') {
|
||||||
@@ -70,12 +78,14 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
elseif (substr(strtolower($argv[$x]), 0, 2) == '--') {
|
elseif (substr(strtolower($argv[$x]), 0, 2) == '--') {
|
||||||
if (strlen($argv[$x]) > 3) {
|
if (strlen($argv[$x]) > 3) {
|
||||||
$cronname = substr(strtolower($argv[$x]), 2);
|
$cronname = substr(strtolower($argv[$x]), 2);
|
||||||
addToQueue($jobs_to_run, $cronname);
|
array_push($jobs_to_run, $cronname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$jobs_to_run = array_unique($jobs_to_run);
|
||||||
|
|
||||||
$cronlog->setCronDebugFlag(defined('CRON_DEBUG_FLAG'));
|
$cronlog->setCronDebugFlag(defined('CRON_DEBUG_FLAG'));
|
||||||
|
|
||||||
$tasks_cnt_stmt = \Froxlor\Database\Database::query("SELECT COUNT(*) as jobcnt FROM `panel_tasks`");
|
$tasks_cnt_stmt = \Froxlor\Database\Database::query("SELECT COUNT(*) as jobcnt FROM `panel_tasks`");
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ class ReportsCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
AND `language` = :lang
|
AND `language` = :lang
|
||||||
AND `templategroup` = 'mails' AND `varname` = :varname
|
AND `templategroup` = 'mails' AND `varname` = :varname
|
||||||
");
|
");
|
||||||
$resul2_data = array(
|
$result2_data = array(
|
||||||
'adminid' => $row['adminid'],
|
'adminid' => $row['adminid'],
|
||||||
'lang' => $row['def_language'],
|
'lang' => $row['def_language'],
|
||||||
'varname' => 'trafficmaxpercent_subject'
|
'varname' => 'trafficmaxpercent_subject'
|
||||||
@@ -210,7 +210,7 @@ class ReportsCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
|
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
|
||||||
$mail_subject = html_entity_decode(\Froxlor\PhpHelper::replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['subject']), $replace_arr));
|
$mail_subject = html_entity_decode(\Froxlor\PhpHelper::replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['subject']), $replace_arr));
|
||||||
|
|
||||||
$resul2_data['varname'] = 'trafficmaxpercent_mailbody';
|
$result2_data['varname'] = 'trafficmaxpercent_mailbody';
|
||||||
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
|
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
|
||||||
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['mailbody']), $replace_arr));
|
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['mailbody']), $replace_arr));
|
||||||
|
|
||||||
@@ -352,6 +352,8 @@ class ReportsCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
WHERE `c`.`diskspace` > '0' AND `c`.`reportsent` <> '2'
|
WHERE `c`.`diskspace` > '0' AND `c`.`reportsent` <> '2'
|
||||||
");
|
");
|
||||||
|
|
||||||
|
$mail = new \Froxlor\System\Mailer(true);
|
||||||
|
|
||||||
while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||||
|
|
||||||
if (isset($row['diskspace']) && $row['diskspace_used'] != null && $row['diskspace_used'] > 0 && (($row['diskspace_used'] * 100) / $row['diskspace']) >= (int) Settings::Get('system.report_webmax')) {
|
if (isset($row['diskspace']) && $row['diskspace_used'] != null && $row['diskspace_used'] > 0 && (($row['diskspace_used'] * 100) / $row['diskspace']) >= (int) Settings::Get('system.report_webmax')) {
|
||||||
@@ -429,7 +431,7 @@ class ReportsCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($_mailerror) {
|
if ($_mailerror) {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
|
||||||
echo "Error sending mail: " . $mailerr_msg . "\n";
|
echo "Error sending mail: " . $mailerr_msg . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,7 +524,7 @@ class ReportsCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($_mailerror) {
|
if ($_mailerror) {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
|
||||||
echo "Error sending mail: " . $mailerr_msg . "\n";
|
echo "Error sending mail: " . $mailerr_msg . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
|
|
||||||
// Check Traffic-Lock
|
// Check Traffic-Lock
|
||||||
if (function_exists('pcntl_fork') && ! defined('CRON_NOFORK_FLAG')) {
|
if (function_exists('pcntl_fork') && ! defined('CRON_NOFORK_FLAG')) {
|
||||||
$TrafficLock = \Froxlor\FileDir::makeCorrectFile(dirname($lockfile) . "/froxlor_cron_traffic.lock");
|
$TrafficLock = \Froxlor\FileDir::makeCorrectFile("/var/run/froxlor_cron_traffic.lock");
|
||||||
if (file_exists($TrafficLock) && is_numeric($TrafficPid = file_get_contents($TrafficLock))) {
|
if (file_exists($TrafficLock) && is_numeric($TrafficPid = file_get_contents($TrafficLock))) {
|
||||||
if (function_exists('posix_kill')) {
|
if (function_exists('posix_kill')) {
|
||||||
$TrafficPidStatus = @posix_kill($TrafficPid, 0);
|
$TrafficPidStatus = @posix_kill($TrafficPid, 0);
|
||||||
@@ -37,7 +37,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
$TrafficPidStatus = $TrafficPidStatus ? false : true;
|
$TrafficPidStatus = $TrafficPidStatus ? false : true;
|
||||||
}
|
}
|
||||||
if ($TrafficPidStatus) {
|
if ($TrafficPidStatus) {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Traffic Run already in progress');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'Traffic Run already in progress');
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,6 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
} // Child
|
} // Child
|
||||||
elseif ($TrafficPid == 0) {
|
elseif ($TrafficPid == 0) {
|
||||||
posix_setsid();
|
posix_setsid();
|
||||||
fclose($debugHandler);
|
|
||||||
// re-create db
|
// re-create db
|
||||||
Database::needRoot(false);
|
Database::needRoot(false);
|
||||||
} // Fork failed
|
} // Fork failed
|
||||||
@@ -66,13 +65,13 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
} else {
|
} else {
|
||||||
$msg = "PHP compiled without pcntl.";
|
$msg = "PHP compiled without pcntl.";
|
||||||
}
|
}
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, $msg . " Not forking traffic-cron, this may take a long time!");
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, $msg . " Not forking traffic-cron, this may take a long time!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TRAFFIC AND DISKUSAGE MESSURE
|
* TRAFFIC AND DISKUSAGE MESSURE
|
||||||
*/
|
*/
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Traffic run started...');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'Traffic run started...');
|
||||||
$admin_traffic = array();
|
$admin_traffic = array();
|
||||||
$domainlist = array();
|
$domainlist = array();
|
||||||
$speciallogfile_domainlist = array();
|
$speciallogfile_domainlist = array();
|
||||||
@@ -140,7 +139,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
// sum up result
|
// sum up result
|
||||||
$mysqlusage_all[$row_database['customerid']] += floatval($mysql_usage_row['customerusage']);
|
$mysqlusage_all[$row_database['customerid']] += floatval($mysql_usage_row['customerusage']);
|
||||||
} else {
|
} else {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "Seems like the database " . $row_database['databasename'] . " had been removed manually.");
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_WARNING, "Seems like the database " . $row_database['databasename'] . " had been removed manually.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +163,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
/**
|
/**
|
||||||
* HTTP-Traffic
|
* HTTP-Traffic
|
||||||
*/
|
*/
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'http traffic for ' . $row['loginname'] . ' started...');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'http traffic for ' . $row['loginname'] . ' started...');
|
||||||
$httptraffic = 0;
|
$httptraffic = 0;
|
||||||
|
|
||||||
if (isset($domainlist[$row['customerid']]) && is_array($domainlist[$row['customerid']]) && count($domainlist[$row['customerid']]) != 0) {
|
if (isset($domainlist[$row['customerid']]) && is_array($domainlist[$row['customerid']]) && count($domainlist[$row['customerid']]) != 0) {
|
||||||
@@ -193,7 +192,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
reset($speciallogfile_domainlist[$row['customerid']]);
|
reset($speciallogfile_domainlist[$row['customerid']]);
|
||||||
if (Settings::Get('system.awstats_enabled') == '0') {
|
if (Settings::Get('system.awstats_enabled') == '0') {
|
||||||
foreach ($speciallogfile_domainlist[$row['customerid']] as $domainid => $domain) {
|
foreach ($speciallogfile_domainlist[$row['customerid']] as $domainid => $domain) {
|
||||||
$httptraffic += floatval(callWebalizerGetTraffic($row['loginname'] . '-' . $domain, $row['documentroot'] . '/webalizer/' . $domain . '/', $domain, $domainlist[$row['customerid']]));
|
$httptraffic += floatval(self::callWebalizerGetTraffic($row['loginname'] . '-' . $domain, $row['documentroot'] . '/webalizer/' . $domain . '/', $domain, $domainlist[$row['customerid']]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,19 +204,19 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
// will iterate through all customer-domains and the awstats-configs
|
// will iterate through all customer-domains and the awstats-configs
|
||||||
// know the logfile-name, #246
|
// know the logfile-name, #246
|
||||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||||
$httptraffic += floatval(callAwstatsGetTraffic($row['customerid'], $row['documentroot'] . '/awstats/', $domainlist[$row['customerid']]));
|
$httptraffic += floatval(self::callAwstatsGetTraffic($row['customerid'], $row['documentroot'] . '/awstats/', $domainlist[$row['customerid']]));
|
||||||
} else {
|
} else {
|
||||||
$httptraffic += floatval(callWebalizerGetTraffic($row['loginname'], $row['documentroot'] . '/webalizer/', $caption, $domainlist[$row['customerid']]));
|
$httptraffic += floatval(self::callWebalizerGetTraffic($row['loginname'], $row['documentroot'] . '/webalizer/', $caption, $domainlist[$row['customerid']]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// make the stuff readable for the customer, #258
|
// make the stuff readable for the customer, #258
|
||||||
makeChownWithNewStats($row);
|
\Froxlor\Http\Statistics::makeChownWithNewStats($row);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FTP-Traffic
|
* FTP-Traffic
|
||||||
*/
|
*/
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'ftp traffic for ' . $row['loginname'] . ' started...');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'ftp traffic for ' . $row['loginname'] . ' started...');
|
||||||
$ftptraffic_stmt = Database::prepare("
|
$ftptraffic_stmt = Database::prepare("
|
||||||
SELECT SUM(`up_bytes`) AS `up_bytes_sum`, SUM(`down_bytes`) AS `down_bytes_sum`
|
SELECT SUM(`up_bytes`) AS `up_bytes_sum`, SUM(`down_bytes`) AS `down_bytes_sum`
|
||||||
FROM `" . TABLE_FTP_USERS . "` WHERE `customerid` = :customerid
|
FROM `" . TABLE_FTP_USERS . "` WHERE `customerid` = :customerid
|
||||||
@@ -245,7 +244,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
*/
|
*/
|
||||||
$mailtraffic = 0;
|
$mailtraffic = 0;
|
||||||
if (Settings::Get("system.mailtraffic_enabled")) {
|
if (Settings::Get("system.mailtraffic_enabled")) {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'mail traffic usage for ' . $row['loginname'] . " started...");
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'mail traffic usage for ' . $row['loginname'] . " started...");
|
||||||
|
|
||||||
$currentDate = date("Y-m-d");
|
$currentDate = date("Y-m-d");
|
||||||
|
|
||||||
@@ -271,7 +270,8 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
WHERE `customerid` = :cid
|
WHERE `customerid` = :cid
|
||||||
AND `year` = :year
|
AND `year` = :year
|
||||||
AND `month` = :month
|
AND `month` = :month
|
||||||
AND `day` = :day");
|
AND `day` = :day
|
||||||
|
");
|
||||||
$params = array(
|
$params = array(
|
||||||
"cid" => $row['customerid'],
|
"cid" => $row['customerid'],
|
||||||
"year" => $year,
|
"year" => $year,
|
||||||
@@ -283,7 +283,8 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
$updRow = $stmt->fetch(\PDO::FETCH_ASSOC);
|
$updRow = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||||
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_TRAFFIC . "` SET
|
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_TRAFFIC . "` SET
|
||||||
`mail` = :mail
|
`mail` = :mail
|
||||||
WHERE `id` = :id");
|
WHERE `id` = :id
|
||||||
|
");
|
||||||
Database::pexecute($upd_stmt, array(
|
Database::pexecute($upd_stmt, array(
|
||||||
"mail" => $updRow['mail'] + $dayTraffic,
|
"mail" => $updRow['mail'] + $dayTraffic,
|
||||||
"id" => $updRow['id']
|
"id" => $updRow['id']
|
||||||
@@ -297,7 +298,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
/**
|
/**
|
||||||
* Total Traffic
|
* Total Traffic
|
||||||
*/
|
*/
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'total traffic for ' . $row['loginname'] . ' started');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'total traffic for ' . $row['loginname'] . ' started');
|
||||||
$current_traffic = array();
|
$current_traffic = array();
|
||||||
$current_traffic['http'] = floatval($httptraffic);
|
$current_traffic['http'] = floatval($httptraffic);
|
||||||
$current_traffic['ftp_up'] = floatval(($ftptraffic['up_bytes_sum'] / 1024));
|
$current_traffic['ftp_up'] = floatval(($ftptraffic['up_bytes_sum'] / 1024));
|
||||||
@@ -360,7 +361,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
/**
|
/**
|
||||||
* WebSpace-Usage
|
* WebSpace-Usage
|
||||||
*/
|
*/
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'calculating webspace usage for ' . $row['loginname']);
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'calculating webspace usage for ' . $row['loginname']);
|
||||||
$webspaceusage = 0;
|
$webspaceusage = 0;
|
||||||
|
|
||||||
// Using repquota, it's faster using this tool than using du traversing the complete directory
|
// Using repquota, it's faster using this tool than using du traversing the complete directory
|
||||||
@@ -379,14 +380,14 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
$webspaceusage = floatval($webspaceusage['0']);
|
$webspaceusage = floatval($webspaceusage['0']);
|
||||||
unset($back);
|
unset($back);
|
||||||
} else {
|
} else {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, 'documentroot ' . $row['documentroot'] . ' does not exist');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_WARNING, 'documentroot ' . $row['documentroot'] . ' does not exist');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MailSpace-Usage
|
* MailSpace-Usage
|
||||||
*/
|
*/
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'calculating mailspace usage for ' . $row['loginname']);
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'calculating mailspace usage for ' . $row['loginname']);
|
||||||
$emailusage = 0;
|
$emailusage = 0;
|
||||||
|
|
||||||
$maildir = \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.vmail_homedir') . $row['loginname']);
|
$maildir = \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.vmail_homedir') . $row['loginname']);
|
||||||
@@ -399,13 +400,13 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
$emailusage = floatval($emailusage['0']);
|
$emailusage = floatval($emailusage['0']);
|
||||||
unset($back);
|
unset($back);
|
||||||
} else {
|
} else {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, 'maildir ' . $maildir . ' does not exist');
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_WARNING, 'maildir ' . $maildir . ' does not exist');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MySQLSpace-Usage
|
* MySQLSpace-Usage
|
||||||
*/
|
*/
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'calculating mysqlspace usage for ' . $row['loginname']);
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'calculating mysqlspace usage for ' . $row['loginname']);
|
||||||
$mysqlusage = 0;
|
$mysqlusage = 0;
|
||||||
|
|
||||||
if (isset($mysqlusage_all[$row['customerid']])) {
|
if (isset($mysqlusage_all[$row['customerid']])) {
|
||||||
@@ -609,7 +610,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function awstatsDoSingleDomain($domain, $outputdir)
|
private static function awstatsDoSingleDomain($domain, $outputdir)
|
||||||
{
|
{
|
||||||
$returnval = 0;
|
$returnval = 0;
|
||||||
|
|
||||||
@@ -630,15 +631,15 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
|
|
||||||
if (! file_exists($awbsp)) {
|
if (! file_exists($awbsp)) {
|
||||||
echo "WANRING: Necessary awstats_buildstaticpages.pl script could not be found, no traffic is being calculated and no stats are generated. Please check your AWStats-Path setting";
|
echo "WANRING: Necessary awstats_buildstaticpages.pl script could not be found, no traffic is being calculated and no stats are generated. Please check your AWStats-Path setting";
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "Necessary awstats_buildstaticpages.pl script could not be found, no traffic is being calculated and no stats are generated. Please check your AWStats-Path setting");
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_WARNING, "Necessary awstats_buildstaticpages.pl script could not be found, no traffic is being calculated and no stats are generated. Please check your AWStats-Path setting");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, "Running awstats_buildstaticpages.pl for domain '" . $domain . "' (Output: '" . $staticOutputdir . "')");
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, "Running awstats_buildstaticpages.pl for domain '" . $domain . "' (Output: '" . $staticOutputdir . "')");
|
||||||
\Froxlor\FileDir::safe_exec($awbsp . ' -awstatsprog=' . escapeshellarg($awprog) . ' -update -month=' . date('m') . ' -year=' . date('Y') . ' -config=' . $domain . ' -dir=' . escapeshellarg($staticOutputdir));
|
\Froxlor\FileDir::safe_exec($awbsp . ' -awstatsprog=' . escapeshellarg($awprog) . ' -update -month=' . date('m') . ' -year=' . date('Y') . ' -config=' . $domain . ' -dir=' . escapeshellarg($staticOutputdir));
|
||||||
|
|
||||||
// update our awstats index files
|
// update our awstats index files
|
||||||
awstatsGenerateIndex($domain, $outputdir);
|
self::awstatsGenerateIndex($domain, $outputdir);
|
||||||
|
|
||||||
// the default selection is 'current',
|
// the default selection is 'current',
|
||||||
// so link the latest dir to it
|
// so link the latest dir to it
|
||||||
@@ -647,7 +648,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
|
|
||||||
// statistics file looks like: 'awstats[month][year].[domain].txt'
|
// statistics file looks like: 'awstats[month][year].[domain].txt'
|
||||||
$file = \Froxlor\FileDir::makeCorrectFile($outputdir . '/awstats' . date('mY', time()) . '.' . $domain . '.txt');
|
$file = \Froxlor\FileDir::makeCorrectFile($outputdir . '/awstats' . date('mY', time()) . '.' . $domain . '.txt');
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, "Gathering traffic information from '" . $file . "'");
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, "Gathering traffic information from '" . $file . "'");
|
||||||
|
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
|
|
||||||
@@ -683,7 +684,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
return $returnval;
|
return $returnval;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function awstatsGenerateIndex($domain, $outputdir)
|
private static function awstatsGenerateIndex($domain, $outputdir)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Generation header
|
// Generation header
|
||||||
@@ -756,17 +757,15 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function callAwstatsGetTraffic($customerid, $outputdir, $usersdomainlist)
|
private static function callAwstatsGetTraffic($customerid, $outputdir, $usersdomainlist)
|
||||||
{
|
{
|
||||||
global $cronlog;
|
|
||||||
|
|
||||||
$returnval = 0;
|
$returnval = 0;
|
||||||
|
|
||||||
foreach ($usersdomainlist as $domainid => $singledomain) {
|
foreach ($usersdomainlist as $singledomain) {
|
||||||
// as we check for the config-model awstats will only parse
|
// as we check for the config-model awstats will only parse
|
||||||
// 'real' domains and no subdomains which are aliases in the
|
// 'real' domains and no subdomains which are aliases in the
|
||||||
// model-config-file.
|
// model-config-file.
|
||||||
$returnval += awstatsDoSingleDomain($singledomain, $outputdir);
|
$returnval += self::awstatsDoSingleDomain($singledomain, $outputdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -815,16 +814,14 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
* @return int Used traffic
|
* @return int Used traffic
|
||||||
* @author Florian Lippert <flo@syscp.org>
|
* @author Florian Lippert <flo@syscp.org>
|
||||||
*/
|
*/
|
||||||
public static function callWebalizerGetTraffic($logfile, $outputdir, $caption, $usersdomainlist)
|
private static function callWebalizerGetTraffic($logfile, $outputdir, $caption, $usersdomainlist)
|
||||||
{
|
{
|
||||||
global $cronlog;
|
|
||||||
|
|
||||||
$returnval = 0;
|
$returnval = 0;
|
||||||
|
|
||||||
$logfile = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.logfiles_directory') . $logfile . '-access.log');
|
$logfile = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.logfiles_directory') . $logfile . '-access.log');
|
||||||
if (file_exists($logfile)) {
|
if (file_exists($logfile)) {
|
||||||
$domainargs = '';
|
$domainargs = '';
|
||||||
foreach ($usersdomainlist as $domainid => $domain) {
|
foreach ($usersdomainlist as $domain) {
|
||||||
// hide referer
|
// hide referer
|
||||||
$domainargs .= ' -r ' . escapeshellarg($domain);
|
$domainargs .= ' -r ' . escapeshellarg($domain);
|
||||||
}
|
}
|
||||||
@@ -856,7 +853,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
$we = '/usr/local/bin/webalizer';
|
$we = '/usr/local/bin/webalizer';
|
||||||
}
|
}
|
||||||
|
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, "Running webalizer for domain '" . $caption . "'");
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, "Running webalizer for domain '" . $caption . "'");
|
||||||
\Froxlor\FileDir::safe_exec($we . ' ' . $verbosity . ' -p -o ' . escapeshellarg($outputdir) . ' -n ' . escapeshellarg($caption) . $domainargs . ' ' . escapeshellarg($logfile));
|
\Froxlor\FileDir::safe_exec($we . ' ' . $verbosity . ' -p -o ' . escapeshellarg($outputdir) . ' -n ' . escapeshellarg($caption) . $domainargs . ' ' . escapeshellarg($logfile));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -867,7 +864,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
*/
|
*/
|
||||||
$httptraffic = array();
|
$httptraffic = array();
|
||||||
$webalizer_hist = @file_get_contents($outputdir . 'webalizer.hist');
|
$webalizer_hist = @file_get_contents($outputdir . 'webalizer.hist');
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, "Gathering traffic information from '" . $webalizer_hist . "'");
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, "Gathering traffic information from '" . $webalizer_hist . "'");
|
||||||
|
|
||||||
$webalizer_hist_rows = explode("\n", $webalizer_hist);
|
$webalizer_hist_rows = explode("\n", $webalizer_hist);
|
||||||
foreach ($webalizer_hist_rows as $webalizer_hist_row) {
|
foreach ($webalizer_hist_rows as $webalizer_hist_row) {
|
||||||
@@ -892,7 +889,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
|||||||
reset($httptraffic);
|
reset($httptraffic);
|
||||||
$httptrafficlast = array();
|
$httptrafficlast = array();
|
||||||
$webalizer_lasthist = @file_get_contents($outputdir . 'webalizer.hist.1');
|
$webalizer_lasthist = @file_get_contents($outputdir . 'webalizer.hist.1');
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, "Gathering traffic information from '" . $webalizer_lasthist . "'");
|
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, "Gathering traffic information from '" . $webalizer_lasthist . "'");
|
||||||
|
|
||||||
$webalizer_lasthist_rows = explode("\n", $webalizer_lasthist);
|
$webalizer_lasthist_rows = explode("\n", $webalizer_lasthist);
|
||||||
foreach ($webalizer_lasthist_rows as $webalizer_lasthist_row) {
|
foreach ($webalizer_lasthist_rows as $webalizer_lasthist_row) {
|
||||||
|
|||||||
@@ -16,4 +16,5 @@
|
|||||||
*/
|
*/
|
||||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
\Froxlor\Cron\MasterCron::setArguments($argv);
|
||||||
\Froxlor\Cron\MasterCron::run();
|
\Froxlor\Cron\MasterCron::run();
|
||||||
|
|||||||
Reference in New Issue
Block a user