ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilArrayTableDataParser Class Reference
+ Collaboration diagram for ilArrayTableDataParser:

Public Member Functions

 __construct ($data_dir)
 startParsing ()

Protected Attributes

 $dir = null
 $value = ''

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 8 of file class.ilArrayTableDataParser.php.

Constructor & Destructor Documentation

ilArrayTableDataParser::__construct (   $data_dir)

Definition at line 14 of file class.ilArrayTableDataParser.php.

{
$this->dir = $data_dir;
}

Member Function Documentation

ilArrayTableDataParser::startParsing ( )

Definition at line 19 of file class.ilArrayTableDataParser.php.

References $file, $ilDB, $ilLog, and $row.

{
global $ilDB,$ilLog;
if(!$dp = opendir($this->dir))
{
$ilLog->write(__METHOD__.': Cannot open data directory: '.$this->dir);
return false;
}
$ilLog->write(__METHOD__.': Reading table data from: '.$this->dir);
while (false !== ($file = readdir($dp)))
{
$ilLog->write(__METHOD__.': Handling file: '.$file);
if(substr($file, -5) != '.data')
{
$ilLog->write(__METHOD__.': Ignoring file: '.$file);
continue;
}
$content = file_get_contents($this->dir.DIRECTORY_SEPARATOR.$file);
$ilLog->write(__METHOD__.': Reading inserts of '.$this->dir.'/'.$file);
$content = unserialize($content);
if(!is_array($content))
{
$ilLog->write(__METHOD__.': No entries found in '.$this->dir.'/'.$file);
continue;
}
foreach($content as $table => $rows)
{
foreach($rows as $row)
{
$ilDB->insert($table,$row);
}
}
if(function_exists('memory_get_usage'))
{
$ilLog->write(__METHOD__.': Memory usage '.memory_get_usage(true));
}
}
fclose($dp);
}

Field Documentation

ilArrayTableDataParser::$dir = null
protected

Definition at line 10 of file class.ilArrayTableDataParser.php.

ilArrayTableDataParser::$value = ''
protected

Definition at line 12 of file class.ilArrayTableDataParser.php.


The documentation for this class was generated from the following file: