ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilAssQuestionProcessLockerDb.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLocker.php';
5 
13 {
17  protected $db;
18 
22  protected $atom_query;
23 
27  private $assessmentLogEnabled = false;
28 
32  public function __construct(ilDBInterface $db)
33  {
34  $this->db = $db;
35  }
36 
37  public function isAssessmentLogEnabled()
38  {
40  }
41 
43  {
44  $this->assessmentLogEnabled = $assessmentLogEnabled;
45  }
46 
51  {
52  return array(
53  array('name' => 'qpl_questions', 'sequence' => false),
54  array('name' => 'tst_tests', 'sequence' => false),
55  array('name' => 'tst_active', 'sequence' => false),
56  array('name' => 'ass_log', 'sequence' => true)
57  );
58  }
59 
64  {
65  return array(
66  array('name' => 'tst_solutions', 'sequence' => true)
67  );
68  }
69 
74  {
75  return array(
76  array('name' => 'tst_test_result', 'sequence' => true)
77  );
78  }
79 
84  {
85  $tables = $this->getTablesUsedDuringSolutionUpdate();
86 
87  if($this->isAssessmentLogEnabled())
88  {
89  $tables = array_merge($tables, $this->getTablesUsedDuringAssessmentLog());
90  }
91 
92  $this->atom_query = $this->db->buildAtomQuery();
93  foreach($tables as $table)
94  {
95  $this->atom_query->addTableLock($table['name'])->lockSequence((bool)$table['sequence']);
96  }
97  }
98 
103  {
104  $this->atom_query = $this->db->buildAtomQuery();
105  foreach($this->getTablesUsedDuringResultUpdate() as $table)
106  {
107  $this->atom_query->addTableLock($table['name'])->lockSequence((bool)$table['sequence']);
108  }
109  }
110 
115  {
116  $this->atom_query = $this->db->buildAtomQuery();
117  foreach(array_merge(
119  ) as $table)
120  {
121  $this->atom_query->addTableLock($table['name'])->lockSequence((bool)$table['sequence']);
122  }
123  }
124 
129  {
130  $this->atom_query = $this->db->buildAtomQuery();
131  $this->atom_query->addTableLock('tst_result_cache');
132  }
133 
137  protected function executeOperation(callable $operation)
138  {
139  if($this->atom_query)
140  {
141  $this->atom_query->addQueryCallable(function(ilDBInterface $ilDB) use ($operation) {
142  $operation();
143  });
144  $this->atom_query->run();
145  }
146  else
147  {
148  $operation();
149  }
150 
151  $this->atom_query = null;
152  }
153 }
Interface ilDBInterface.
Create styles array
The data for the language used.
global $ilDB