ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

◆ __construct()

ilArrayTableDataParser::__construct (   $data_dir)

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

15  {
16  $this->dir = $data_dir;
17  }

Member Function Documentation

◆ startParsing()

ilArrayTableDataParser::startParsing ( )

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

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

20  {
21  global $ilDB,$ilLog;
22 
23  if (!$dp = opendir($this->dir)) {
24  $ilLog->write(__METHOD__ . ': Cannot open data directory: ' . $this->dir);
25  return false;
26  }
27 
28  $ilLog->write(__METHOD__ . ': Reading table data from: ' . $this->dir);
29  while (false !== ($file = readdir($dp))) {
30  $ilLog->write(__METHOD__ . ': Handling file: ' . $file);
31  if (substr($file, -5) != '.data') {
32  $ilLog->write(__METHOD__ . ': Ignoring file: ' . $file);
33  continue;
34  }
35 
36  $content = file_get_contents($this->dir . DIRECTORY_SEPARATOR . $file);
37 
38  $ilLog->write(__METHOD__ . ': Reading inserts of ' . $this->dir . '/' . $file);
39  $content = unserialize($content);
40 
41  if (!is_array($content)) {
42  $ilLog->write(__METHOD__ . ': No entries found in ' . $this->dir . '/' . $file);
43  continue;
44  }
45 
46  foreach ($content as $table => $rows) {
47  foreach ($rows as $row) {
48  $ilDB->insert($table, $row);
49  }
50  }
51  if (function_exists('memory_get_usage')) {
52  $ilLog->write(__METHOD__ . ': Memory usage ' . memory_get_usage(true));
53  }
54  }
55  fclose($dp);
56  }
$rows
Definition: xhr_table.php:10
global $ilDB
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
if(empty($password)) $table
Definition: pwgen.php:24

Field Documentation

◆ $dir

ilArrayTableDataParser::$dir = null
protected

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

◆ $value

ilArrayTableDataParser::$value = ''
protected

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


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