- fixing RootDir in ApsInstaller and ApsUpdater, fixes #14 and #15

- fixed root_db connection in openRootDB()
This commit is contained in:
Michael Kaufmann (d00p)
2010-02-15 12:05:15 +00:00
parent 74e3ed0a1f
commit 0488a3c2a4
4 changed files with 98 additions and 91 deletions

View File

@@ -30,26 +30,24 @@ function openRootDB($debugHandler, $lockfile)
{
global $db_root;
// If one cronscript needs root, it should say $needrootdb = true before the include
if(isset($needrootdb)
&& $needrootdb === true)
require ('./lib/userdata.inc.php');
$db_root = new db($sql_root[0]['host'], $sql_root[0]['user'], $sql_root[0]['password'], '');
if($db_root->link_id == 0)
{
$db_root = new db($sql_root[0]['host'], $sql_root[0]['user'], $sql_root[0]['password'], '');
/**
* Do not proceed further if no database connection could be established
*/
if($db_root->link_id == 0)
{
/**
* Do not proceed further if no database connection could be established
*/
fclose($debugHandler);
unlink($lockfile);
die('root can\'t connect to mysqlserver. Please check userdata.inc.php! Exiting...');
}
unset($db_root->password);
fwrite($debugHandler, 'Database-rootconnection established' . "\n");
fclose($debugHandler);
unlink($lockfile);
die('root can\'t connect to mysqlserver. Please check userdata.inc.php! Exiting...');
}
unset($db_root->password);
fwrite($debugHandler, 'Database-rootconnection established' . "\n");
unset($sql);
}
function closeRootDB()

View File

@@ -134,7 +134,7 @@ function showUpdateStep($task = null, $needs_status = true)
* outputs [OK] (success), [??] (warning) or [!!] (failure)
* of the last update-step
*
* @param int status (0 = success, 1 = warning, -1 = failure)
* @param int status (0 = success, 1 = warning, 2 = failure)
*
* @return string formatted output and log-entry
*/