ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilTestProcessLockerDb.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
28 {
32  protected $db;
33 
37  protected $atom_query;
38 
42  public function __construct(ilDBInterface $db)
43  {
44  $this->db = $db;
45  $this->atom_query = $this->db->buildAtomQuery();
46  }
47 
52  {
53  $this->atom_query->addTableLock('tst_active');
54  }
55 
59  protected function onBeforeExecutingRandomPassBuildOperation($withTaxonomyTables = false)
60  {
61  $this->atom_query->addTableLock('tst_rnd_cpy');
62  $this->atom_query->addTableLock('qpl_questions');
63  $this->atom_query->addTableLock('qpl_qst_type');
64  $this->atom_query->addTableLock('tst_test_rnd_qst')->lockSequence(true);
65  $this->atom_query->addTableLock('il_plugin');
66  $this->atom_query->addTableLock('tst_active');
67 
68  if ($withTaxonomyTables) {
69  $this->atom_query->addTableLock('tax_tree')->aliasName('s');
70  $this->atom_query->addTableLock('tax_tree')->aliasName('t');
71  $this->atom_query->addTableLock('tax_node_assignment');
72  }
73  }
74 
79  {
80  $this->atom_query->addTableLock('tst_active');
81  }
82 
86  protected function executeOperation(callable $operation)
87  {
88  $this->atom_query ->addQueryCallable(function (ilDBInterface $ilDB) use ($operation) {
89  $operation();
90  });
91  $this->atom_query->run();
92  }
93 
94  protected function onBeforeExecutingNamedOperation(string $operationDescriptor): void
95  {
96  throw new RuntimeException('Operation not supported');
97  }
98 
99  protected function onAfterExecutingNamedOperation(string $operationDescriptor): void
100  {
101  throw new RuntimeException('Operation not supported');
102  }
103 }
onBeforeExecutingNamedOperation(string $operationDescriptor)
onAfterExecutingNamedOperation(string $operationDescriptor)
onBeforeExecutingRandomPassBuildOperation($withTaxonomyTables=false)
{}
executeOperation(callable $operation)
{}