Commit 83b27bbb4e04688a779fde7eda9c4e22fa096774

Authored by nbm
1 parent 1fada1e2

Make it clear which user needs to own/write to the log and Documents

directory.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3237 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 31 additions and 0 deletions
setup/precheckup.php
... ... @@ -149,12 +149,31 @@ $phpversion4 = phpversion() < '4' ? '<b><font color="red">No</font></b> <small>(
149 149 $phpversion43 = phpversion() < '4.3' ? '<b><font color="orange">No</font></b> <small>(PHP 4.3 is recommended)</small>' : '<b><font color="green">Yes</font></b>';
150 150 $phpversion5 = phpversion() >= '5' ? '<b><font color="red">No</font></b> <small>(KnowledgeTree does not yet work with PHP5)</small>' : '<b><font color="green">Yes</font></b>';
151 151  
  152 +function running_user() {
  153 + if (substr(PHP_OS, 0, 3) == "WIN") {
  154 + return null;
  155 + }
  156 + if (extension_loaded("posix")) {
  157 + $uid = posix_getuid();
  158 + $userdetails = posix_getpwuid($uid);
  159 + return $userdetails['name'];
  160 + }
  161 + if (file_exists('/usr/bin/whoami')) {
  162 + return exec('/usr/bin/whoami');
  163 + }
  164 + if (file_exists('/usr/bin/id')) {
  165 + return exec('/usr/bin/id -nu');
  166 + }
  167 + return null;
  168 +}
  169 +
152 170 ?>
153 171 <html>
154 172 <head>
155 173 <title>KnowledgeTree Checkup</title>
156 174 <style>
157 175 th { text-align: left; }
  176 +td { vertical-align: top; }
158 177 </style>
159 178 </head>
160 179  
... ... @@ -283,6 +302,18 @@ PHP you are running, and which modules are available.&lt;/p&gt;
283 302 <table width="50%">
284 303 <tbody>
285 304 <?=writablePath('Log directory', 'log')?>
  305 +<?php
  306 +$username = running_user();
  307 +if (is_null($username)) {
  308 + $message = "You are on a system that does not make user details available, and so no advice is possible on the correct ownership of the <b>log</b> and <b>Documents</b> directories.";
  309 +} else {
  310 + $message = 'KnowledgeTree will be run as the <b><font color="orange">' . $username . '</font></b> system user, and must be able to write to the <b>log</b> and <b>Documents</b> directories.';
  311 +}
  312 +?>
  313 +<tr>
  314 +<td width="33%">General</td>
  315 +<td><?=$message?></td>
  316 +</tr>
286 317 </tbody>
287 318 </table>
288 319  
... ...