Commit fa97e6b087a3284d0957244ec7b1e7d73811d8c8

Authored by kevin_fourie
1 parent df844624

Merged in...

KTS-3800
"Set serverName to 127.0.0.1 in data.sql and on upgrades"
Fixed. Added the sql. Replaced the constant with the setting name.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.4-Release-Branch@9521 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/util/ktutil.inc
@@ -50,8 +50,6 @@ class KTUtil { @@ -50,8 +50,6 @@ class KTUtil {
50 const TB = 1099511627776; 50 const TB = 1099511627776;
51 const PB = 1125899906842624; 51 const PB = 1125899906842624;
52 52
53 - const SERVER_NAME_SETTING = 'server_name';  
54 -  
55 /** 53 /**
56 * Used to resolve the server name 54 * Used to resolve the server name
57 * 55 *
@@ -60,8 +58,8 @@ class KTUtil { @@ -60,8 +58,8 @@ class KTUtil {
60 { 58 {
61 global $default; 59 global $default;
62 60
63 - $serverName = KTUtil::getSystemSetting(SERVER_NAME_SETTING, false);  
64 - if($serverName !== false){ 61 + $serverName = KTUtil::getSystemSetting('server_name', false);
  62 + if($serverName !== false && !empty($serverName)){
65 return $serverName; 63 return $serverName;
66 } 64 }
67 65
@@ -91,7 +89,7 @@ class KTUtil { @@ -91,7 +89,7 @@ class KTUtil {
91 $base_url .= $rootUrl; 89 $base_url .= $rootUrl;
92 90
93 // Save as system setting 91 // Save as system setting
94 - KTUtil::setSystemSetting(SERVER_NAME_SETTING, $base_url); 92 + KTUtil::setSystemSetting('server_name', $base_url);
95 } 93 }
96 94
97 95
@@ -113,11 +111,11 @@ class KTUtil { @@ -113,11 +111,11 @@ class KTUtil {
113 if(empty($serverName) || $serverName == 'localhost') 111 if(empty($serverName) || $serverName == 'localhost')
114 { 112 {
115 // The host has not been set - check if the serverName setting exists 113 // The host has not been set - check if the serverName setting exists
116 - $base_url = KTUtil::getSystemSetting(SERVER_NAME_SETTING, false); 114 + $base_url = KTUtil::getSystemSetting('server_name', false);
117 115
118 - if (false !== $base_url) 116 + if (false !== $base_url && !empty($base_url))
119 { 117 {
120 - /* We are checking if the object exists because we could have an error pre oor during initialization */ 118 + /* We are checking if the object exists because we could have an error pre or during initialization */
121 if(is_object($default->log)) 119 if(is_object($default->log))
122 { 120 {
123 $default->log->debug("kt_url: base url - $base_url"); 121 $default->log->debug("kt_url: base url - $base_url");
@@ -144,9 +142,9 @@ class KTUtil { @@ -144,9 +142,9 @@ class KTUtil {
144 { 142 {
145 global $default; 143 global $default;
146 144
147 - $base_url = KTUtil::getSystemSetting(SERVER_NAME_SETTING, false); 145 + $base_url = KTUtil::getSystemSetting('server_name', false);
148 146
149 - if (false === $base_url) 147 + if (false === $base_url || empty($base_url))
150 { 148 {
151 $default->log->info("call_page: $path - cannot call script until user logs in from a url other than localhost or 127.0.0.1!"); 149 $default->log->info("call_page: $path - cannot call script until user logs in from a url other than localhost or 127.0.0.1!");
152 return; 150 return;
sql/mysql/install/data.sql
@@ -1443,7 +1443,8 @@ LOCK TABLES `system_settings` WRITE; @@ -1443,7 +1443,8 @@ LOCK TABLES `system_settings` WRITE;
1443 INSERT INTO `system_settings` VALUES 1443 INSERT INTO `system_settings` VALUES
1444 (1,'lastIndexUpdate','0'), 1444 (1,'lastIndexUpdate','0'),
1445 (2,'knowledgeTreeVersion','3.5.4'), 1445 (2,'knowledgeTreeVersion','3.5.4'),
1446 -(3,'databaseVersion','3.5.4'); 1446 +(3,'databaseVersion','3.5.4'),
  1447 +(4,'server_name','127.0.0.1');
1447 /*!40000 ALTER TABLE `system_settings` ENABLE KEYS */; 1448 /*!40000 ALTER TABLE `system_settings` ENABLE KEYS */;
1448 UNLOCK TABLES; 1449 UNLOCK TABLES;
1449 1450
sql/mysql/upgrade/3.5.4/server_name.sql 0 → 100644
  1 +INSERT INTO system_settings (name, value) VALUES ('server_name','127.0.0.1');
0 \ No newline at end of file 2 \ No newline at end of file