ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDiskQuotaChecker.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
34 {
35  function __construct()
36  {
37  }
38 
70  public static function _lookupDiskQuota($a_user_id)
71  {
72  $info = array();
73 
74  global $DIC;
75  $ilDB = $DIC['ilDB'];
76 
77  $res = $ilDB->queryf("SELECT keyword, value ".
78  "FROM usr_pref ".
79  "WHERE usr_id = %s ".
80  "AND keyword IN ('disk_quota', 'disk_quota_last_reminder')",
81  array('integer'),
82  array($a_user_id));
83 
84  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
85  switch ($row->keyword)
86  {
87  case 'disk_quota' :
88  $info['user_disk_quota'] = $row->value;
89  break;
90  case 'disk_quota_last_reminder' :
91  $info['last_reminder'] = $row->value;
92  break;
93  }
94  }
95 
96 
97  // Note: we order by role_id ASC here, in the assumption that
98  // the system role has the lowest ID of all roles.
99  // this way, if a user has the system role, this role
100  // will always returned first.
101  $ilDB->setLimit(1);
102  $res = $ilDB->queryf("SELECT rd.role_id, rd.disk_quota, od.title ".
103  "FROM rbac_ua ua ".
104  "JOIN rbac_fa fa ON fa.rol_id=ua.rol_id AND fa.parent = %s ".
105  "JOIN role_data rd ON ua.rol_id=rd.role_id ".
106  "JOIN object_data od ON od.obj_id=rd.role_id ".
107  "WHERE ua.usr_id = %s ".
108  "ORDER BY disk_quota DESC, role_id ASC",
109  array('integer','integer'),
110  array(ROLE_FOLDER_ID, $a_user_id));
111 
113  $info['role_id'] = $row->role_id;
114  $info['role_title'] = $row->title;
115 
116  // Note: Users with the system role have an infinite disk quota
117  // We calculate positive infinity by negating the logarithm of 0.
118  $info['role_disk_quota'] = ($row->role_id == SYSTEM_ROLE_ID) ? -log(0) : $row->disk_quota;
119  $info['disk_quota'] = max($info['user_disk_quota'], $info['role_disk_quota']);
120 
121  return $info;
122  }
123 
141  public static function _lookupDiskUsage($a_user_id)
142  {
143  $info = array();
144  $details = array();
145 
146  global $DIC;
147  $ilDB = $DIC['ilDB'];
148 
149  $res = $ilDB->query("SELECT keyword, value ".
150  "FROM usr_pref ".
151  "WHERE usr_id = ".$ilDB->quote($a_user_id, 'integer')." ".
152  "AND ".$ilDB->like("keyword", "text", 'disk\\_usage%')
153  );
154 
155  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
156  switch ($row->keyword)
157  {
158  case 'disk_usage.last_update' :
159  $info['last_update'] = $row->value;
160  break;
161 
162  case 'disk_usage' :
163  $info['disk_usage'] = $row->value;
164  break;
165 
166  default :
167  // The following preg_match is used to extract the type
168  // and the keys 'count' and 'size' from the keywords:
169  // disk_usage.type.count
170  // disk_usage.type.size
171  $matches = array();
172  preg_match('/^disk_usage\\.([^.]+)\\.([^.]+)/', $row->keyword, $matches);
173  $type = $matches[1];
174  $key = $matches[2];
175  if ($type)
176  {
177  $detail_data = $details[$type];
178  if ($detail_data == null)
179  {
180  $detail_data = array('type'=>$type);
181  }
182  $detail_data[$key] = $row->value;
183  }
184  $details[$type] = $detail_data;
185  break;
186  }
187  }
188  $info['details'] = $details;
189 
190 
191  //ilDiskQuotaChecker::_updateDiskUsageReport();
192 
193  return $info;
194  }
195 
221  public static function _fetchDiskQuotaReport($a_usage_filter = 3, $a_access_filter = 1, $a_order_column='disk_usage',$a_order_by='desc')
222  {
223  $data = array();
224  global $DIC;
225  $ilDB = $DIC['ilDB'];
226 
227  if (! $a_order_column) {
228  $a_order_column = 'disk_usage';
229  }
230 
231  switch ($a_usage_filter) {
232  case 1: // all users
233  $where_clause = '';
234  break;
235  case 2: // only users who don't use disk space
236  $where_clause = 'WHERE (p2.value IS NULL) ';
237  break;
238  case 3: // only users who use disk space
239  default:
240  $where_clause = 'WHERE (p2.value+0 > 0) ';
241  break;
242  case 4: // only users who have exceeded their disk quota
243  // #8554 / #10301
244  $where_clause = 'WHERE (((p1.value+0 > rq.role_disk_quota OR rq.role_disk_quota IS NULL) AND p2.value+0 > p1.value+0) OR
245  ((rq.role_disk_quota > p1.value+0 OR p1.value IS NULL) AND p2.value+0 > rq.role_disk_quota)) ';
246  break;
247  }
248  switch ($a_access_filter) {
249  case 1: // all users
250  $where_clause .= '';
251  break;
252  case 2: // only users who have access
253  default:
254  $where_clause .= ($where_clause == '' ? 'WHERE ' : ' AND ' ).
255  '(u.active=1 AND (u.time_limit_unlimited = 1 OR '.$ilDB->unixTimestamp().' BETWEEN u.time_limit_from AND u.time_limit_until)) ';
256  break;
257  case 3: // only users who don't have access
258  $where_clause .= ($where_clause == '' ? 'WHERE ' : ' AND ' ).
259  '(u.active=0 OR (u.time_limit_unlimited IS NULL AND '.$ilDB->unixTimestamp().' NOT BETWEEN u.time_limit_from AND u.time_limit_until)) ';
260  break;
261  }
262 
263  $res = $ilDB->queryf(
264  "SELECT u.usr_id,u.firstname,u.lastname,u.login,u.email,u.last_login,u.active,".
265  "u.time_limit_unlimited, ".$ilDB->fromUnixtime("u.time_limit_from").", ".$ilDB->fromUnixtime("u.time_limit_until").",".
266 
267  // Inactive users get the date 0001-01-01 so that they appear
268  // first when the list is sorted by this field. Users with
269  // unlimited access get the date 9999-12-31 so that they appear
270  // last.
271  "CASE WHEN u.active = 0 THEN '0001-01-01' ELSE CASE WHEN u.time_limit_unlimited=1 THEN '9999-12-31' ELSE ".$ilDB->fromUnixtime("u.time_limit_until")." END END access_until,".
272 
273  "CASE WHEN ".$ilDB->unixTimestamp()." BETWEEN u.time_limit_from AND u.time_limit_until THEN 0 ELSE 1 END expired,".
274  "rq.role_disk_quota, system_role.rol_id role_id, ".
275  "p1.value+0 user_disk_quota,".
276  "p2.value+0 disk_usage, ".
277  "p3.value last_update, ".
278  "p4.value last_reminder, ".
279 
280  // We add 0 to some of the values to convert them into a number.
281  // This is needed for correct sorting.
282  "CASE WHEN rq.role_disk_quota>p1.value+0 OR p1.value IS NULL THEN rq.role_disk_quota ELSE p1.value+0 END disk_quota ".
283  "FROM usr_data u ".
284 
285  // Fetch the role with the highest disk quota value.
286  "JOIN (SELECT u.usr_id usr_id,MAX(rd.disk_quota) role_disk_quota ".
287  "FROM usr_data u ".
288  "JOIN rbac_ua ua ON ua.usr_id=u.usr_id ".
289  "JOIN rbac_fa fa ON fa.rol_id=ua.rol_id AND fa.parent=%s ".
290  "JOIN role_data rd ON rd.role_id=ua.rol_id WHERE u.usr_id=ua.usr_id GROUP BY u.usr_id) rq ON rq.usr_id=u.usr_id ".
291 
292  // Fetch the system role in order to determine whether the user has unlimited disk quota
293  "LEFT JOIN rbac_ua system_role ON system_role.usr_id=u.usr_id AND system_role.rol_id = %s ".
294 
295  // Fetch the user disk quota from table usr_pref
296  "LEFT JOIN usr_pref p1 ON p1.usr_id=u.usr_id AND p1.keyword = 'disk_quota' ".
297 
298  // Fetch the disk usage from table usr_pref
299  "LEFT JOIN usr_pref p2 ON p2.usr_id=u.usr_id AND p2.keyword = 'disk_usage' ".
300 
301  // Fetch the last update from table usr_pref
302  "LEFT JOIN usr_pref p3 ON p3.usr_id=u.usr_id AND p3.keyword = 'disk_usage.last_update' ".
303 
304  // Fetch the date when the last disk quota reminder was sent from table usr_pref
305  "LEFT JOIN usr_pref p4 ON p4.usr_id=u.usr_id AND p4.keyword = 'disk_quota_last_reminder' ".
306 
307  $where_clause.
308  "ORDER BY ".$a_order_column." ".($a_order_by=='asc'?' ASC':' DESC').", ".
309  "lastname, firstname, login"
310  ,
311  array('integer','integer'),
312  array(ROLE_FOLDER_ID, SYSTEM_ROLE_ID)
313  );
314  $previous_usr_id = null;
315  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
316  if ($previous_usr_id != $row['usr_id'])
317  {
318  $data[] = $row;
319  $previous_usr_id = $row['usr_id'];
320  }
321  }
322  return $data;
323  }
324 
335  public static function _updateDiskUsageReport()
336  {
337  global $DIC;
338  $ilDB = $DIC['ilDB'];
339 
340  // delete old values
341  $ilDB->manipulate("DELETE FROM usr_pref ".
342  "WHERE ".$ilDB->like("keyword", "text", 'disk_usage%'));
343 
344 
345  require_once 'Modules/File/classes/class.ilObjFileAccess.php';
346  self::__updateDiskUsageReportOfType(new ilObjFileAccess(), 'file');
347 
348  require_once 'Modules/Forum/classes/class.ilObjForumAccess.php';
349  self::__updateDiskUsageReportOfType(new ilObjForumAccess(), 'frm');
350 
351  require_once 'Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php';
352  self::__updateDiskUsageReportOfType(new ilObjFileBasedLMAccess(), 'htlm');
353 
354  require_once 'Modules/MediaCast/classes/class.ilObjMediaCastAccess.php';
355  self::__updateDiskUsageReportOfType(new ilObjMediaCastAccess(), 'mcst');
356 
357  require_once 'Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php';
358  self::__updateDiskUsageReportOfType(new ilObjSAHSLearningModuleAccess(), 'sahs');
359 
360  require_once 'Services/Mail/classes/class.ilObjMailAccess.php';
361  self::__updateDiskUsageReportOfUsers(new ilObjMailAccess(), 'mail_attachment');
362 
363  // insert the sum of the disk usage of each user
364  // note: second % is needed to not fail on oracle char field
365  $ilDB->manipulate("INSERT INTO usr_pref ".
366  "(usr_id, keyword, value) ".
367  "SELECT usr_id, 'disk_usage', SUM(value) ".
368  "FROM usr_pref ".
369  "WHERE ".$ilDB->like("keyword", "text", 'disk_usage.%.size%').
370  "GROUP BY usr_id"
371  );
372 
373  // insert last update
374  $ilDB->manipulate("INSERT INTO usr_pref ".
375  "(usr_id, keyword, value) ".
376  "SELECT usr_id, 'disk_usage.last_update', ".$ilDB->now()." ".
377  "FROM usr_data");
378  }
379 
393  private static function __updateDiskUsageReportOfType($a_access_obj, $a_type)
394  {
395  $data = array();
396 
397  // repository
398  $res = self::__getRepositoryObjectsByType($a_type);
399  self::__updateDiskUsageReportOfTypeHelper($a_access_obj, $res, $data);
400 
401  // personal workspace
402  $res = self::__getWorkspaceObjectsByType($a_type);
403  self::__updateDiskUsageReportOfTypeHelper($a_access_obj, $res, $data);
404 
405  // saving result to DB
406  if($data)
407  {
408  foreach($data as $owner => $item)
409  {
410  self::__saveUserData($owner, $a_type, $item["size"], $item["count"]);
411  }
412  }
413  }
414 
423  private static function __saveUserData($a_user_id, $a_type, $a_size, $a_count)
424  {
425  global $DIC;
426  $ilDB = $DIC['ilDB'];
427 
428  if ($a_user_id && $a_size != null && $a_count != null)
429  {
430  $ilDB->manipulate("INSERT INTO usr_pref ".
431  "(usr_id, keyword, value) ".
432  "VALUES ".
433  "(".$ilDB->quote($a_user_id,'integer').", ".
434  $ilDB->quote('disk_usage.'.$a_type.'.size').", ".
435  $ilDB->quote($a_size, 'integer').")");
436 
437  $ilDB->manipulate("INSERT INTO usr_pref ".
438  "(usr_id, keyword, value) ".
439  "VALUES ".
440  "(".$ilDB->quote($a_user_id,'integer').", ".
441  $ilDB->quote('disk_usage.'.$a_type.'.count').", ".
442  $ilDB->quote($a_count, 'integer').")"
443  );
444  }
445  }
446 
455  private static function __updateDiskUsageReportOfTypeHelper($a_access_obj, $a_objects, &$a_result)
456  {
457  $count = null;
458  $size = null;
459  $owner = null;
460  while ($row = $a_objects->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
461  if ($row->owner != $owner) {
462  if ($owner != null) {
463  $a_result[$owner]["size"] += $size;
464  $a_result[$owner]["count"] += $count;
465  }
466  $owner = $row->owner;
467  $size = 0;
468  $count = 0;
469  }
470  $size += $a_access_obj->_lookupDiskUsage($row->obj_id);
471  $count++;
472  }
473 
474  // add last set data
475  if ($owner != null) {
476  $a_result[$owner]["size"] += $size;
477  $a_result[$owner]["count"] += $count;
478  }
479  }
480 
488  private static function __getRepositoryObjectsByType($a_type)
489  {
490  global $DIC;
491  $ilDB = $DIC['ilDB'];
492 
493  return $ilDB->query("SELECT DISTINCT d.obj_id, d.owner ".
494  "FROM object_data d ".
495  "JOIN object_reference r ON d.obj_id=r.obj_id ".
496  "JOIN tree t ON t.child=r.ref_id ".
497  "WHERE d.type = ".$ilDB->quote($a_type, "text")." ".
498  "AND t.tree=1 ".
499  "ORDER BY d.owner"
500  );
501  }
502 
510  private static function __getWorkspaceObjectsByType($a_type)
511  {
512  global $DIC;
513  $ilDB = $DIC['ilDB'];
514 
515  return $ilDB->query("SELECT DISTINCT d.obj_id, d.owner ".
516  "FROM object_data d ".
517  "JOIN object_reference_ws r ON d.obj_id=r.obj_id ".
518  "JOIN tree_workspace t ON t.child=r.wsp_id ".
519  "WHERE d.type = ".$ilDB->quote($a_type, "text")." ".
520  "AND t.tree=d.owner ".
521  "ORDER BY d.owner"
522  );
523  }
524 
538  private static function __updateDiskUsageReportOfUsers($a_access_obj, $a_type)
539  {
540  global $DIC;
541  $ilDB = $DIC['ilDB'];
542 
543  // get all users
544  $res = $ilDB->query("SELECT usr_id FROM usr_data");
545 
546  // for each user count the number of objects and sum up the size
547  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
548  $data = $a_access_obj->_lookupDiskUsageOfUser($row->usr_id);
549  self::__saveUserData($row->usr_id, $a_type, $data["size"], $data["count"]);
550  }
551  }
552 
553  public static function _sendSummaryMails()
554  {
555  global $DIC;
556  $ilSetting = $DIC['ilSetting'];
557 
558  $lastStart = $ilSetting->get('last_cronjob_disk_quota_sum_start_ts', 0);
559  if( !$lastStart || date('dmY', $lastStart) != date('dmY') )
560  {
561  $ilSetting->set('last_cronjob_disk_quota_sum_start_ts', time());
562 
563  include_once 'Services/Mail/classes/class.ilDiskQuotaSummaryNotification.php';
564  $dqsn = new ilDiskQuotaSummaryNotification();
565  $dqsn->send();
566  }
567  }
568 
574  public static function _sendReminderMails()
575  {
576  global $DIC;
577  $ilDB = $DIC['ilDB'];
578 
579  require_once 'Services/Mail/classes/class.ilDiskQuotaReminderMail.php';
580  $mail = new ilDiskQuotaReminderMail();
581 
582  $res = $ilDB->queryf(
583  "SELECT u.usr_id,u.gender,u.firstname,u.lastname,u.login,u.email,u.last_login,u.active,".
584  "u.time_limit_unlimited, ".$ilDB->fromUnixtime("u.time_limit_from").", ".$ilDB->fromUnixtime("u.time_limit_until").",".
585 
586  // Inactive users get the date 0001-01-01 so that they appear
587  // first when the list is sorted by this field. Users with
588  // unlimited access get the date 9999-12-31 so that they appear
589  // last.
590  "CASE WHEN u.active = 0 THEN '0001-01-01' ELSE CASE WHEN u.time_limit_unlimited=1 THEN '9999-12-31' ELSE ".$ilDB->fromUnixtime("u.time_limit_until")." END END access_until,".
591 
592  " CASE WHEN ".$ilDB->unixTimestamp()." BETWEEN u.time_limit_from AND u.time_limit_until THEN 0 ELSE 1 END expired,".
593  "rq.role_disk_quota, system_role.rol_id role_id, ".
594  "p1.value+0 user_disk_quota,".
595  "p2.value+0 disk_usage, ".
596  "p3.value last_update, ".
597  "p4.value last_reminder, ".
598  "p5.value language, ".
599 
600  // We add 0 to some of the values to convert them into a number.
601  // This is needed for correct sorting.
602  "CASE WHEN rq.role_disk_quota>p1.value+0 OR p1.value IS NULL THEN rq.role_disk_quota ELSE p1.value+0 END disk_quota ".
603  "FROM usr_data u ".
604 
605  // Fetch the role with the highest disk quota value.
606  "JOIN (SELECT u.usr_id usr_id,MAX(rd.disk_quota) role_disk_quota ".
607  "FROM usr_data u ".
608  "JOIN rbac_ua ua ON ua.usr_id=u.usr_id ".
609  "JOIN rbac_fa fa ON fa.rol_id=ua.rol_id AND fa.parent=%s ".
610  "JOIN role_data rd ON rd.role_id=ua.rol_id WHERE u.usr_id=ua.usr_id GROUP BY u.usr_id) rq ON rq.usr_id=u.usr_id ".
611 
612  // Fetch the system role in order to determine whether the user has unlimited disk quota
613  "LEFT JOIN rbac_ua system_role ON system_role.usr_id=u.usr_id AND system_role.rol_id = %s ".
614 
615  // Fetch the user disk quota from table usr_pref
616  "LEFT JOIN usr_pref p1 ON p1.usr_id=u.usr_id AND p1.keyword = 'disk_quota' ".
617 
618  // Fetch the disk usage from table usr_pref
619  "LEFT JOIN usr_pref p2 ON p2.usr_id=u.usr_id AND p2.keyword = 'disk_usage' ".
620 
621  // Fetch the last update from table usr_pref
622  "LEFT JOIN usr_pref p3 ON p3.usr_id=u.usr_id AND p3.keyword = 'disk_usage.last_update' ".
623 
624  // Fetch the date when the last disk quota reminder was sent from table usr_pref
625  "LEFT JOIN usr_pref p4 ON p4.usr_id=u.usr_id AND p4.keyword = 'disk_quota_last_reminder' ".
626 
627  // Fetch the language of the user
628  "LEFT JOIN usr_pref p5 ON p5.usr_id=u.usr_id AND p5.keyword = 'language' ".
629 
630  // Fetch only users who have exceeded their quota, and who have
631  // access, and who have not received a reminder in the past seven days
632  // #8554 / #10301
633  'WHERE (((p1.value+0 >= rq.role_disk_quota OR rq.role_disk_quota IS NULL) AND p2.value+0 > p1.value+0) OR
634  ((rq.role_disk_quota > p1.value+0 OR p1.value IS NULL) AND p2.value+0 > rq.role_disk_quota)) '.
635  'AND (u.active=1 AND (u.time_limit_unlimited = 1 OR '.$ilDB->unixTimestamp().' BETWEEN u.time_limit_from AND u.time_limit_until)) '.
636  'AND (p4.value IS NULL OR p4.value < DATE_SUB(NOW(), INTERVAL 7 DAY)) '
637 
638  ,
639  array('integer','integer'),
640  array(ROLE_FOLDER_ID, SYSTEM_ROLE_ID)
641  );
642 
643  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
644  $details = self::_lookupDiskUsage($row['usr_id']);
645  $row['disk_usage_details'] = $details['details'];
646 
647  // Send reminder e-mail
648  $mail->setData($row);
649  $mail->send();
650 
651  // Store the date the last reminder was sent in the table usr_pref.
652  if ($row['last_reminder'] != null)
653  {
654  $ilDB->manipulatef("UPDATE usr_pref SET value= ".$ilDB->now()." ".
655  "WHERE usr_id=%s AND keyword = 'disk_quota_last_reminder'"
656  ,
657  array('integer'),
658  array($row['usr_id'])
659  );
660  }
661  else
662  {
663  $ilDB->manipulatef("INSERT INTO usr_pref (usr_id, keyword, value) ".
664  "VALUES (%s, 'disk_quota_last_reminder', ".$ilDB->now().")"
665  ,
666  array('integer'),
667  array($row['usr_id'])
668  );
669  }
670  }
671  }
672 
677  public static function _lookupDiskUsageReportLastUpdate()
678  {
679  global $DIC;
680  $ilDB = $DIC['ilDB'];
681 
682  require_once 'Services/Mail/classes/class.ilDiskQuotaReminderMail.php';
683  $mail = new ilDiskQuotaReminderMail();
684 
685  $res = $ilDB->query("SELECT MAX(value) last_update ".
686  "FROM usr_pref WHERE keyword='disk_usage.last_update'");
688  return ($row != null) ? $row['last_update'] : null;
689  }
690 
691  public static function _lookupPersonalWorkspaceDiskQuota($a_user_id)
692  {
693  global $DIC;
694  $ilDB = $DIC['ilDB'];
695 
696  $info = array();
697 
698  $res = $ilDB->queryf("SELECT keyword, value ".
699  "FROM usr_pref ".
700  "WHERE usr_id = %s ".
701  "AND keyword = %s ",
702  array('integer', 'text'),
703  array($a_user_id, "wsp_disk_quota"));
704 
706  $info['user_wsp_disk_quota'] = $row->value;
707 
708 
709  // Note: we order by role_id ASC here, in the assumption that
710  // the system role has the lowest ID of all roles.
711  // this way, if a user has the system role, this role
712  // will always returned first.
713  $ilDB->setLimit(1);
714  $res = $ilDB->queryf("SELECT rd.role_id, rd.wsp_disk_quota, od.title ".
715  "FROM rbac_ua ua ".
716  "JOIN rbac_fa fa ON fa.rol_id=ua.rol_id AND fa.parent = %s ".
717  "JOIN role_data rd ON ua.rol_id=rd.role_id ".
718  "JOIN object_data od ON od.obj_id=rd.role_id ".
719  "WHERE ua.usr_id = %s ".
720  "ORDER BY wsp_disk_quota DESC, role_id ASC",
721  array('integer','integer'),
722  array(ROLE_FOLDER_ID, $a_user_id));
723 
725  $info['role_id'] = $row->role_id;
726  $info['role_title'] = $row->title;
727 
728  // Note: Users with the system role have an infinite disk quota
729  // We calculate positive infinity by negating the logarithm of 0.
730  $info['role_wsp_disk_quota'] = ($row->role_id == SYSTEM_ROLE_ID) ? -log(0) : $row->wsp_disk_quota;
731  $info['disk_quota'] = max($info['user_wsp_disk_quota'], $info['role_wsp_disk_quota']);
732 
733  return $info;
734  }
735 }
736 ?>
$size
Definition: RandomTest.php:79
static _sendReminderMails()
Sends reminder e-mails to all users who have access and who have exceeded their disk quota and who ha...
Class ilDiskQuotaChecker.
static _lookupPersonalWorkspaceDiskQuota($a_user_id)
Access class for file objects.
Class ilObjMediaCastAccess.
static _updateDiskUsageReport()
Updates the disk usage info of all user accounts.
static __updateDiskUsageReportOfType($a_access_obj, $a_type)
Updates the disk usage report of the specified object type for all user accounts. ...
Class ilObjForumAccess.
static __updateDiskUsageReportOfTypeHelper($a_access_obj, $a_objects, &$a_result)
for each objects of an owner, count the number of objects and sum up the size
static __getWorkspaceObjectsByType($a_type)
get all objects of the desired type which are in the personal workspace ordered by owner ...
$a_type
Definition: workflow.php:93
static _lookupDiskUsageReportLastUpdate()
Returns the SQL datetime of the last update of the disk usage report.
$info
Definition: example_052.php:80
static __updateDiskUsageReportOfUsers($a_access_obj, $a_type)
Updates the disk usage report of the specified object type for all user accounts. ...
Class ilFileBasedLMAccess.
static _lookupDiskQuota($a_user_id)
Gets the disk quota info for the specified user account.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Class ilObjMailAccess.
static __saveUserData($a_user_id, $a_type, $a_size, $a_count)
Save disk quota for user.
Create styles array
The data for the language used.
static _lookupDiskUsage($a_user_id)
Gets the disk usage info for the specified user account.
Class ilDiskQuotaReminderMail.
global $ilSetting
Definition: privfeed.php:17
global $ilDB
global $DIC
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static __getRepositoryObjectsByType($a_type)
get all objects of the desired type which are in the repository ordered by owner ...
static _fetchDiskQuotaReport($a_usage_filter=3, $a_access_filter=1, $a_order_column='disk_usage', $a_order_by='desc')
Reads disk quota/disk usage report of the user accounts.