ILIAS  release_8 Revision v8.24
ilWebDAVLocksRepository Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilWebDAVLocksRepository:

Public Member Functions

 __construct (ilDBInterface $db)
 
 checkIfLockExistsInDB (string $token)
 
 getLockObjectWithTokenFromDB (string $token)
 
 getLockObjectWithObjIdFromDB (int $obj_id)
 
 saveLockToDB (ilWebDAVLockObject $ilias_lock)
 
 removeLockWithTokenFromDB (string $token)
 
 purgeExpiredLocksFromDB ()
 
 updateLocks (int $old_obj_id, int $new_obj_id)
 

Protected Attributes

ilDBInterface $db
 

Private Attributes

string $lock_table = 'dav_lock'
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

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

Definition at line 25 of file class.ilWebDAVLocksRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVLocksRepository::__construct ( ilDBInterface  $db)

Definition at line 31 of file class.ilWebDAVLocksRepository.php.

32 {
33 $this->db = $db;
34 }

References $db.

Member Function Documentation

◆ checkIfLockExistsInDB()

ilWebDAVLocksRepository::checkIfLockExistsInDB ( string  $token)

Definition at line 36 of file class.ilWebDAVLocksRepository.php.

36 : bool
37 {
38 $select_query = "SELECT SELECT EXISTS(SELECT 1 FROM $this->lock_table WHERE token = " .
39 $this->db->quote($token, 'text') . ") AS count";
40 $select_result = $this->db->query($select_query);
41 $select_result->numRows();
42 $row = $this->db->fetchAssoc($select_result);
43 if (isset($row)) {
44 return true;
45 }
46 return false;
47 }
$token
Definition: xapitoken.php:70

References $token.

◆ getLockObjectWithObjIdFromDB()

ilWebDAVLocksRepository::getLockObjectWithObjIdFromDB ( int  $obj_id)

Definition at line 74 of file class.ilWebDAVLocksRepository.php.

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

References $query.

◆ getLockObjectWithTokenFromDB()

ilWebDAVLocksRepository::getLockObjectWithTokenFromDB ( string  $token)

Definition at line 49 of file class.ilWebDAVLocksRepository.php.

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

References $query, and $token.

◆ purgeExpiredLocksFromDB()

ilWebDAVLocksRepository::purgeExpiredLocksFromDB ( )

Definition at line 117 of file class.ilWebDAVLocksRepository.php.

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

◆ removeLockWithTokenFromDB()

ilWebDAVLocksRepository::removeLockWithTokenFromDB ( string  $token)

Definition at line 112 of file class.ilWebDAVLocksRepository.php.

112 : int
113 {
114 return $this->db->manipulate("DELETE FROM $this->lock_table WHERE token = " . $this->db->quote($token, "integer"));
115 }

References $token.

◆ saveLockToDB()

ilWebDAVLocksRepository::saveLockToDB ( ilWebDAVLockObject  $ilias_lock)

Definition at line 98 of file class.ilWebDAVLocksRepository.php.

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

References ilWebDAVLockObject\getDavOwner(), ilWebDAVLockObject\getDepth(), ilWebDAVLockObject\getExpires(), ilWebDAVLockObject\getIliasOwner(), ilWebDAVLockObject\getObjId(), ilWebDAVLockObject\getScope(), ilWebDAVLockObject\getToken(), and ilWebDAVLockObject\getType().

+ Here is the call graph for this function:

◆ updateLocks()

ilWebDAVLocksRepository::updateLocks ( int  $old_obj_id,
int  $new_obj_id 
)

Definition at line 122 of file class.ilWebDAVLocksRepository.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

◆ $db

ilDBInterface ilWebDAVLocksRepository::$db
protected

Definition at line 27 of file class.ilWebDAVLocksRepository.php.

Referenced by __construct().

◆ $lock_table

string ilWebDAVLocksRepository::$lock_table = 'dav_lock'
private

Definition at line 29 of file class.ilWebDAVLocksRepository.php.


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