ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ILIAS\WebDAV\Lock\LocksRepositoryDB Class Reference
+ Inheritance diagram for ILIAS\WebDAV\Lock\LocksRepositoryDB:
+ Collaboration diagram for ILIAS\WebDAV\Lock\LocksRepositoryDB:

Public Member Functions

 __construct (protected ilDBInterface $db)
 
 existsFor (string $token)
 
 maybeGetLockFromToken (string $token)
 
 maybeGetLockFromObjId (int $obj_id)
 
 save (LockObject $ilias_lock)
 
 remove (string $token)
 
 purgeExpired ()
 
 updateLocks (int $old_obj_id, int $new_obj_id)
 
 existsFor (string $token)
 
 maybeGetLockFromToken (string $token)
 
 maybeGetLockFromObjId (int $obj_id)
 
 save (LockObject $ilias_lock)
 
 remove (string $token)
 
 purgeExpired ()
 
 updateLocks (int $old_obj_id, int $new_obj_id)
 

Private Attributes

string $lock_table = 'dav_lock'
 

Detailed Description

Author
Raphael Heer rapha.nosp@m.el.h.nosp@m.eer@h.nosp@m.slu..nosp@m.ch $Id$

Definition at line 29 of file LocksRepositoryDB.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\WebDAV\Lock\LocksRepositoryDB::__construct ( protected ilDBInterface  $db)

Definition at line 33 of file LocksRepositoryDB.php.

34 {
35 }

Member Function Documentation

◆ existsFor()

ILIAS\WebDAV\Lock\LocksRepositoryDB::existsFor ( string  $token)

Implements ILIAS\WebDAV\Lock\LocksRepository.

Definition at line 37 of file LocksRepositoryDB.php.

37 : bool
38 {
39 $select_query = "SELECT 1 FROM $this->lock_table WHERE token = "
40 . $this->db->quote($token, 'text');
41 $select_result = $this->db->query($select_query);
42 return $this->db->fetchAssoc($select_result) !== null;
43 }
$token
Definition: xapitoken.php:67

References $token.

◆ maybeGetLockFromObjId()

ILIAS\WebDAV\Lock\LocksRepositoryDB::maybeGetLockFromObjId ( int  $obj_id)

Implements ILIAS\WebDAV\Lock\LocksRepository.

Definition at line 70 of file LocksRepositoryDB.php.

70 : ?LockObject
71 {
72 $query = "SELECT token, ilias_owner, dav_owner, expires, depth, type, scope FROM $this->lock_table WHERE obj_id = "
73 . $this->db->quote($obj_id, 'integer')
74 . " AND expires > " . $this->db->quote(time(), 'integer');
75 $select_result = $this->db->query($query);
76 $row = $this->db->fetchAssoc($select_result);
77
78 if ($row) {
79 return new Lock(
80 $row['token'],
81 $obj_id,
82 (int) $row['ilias_owner'],
83 $row['dav_owner'],
84 (int) $row['expires'],
85 (int) $row['depth'],
86 $row['type'] ?? '',
87 (int) $row['scope']
88 );
89 }
90
91 return null;
92 }

◆ maybeGetLockFromToken()

ILIAS\WebDAV\Lock\LocksRepositoryDB::maybeGetLockFromToken ( string  $token)

Implements ILIAS\WebDAV\Lock\LocksRepository.

Definition at line 45 of file LocksRepositoryDB.php.

45 : ?LockObject
46 {
47 $query = "SELECT obj_id, ilias_owner, dav_owner, expires, depth, type, scope FROM $this->lock_table"
48 . " WHERE token = " . $this->db->quote($token, 'text')
49 . " AND expires > " . $this->db->quote(time(), 'integer');
50
51 $select_result = $this->db->query($query);
52 $row = $this->db->fetchAssoc($select_result);
53
54 if ($row) {
55 return new Lock(
56 $token,
57 (int) $row['obj_id'],
58 (int) $row['ilias_owner'],
59 $row['dav_owner'],
60 (int) $row['expires'],
61 (int) $row['depth'],
62 $row['type'] ?? '',
63 (int) $row['scope']
64 );
65 }
66
67 return null;
68 }

References $token.

◆ purgeExpired()

ILIAS\WebDAV\Lock\LocksRepositoryDB::purgeExpired ( )

Implements ILIAS\WebDAV\Lock\LocksRepository.

Definition at line 115 of file LocksRepositoryDB.php.

115 : int
116 {
117 return $this->db->manipulate(
118 "DELETE FROM $this->lock_table WHERE expires < " . $this->db->quote(time(), 'integer')
119 );
120 }

◆ remove()

ILIAS\WebDAV\Lock\LocksRepositoryDB::remove ( string  $token)

Implements ILIAS\WebDAV\Lock\LocksRepository.

Definition at line 108 of file LocksRepositoryDB.php.

108 : int
109 {
110 return $this->db->manipulate(
111 "DELETE FROM $this->lock_table WHERE token = " . $this->db->quote($token, 'text')
112 );
113 }

References $token.

◆ save()

ILIAS\WebDAV\Lock\LocksRepositoryDB::save ( LockObject  $ilias_lock)

Implements ILIAS\WebDAV\Lock\LocksRepository.

Definition at line 94 of file LocksRepositoryDB.php.

94 : void
95 {
96 $this->db->insert($this->lock_table, [
97 'token' => ['text', $ilias_lock->getToken()],
98 'obj_id' => ['integer', $ilias_lock->getObjId()],
99 'ilias_owner' => ['integer', $ilias_lock->getIliasOwner()],
100 'dav_owner' => ['text', $ilias_lock->getDavOwner()],
101 'expires' => ['integer', $ilias_lock->getExpires()],
102 'depth' => ['integer', $ilias_lock->getDepth()],
103 'type' => ['text', $ilias_lock->getType()],
104 'scope' => ['integer', $ilias_lock->getScope()]
105 ]);
106 }

References ILIAS\WebDAV\Lock\LockObject\getDavOwner(), ILIAS\WebDAV\Lock\LockObject\getDepth(), ILIAS\WebDAV\Lock\LockObject\getExpires(), ILIAS\WebDAV\Lock\LockObject\getIliasOwner(), ILIAS\WebDAV\Lock\LockObject\getObjId(), ILIAS\WebDAV\Lock\LockObject\getScope(), ILIAS\WebDAV\Lock\LockObject\getToken(), and ILIAS\WebDAV\Lock\LockObject\getType().

+ Here is the call graph for this function:

◆ updateLocks()

ILIAS\WebDAV\Lock\LocksRepositoryDB::updateLocks ( int  $old_obj_id,
int  $new_obj_id 
)

Implements ILIAS\WebDAV\Lock\LocksRepository.

Definition at line 122 of file LocksRepositoryDB.php.

122 : int
123 {
124 return $this->db->update(
125 $this->lock_table,
126 ["obj_id" => ["integer", $new_obj_id]],
127 ["obj_id" => ["integer", $old_obj_id]]
128 );
129 }

Field Documentation

◆ $lock_table

string ILIAS\WebDAV\Lock\LocksRepositoryDB::$lock_table = 'dav_lock'
private

Definition at line 31 of file LocksRepositoryDB.php.


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