mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-01 13:49:28 +00:00
Put protocol_server_script into global configuration variable. Find the
correct changelog and get the version number.
This commit is contained in:
parent
fe642a4f7b
commit
8451746c39
@ -19,6 +19,7 @@ $c->save_time_zone_defs = 1;
|
||||
$c->stylesheets = array( "/rscds.css" );
|
||||
$c->collections_always_exist = true;
|
||||
|
||||
|
||||
// Kind of private configuration values
|
||||
$c->total_query_time = 0;
|
||||
|
||||
@ -26,8 +27,20 @@ $c->dbg = array( );
|
||||
|
||||
require_once("AWLUtilities.php");
|
||||
|
||||
dbg_error_log( "core", "==========> method =%s= =%s:%d= =%s= =%s=",
|
||||
$_SERVER['REQUEST_METHOD'], $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['SCRIPT_NAME'], $_SERVER['PATH_INFO']);
|
||||
/**
|
||||
* Calculate the simplest form of reference to this page, excluding the PATH_INFO following the script name.
|
||||
*/
|
||||
$c->protocol_server_port_script = sprintf( "%s://%s%s%s", (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'? 'https' : 'http'), $_SERVER['SERVER_NAME'],
|
||||
(
|
||||
( (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') && $_SERVER['SERVER_PORT'] == 80 )
|
||||
|| (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] == 443 )
|
||||
? ''
|
||||
: ':'.$_SERVER['SERVER_PORT']
|
||||
),
|
||||
$_SERVER['SCRIPT_NAME'] );
|
||||
|
||||
dbg_error_log( "LOG", "==========> method =%s= =%s= =%s=", $_SERVER['REQUEST_METHOD'], $c->protocol_server_port_script, $_SERVER['PATH_INFO']);
|
||||
|
||||
if ( file_exists("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php") ) {
|
||||
include_once("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php");
|
||||
}
|
||||
@ -39,6 +52,29 @@ else {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Figure our version from the changelog
|
||||
*/
|
||||
$c->code_version = 0;
|
||||
$changelog = false;
|
||||
if ( file_exists("../debian/changelog") ) {
|
||||
$changelog = fopen( "../debian/changelog", "r" );
|
||||
}
|
||||
else if ( file_exists("/usr/share/doc/rscds/changelog.Debian") ) {
|
||||
$changelog = fopen( "/usr/share/doc/rscds/changelog.Debian", "r" );
|
||||
}
|
||||
else if ( file_exists("/usr/share/doc/rscds/changelog") ) {
|
||||
$changelog = fopen( "/usr/share/doc/rscds/changelog", "r" );
|
||||
}
|
||||
if ( $changelog ) {
|
||||
list( $c->code_pkgver, $c->code_major, $c->code_minor, $c->code_patch, $c->code_debian ) = fscanf($changelog, "%s (%d.%d.%d-%d)");
|
||||
$c->code_version = (($c->code_major * 1000) + $c->code_minor).".".$c->code_patch;
|
||||
fclose($changelog);
|
||||
}
|
||||
dbg_error_log("caldav", "Version %s (%d.%d.%d-%d) == %s", $c->code_pkgver, $c->code_major, $c->code_minor, $c->code_patch, $c->code_debian, $c->code_version);
|
||||
header( sprintf("Server: %s/%d.%d", $c->code_pkgver, $c->code_major, $c->code_minor) );
|
||||
|
||||
|
||||
/**
|
||||
* Force the domain name to what was in the configuration file
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user