mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-06 09:22:04 -04:00
Move loading of global Servers array into config.php.
This commit is contained in:
1 parent
df8bc464e3
commit
8c35190b0a
2 files changed
+26
-17
No files matched your search
+26
-14
@@ -220,25 +220,37 @@ function loadConfig( $defineConsts=true ) {
|
||||
return $config;
|
||||
} # end function loadConfig
|
||||
|
||||
require_once('Server.php');
|
||||
#global $Servers;
|
||||
#global $thisServer;
|
||||
$Servers = ZM\Server::find([], ['order'=>'lower(Name)']);
|
||||
$thisServer = null;
|
||||
|
||||
// For Human-readability, use ZM_SERVER_HOST or ZM_SERVER_NAME in zm.conf, and convert it here to a ZM_SERVER_ID
|
||||
if ( ! defined('ZM_SERVER_ID') ) {
|
||||
require_once('Server.php');
|
||||
if ( defined('ZM_SERVER_NAME') and ZM_SERVER_NAME ) {
|
||||
# Use Server lookup so that it caches
|
||||
$Server = ZM\Server::find_one(array('Name'=>ZM_SERVER_NAME));
|
||||
if ( !$Server ) {
|
||||
ZM\Error('Invalid Multi-Server configration detected. ZM_SERVER_NAME set to ' . ZM_SERVER_NAME . ' in zm.conf, but no corresponding entry found in Servers table.');
|
||||
} else {
|
||||
define('ZM_SERVER_ID', $Server->Id());
|
||||
if (!defined('ZM_SERVER_ID')) {
|
||||
if (defined('ZM_SERVER_NAME') and ZM_SERVER_NAME) {
|
||||
foreach ($Servers as $s) {
|
||||
if ($s->Name() == ZM_SERVER_NAME) {
|
||||
$thisServer = $s;
|
||||
define('ZM_SERVER_ID', $Server->Id());
|
||||
}
|
||||
}
|
||||
} else if ( defined('ZM_SERVER_HOST') and ZM_SERVER_HOST ) {
|
||||
$Server = ZM\Server::find_one(array('Name'=>ZM_SERVER_HOST));
|
||||
if ( ! $Server ) {
|
||||
if (!$thisServer) {
|
||||
ZM\Error('Invalid Multi-Server configration detected. ZM_SERVER_NAME set to ' . ZM_SERVER_NAME . ' in zm.conf, but no corresponding entry found in Servers table.');
|
||||
}
|
||||
} else if (defined('ZM_SERVER_HOST') and ZM_SERVER_HOST) {
|
||||
foreach ($Servers as $s) {
|
||||
if ($s->Name() == ZM_SERVER_HOST) {
|
||||
$thisServer = $s;
|
||||
define('ZM_SERVER_ID', $s->Id());
|
||||
}
|
||||
}
|
||||
if (!$thisServer) {
|
||||
ZM\Error('Invalid Multi-Server configration detected. ZM_SERVER_HOST set to ' . ZM_SERVER_HOST . ' in zm.conf, but no corresponding entry found in Servers table.');
|
||||
} else {
|
||||
define('ZM_SERVER_ID', $Server->Id());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$thisServer = ZM\Server::find_one(['Id'=>ZM_SERVER_ID]); // Should be cached
|
||||
}
|
||||
|
||||
if ( defined('ZM_TIMEZONE') and ZM_TIMEZONE )
|
||||
|
||||
@@ -45,7 +45,6 @@ if ( false ) {
|
||||
require_once('includes/config.php');
|
||||
require_once('includes/session.php');
|
||||
require_once('includes/logger.php'); // already included in config
|
||||
require_once('includes/Server.php');
|
||||
|
||||
// Useful debugging lines for mobile devices
|
||||
if ( 0 and ZM\Logger::fetch()->debugOn() ) {
|
||||
@@ -56,8 +55,6 @@ if ( 0 and ZM\Logger::fetch()->debugOn() ) {
|
||||
}
|
||||
ZM\Debug(print_r($_REQUEST, true));
|
||||
|
||||
global $Servers;
|
||||
$Servers = ZM\Server::find([], ['order'=>'lower(Name)']);
|
||||
|
||||
if (
|
||||
(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
|
||||
|
||||
Reference in new issue
Block a user