- removed some undefined variables

- fixed function openRootDB
- fixed realtime-function (it's now a tcp connection), fixes #24
- fixed missing $-sign befor variable in makePathfield
This commit is contained in:
Michael Kaufmann (d00p)
2010-02-21 21:09:48 +00:00
parent c192d19d7e
commit e8de3d45e5
13 changed files with 64 additions and 34 deletions

View File

@@ -48,7 +48,7 @@ function makePathfield($path, $uid, $gid, $fieldType, $value = '')
if(sizeof($dirList) > 0)
{
if(sizeof(dirList) <= 100)
if(sizeof($dirList) <= 100)
{
$field = '<select name="path">';
foreach($dirList as $key => $dir)

View File

@@ -60,16 +60,17 @@ function getNextCronjobs()
function includeCronjobs($debugHandler, $pathtophpfiles)
{
global $settings;
$cronjobs = getNextCronjobs();
$jobs_to_run = array();
$cron_path = makeCorrectDir($pathtophpfiles.'/scripts/jobs/');
if($cronjobs !== false
&& is_array($cronjobs)
&& isset($cronjobs[0]))
{
$cron_path = makeCorrectDir($pathtophpfiles.'/scripts/jobs/');
foreach($cronjobs as $cronjob)
{
$cron_file = makeCorrectFile($cron_path.$cronjob);
@@ -77,6 +78,17 @@ function includeCronjobs($debugHandler, $pathtophpfiles)
}
}
/**
* if we're on realtime and cron_tasks is not one
* of the jobs to run, we add it so the changes are being applied
*/
if ($settings['system']['realtime_port'] !== 0) {
$cron_file = makeCorrectFile($cron_path.'/cron_tasks.php');
if (!in_array($cron_file, $jobs_to_run)) {
$jobs_to_run[] = $cron_file;
}
}
return $jobs_to_run;
}

View File

@@ -64,21 +64,23 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '')
}
if($doupdate === true
&& (int)$settings['system']['realtime_port'] !== 0)
&& (int)$settings['system']['realtime_port'] !== 0
&& function_exists('socket_create'))
{
$timeout = 15;
$socket = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
//$socket = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
$socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if($socket !== false)
{
// create the request packet
$packet = chr(0) . chr(1) . 'RUN' . chr(0);
// UDP is connectionless, so we just send on it.
@socket_sendto($socket, $packet, strlen($packet), 0x100, '127.0.0.1', (int)$settings['system']['realtime_port']);
//@socket_sendto($socket, $packet, strlen($packet), 0x100, '127.0.0.1', (int)$settings['system']['realtime_port']);
/*
* this is for TCP-Connections
*
*/
$time = time();
while(!@socket_connect($socket, '127.0.0.1', (int)$settings['system']['realtime_port']))
@@ -97,7 +99,9 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '')
continue;
}
}
*/
/**
* close socket
*/
@socket_close($socket);
}
}

View File

@@ -30,7 +30,16 @@ function openRootDB($debugHandler, $lockfile)
{
global $db_root;
require ('./lib/userdata.inc.php');
require dirname(dirname(dirname(__FILE__))).'/userdata.inc.php';
// Legacy sql-root-information
if(isset($sql['root_user']) && isset($sql['root_password']) && (!isset($sql_root) || !is_array($sql_root)))
{
$sql_root = array(0 => array('caption' => 'Default', 'host' => $sql['host'], 'user' => $sql['root_user'], 'password' => $sql['root_password']));
unset($sql['root_user']);
unset($sql['root_password']);
}
$db_root = new db($sql_root[0]['host'], $sql_root[0]['user'], $sql_root[0]['password'], '');
if($db_root->link_id == 0)