Inheritance diagram for ilCronClients:
Collaboration diagram for ilCronClients:Public Member Functions | |
| ilCronClients () | |
| & | _getInstance () |
| __createLock () | |
| _lockExists () | |
| __readClients () | |
| __startChecks () | |
| __openDb () | |
| __checkDBVersion () | |
| __readFileDBVersion () | |
| __checkAccess () | |
| __ilCronClients () | |
Data Fields | |
| $fp | |
Definition at line 39 of file class.ilCronClients.php.
| ilCronClients::__checkAccess | ( | ) |
Definition at line 223 of file class.ilCronClients.php.
Referenced by __readClients().
{
if($_SERVER['REQUEST_URI'])
{
if(!$this->web_enabled or ($_GET['web_pass'] !== $this->web_pass))
{
if($this->log['enabled'])
{
include_once '../classes/class.ilLog.php';
$this->log =& new ilLog($this->log['path'],$this->log['file']);
$this->log->write('Cron: __checkAccess() failed');
exit;
}
}
}
return true;
}
Here is the caller graph for this function:| ilCronClients::__checkDBVersion | ( | ) |
Definition at line 190 of file class.ilCronClients.php.
References $query, $res, and $row.
Referenced by __startChecks().
{
$query = "SELECT value FROM settings ".
"WHERE keyword = 'db_version'";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$db_version = $row->value;
}
return $db_version == $this->file_version;
}
Here is the caller graph for this function:| ilCronClients::__createLock | ( | ) |
Definition at line 64 of file class.ilCronClients.php.
Referenced by ilCronClients().
{
$this->fp = @fopen('cron.lock','wb');
fwrite($this->fp,(string) time(),strlen((string) time()));
return true;
}
Here is the caller graph for this function:| ilCronClients::__ilCronClients | ( | ) |
Definition at line 246 of file class.ilCronClients.php.
{
fclose($this->fp);
}
| ilCronClients::__openDb | ( | ) |
Definition at line 173 of file class.ilCronClients.php.
Referenced by __startChecks().
{
$dsn = $this->db_data['type']."://".
$this->db_data['user'].":".
$this->db_data['pass']."@".
$this->db_data['host']."/".
$this->db_data['name'];
$this->db = DB::connect($dsn,true);
if (DB::isError($this->db))
{
return false;
}
return true;
}
Here is the caller graph for this function:| ilCronClients::__readClients | ( | ) |
Definition at line 89 of file class.ilCronClients.php.
References $file, __checkAccess(), and __startChecks().
Referenced by ilCronClients().
{
include_once '../classes/class.ilIniFile.php';
$ini_file_obj =& new ilIniFile(INI_FILE_PATH);
$ini_file_obj->read();
$this->log['enabled'] = $ini_file_obj->readVariable('log','enabled');
$this->log['path'] = $ini_file_obj->readVariable('log','path');
$this->log['file'] = $ini_file_obj->readVariable('log','file');
$this->web_enabled = $ini_file_obj->readVariable('cron','web_enabled');
$this->web_pass = $ini_file_obj->readVariable('cron','web_pass');
$this->__checkAccess();
$this->client_data = $ini_file_obj->readGroup('clients');
unset($ini_file_obj);
// open client.ini.php
// set path to directory where clients reside
$this->client_ini = array();
$dp = opendir('../'.$this->client_data['path']);
while(($file = readdir($dp)) !== false)
{
if($file == '.' or $file == '..' or $file == 'CVS')
{
continue;
}
if(@file_exists('../'.$this->client_data['path'].'/'.$file.'/'.$this->client_data['inifile']))
{
$tmp_data['path'] = '../'.$this->client_data['path'].'/'.$file.'/'.$this->client_data['inifile'];
$tmp_data['name'] = $file;
$this->client_ini[] = $tmp_data;
unset($tmp_data);
}
}
$this->__startChecks();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCronClients::__readFileDBVersion | ( | ) |
Definition at line 204 of file class.ilCronClients.php.
References $row.
Referenced by __startChecks().
{
$this->db_version = 99999;
// GET FILE VERSION
if(!$content = file('../sql/dbupdate.php'))
{
echo 'Cannot open ../sql/dbupdate.php';
return false;
}
foreach($content as $row)
{
if(preg_match('/^<#([0-9]+)>/',$row,$matches))
{
$this->file_version = $matches[1];
}
}
}
Here is the caller graph for this function:| ilCronClients::__startChecks | ( | ) |
Definition at line 134 of file class.ilCronClients.php.
References $cron_obj, $log, __checkDBVersion(), __openDb(), and __readFileDBVersion().
Referenced by __readClients().
{
foreach($this->client_ini as $client_data)
{
include_once '../classes/class.ilIniFile.php';
$ini_file_obj =& new ilIniFile($client_data['path']);
$ini_file_obj->read();
$this->db_data = $ini_file_obj->readGroup('db');
$this->__readFileDBVersion();
if($this->__openDb())
{
include_once './classes/class.ilCron.php';
$cron_obj =& new ilCron($this->db);
if($this->log['enabled'])
{
$cron_obj->initLog($this->log['path'],$this->log['file'],$client_data['name']);
}
if($this->__checkDBVersion())
{
$cron_obj->start();
}
else
{
include_once '../classes/class.ilLog.php';
$log =& new ilLog($this->log['path'],$this->log['file']);
$log->write('Cron: Database not up to date. Aborting');
}
$this->db->disconnect();
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| & ilCronClients::_getInstance | ( | ) |
Definition at line 55 of file class.ilCronClients.php.
References _lockExists(), and ilCronClients().
{
if(ilCronClients::_lockExists())
{
die('Instance already created');
}
return new ilCronClients();
}
Here is the call graph for this function:| ilCronClients::_lockExists | ( | ) |
Definition at line 72 of file class.ilCronClients.php.
References $fp.
Referenced by _getInstance().
{
if(@file_exists('cron.lock'))
{
$fp = fopen('cron.lock','r');
(int) $timest = fread($fp,filesize('cron.lock'));
if(!CRON_DEBUG and ($timest > time() - 60 * 60 * 12))
{
return true;
}
unlink('cron.lock');
}
return false;
}
Here is the caller graph for this function:| ilCronClients::ilCronClients | ( | ) |
Definition at line 44 of file class.ilCronClients.php.
References __createLock(), and __readClients().
Referenced by _getInstance().
{
define('INI_FILE_PATH','../ilias.ini.php');
define('CRON_DEBUG',1);
$this->__createLock();
$this->__readClients();
register_shutdown_function(array($this,'__ilCronClients'));
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCronClients::$fp |
Definition at line 41 of file class.ilCronClients.php.
Referenced by _lockExists().
1.7.1