19 declare(strict_types=1);
36 private \ILIAS\DI\Container
$dic;
48 $this->db = $this->dic->database();
55 return self::$instance ?? self::$instance =
new self();
61 $where = $this->db->quote($userId,
'integer');
62 $result = $this->db->query(
"SELECT obj_id FROM " . self::DB_USERS_TABLE_NAME .
" WHERE usr_id = " . $where);
63 while($row = $this->db->fetchAssoc($result)) {
67 $data[] = $row[
'obj_id'];
75 'usr_id' => [
'integer', $userId],
76 'added' => [
'timestamp', date(
'Y-m-d H:i:s')]
78 $this->db->insert(self::DB_DEL_USERS, $values);
84 $this->db->update(self::DB_DEL_USERS, [
85 'updated' => [
'timestamp', date(
'Y-m-d H:i:s')]
87 'usr_id' => [
'integer', $usrId]
93 $this->db->update(self::DB_DEL_USERS, [
94 'updated' => [
'timestamp',
null]
96 'usr_id' => [
'integer', $usrId]
105 $result = $this->db->query(
"SELECT obj.obj_id, obj.lrs_type_id, obj.activity_id, usr.usr_id, usr.usr_ident, del.added FROM " .
106 self::DB_TABLE_NAME .
" obj, " .
107 self::DB_USERS_TABLE_NAME .
" usr, " .
108 self::DB_DEL_USERS .
" del " .
109 #
" INNER JOIN " . self::DB_DEL_USERS .
" del ON usr.usr_id = xdel.usr_id" .
110 " WHERE usr.usr_id = del.usr_id AND obj.obj_id = usr.obj_id AND del.updated IS NULL");
111 while($row = $this->db->fetchAssoc($result)) {
123 $result = $this->db->query(
"SELECT obj.obj_id, obj.lrs_type_id, obj.activity_id FROM " .
124 self::DB_TABLE_NAME .
" obj, " .
125 self::DB_USERS_TABLE_NAME .
" usr" .
126 #
" INNER JOIN " . self::DB_DEL_USERS .
" del ON usr.usr_id = xdel.usr_id" .
127 " WHERE usr.usr_id = " . $this->db->quote($userId,
'integer') .
" AND obj.obj_id = usr.obj_id");
128 while($row = $this->db->fetchAssoc($result)) {
141 $result = $this->db->query(
"SELECT * FROM " . self::DB_DEL_USERS .
" WHERE updated IS NULL");
142 while($row = $this->db->fetchAssoc($result)) {
150 $this->db->manipulateF(
151 'DELETE FROM ' . self::DB_DEL_USERS .
' WHERE usr_id = %s',
162 $where = $this->db->quote($objId,
'integer');
163 $result = $this->db->query(
"SELECT lrs_type_id, activity_id, delete_data FROM " . self::DB_TABLE_NAME .
" WHERE obj_id = " . $where);
164 while($row = $this->db->fetchAssoc($result)) {
174 $result = $this->db->query(
"SELECT * FROM " . self::DB_DEL_OBJ .
" WHERE 1");
175 while($row = $this->db->fetchAssoc($result)) {
185 $result = $this->db->query(
"SELECT * FROM " . self::DB_DEL_OBJ .
" WHERE updated IS NULL");
186 while($row = $this->db->fetchAssoc($result)) {
194 $this->db->manipulateF(
195 'DELETE FROM ' . self::DB_DEL_OBJ .
' WHERE obj_id = %s',
204 'obj_id' => [
'integer',
$objId],
205 'type_id' => [
'integer',
$typeId],
206 'activity_id' => [
'string', $actId],
207 'added' => [
'timestamp', date(
'Y-m-d H:i:s')]
209 $this->db->insert(self::DB_DEL_OBJ, $values);
211 if(!$this->dic->cron()->manager()->isJobActive(
'xapi_deletion_cron')) {
213 $xapiDelete->delete();
220 $this->db->update(self::DB_DEL_OBJ, [
221 'updated' => [
'timestamp', date(
'Y-m-d H:i:s')]
223 'obj_id' => [
'integer', $objId]
230 $this->db->update(self::DB_DEL_OBJ, [
231 'updated' => [
'timestamp',
null]
233 'obj_id' => [
'integer', $objId]
239 $this->db->manipulateF(
240 'DELETE FROM cmix_users WHERE obj_id = %s',
244 $this->log->debug(
'cmix_users deleted for objId=' . (
string) $objId);
setUserAsUpdated(int $usrId)
resetUpdatedXapiUser(int $usrId)
setXapiObjAsDeleted(int $objId, int $typeId, string $actId)
static getLogger(string $a_component_id)
Get component logger.
getXapiObjectData(int $objId)
getXapiObjectsByUser(int $userId)
setXapiUserAsDeleted(int $userId)
getNewDeletedXapiObjects()
Class ilCmiXapiStatementsDeleteRequest.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
deleteXapiObjectEntry($objId)
setXapiObjAsUpdated(int $objId)
const DB_USERS_TABLE_NAME
getAllXapiDelObjectData()
resetUpdatedXapiObj(int $objId)
static ilCmiXapiDelModel $instance
getXapiObjectsByDeletedUsers()
getXapiObjIdForUser(int $userId)
removeCmixUsersForObject(int $objId)