4include_once 
"Services/Cron/classes/class.ilCronJob.php";
 
   38        $this->lng = 
$DIC->language();
 
   50        return "pwsp_recalc_quota";
 
   60        return $lng->txt(
"pwsp_recalculate_disk_quota");
 
   70        return $lng->txt(
"pwsp_recalculate_disk_quota_desc");
 
  125        $result->setStatus($this->job_status);
 
  140        $ilDB->manipulate(
"DELETE FROM il_disk_quota" .
 
  141            " WHERE src_type = " . 
$ilDB->quote(
"file", 
"text"));
 
  143        $quota_done = array();
 
  146        $set = 
$ilDB->query(
"SELECT od.owner, od.obj_id" .
 
  147            " FROM object_data od" .
 
  148            " JOIN object_reference_ws ref ON (ref.obj_id = od.obj_id)" .
 
  149            " JOIN tree_workspace t ON (t.child = ref.wsp_id)" .
 
  150            " WHERE od.type = " . 
$ilDB->quote(
"file", 
"text") .
 
  151            " AND t.tree = od.owner");
 
  152        while ($row = 
$ilDB->fetchAssoc($set)) {
 
  153            $id = $row[
"owner"] . 
"-" . $row[
"obj_id"];
 
  154            if (!in_array($id, $quota_done)) {
 
  161        $set = 
$ilDB->query(
"SELECT od.owner, fu.id" .
 
  162            " FROM object_data od" .
 
  163            " JOIN object_reference_ws ref ON (ref.obj_id = od.obj_id)" .
 
  164            " JOIN tree_workspace t ON (t.child = ref.wsp_id)" .
 
  165            " JOIN il_blog_posting blp ON (blp.blog_id = od.obj_id)" .
 
  166            " JOIN file_usage fu ON (fu.usage_id = blp.id)" .
 
  167            " WHERE fu.usage_type = " . 
$ilDB->quote(
"blp:pg", 
"text") .
 
  168            " AND fu.usage_hist_nr = " . 
$ilDB->quote(0, 
"integer"));
 
  169        while ($row = 
$ilDB->fetchAssoc($set)) {
 
  170            $id = $row[
"owner"] . 
"-" . $row[
"id"];
 
  171            if (!in_array($id, $quota_done)) {
 
  178        $set = 
$ilDB->query($q = 
"SELECT od.owner, fu.id" .
 
  179            " FROM object_data od" .
 
  180            " JOIN usr_portfolio_page prtf ON (prtf.portfolio_id = od.obj_id)" .
 
  181            " JOIN file_usage fu ON (fu.usage_id = prtf.id)" .
 
  182            " WHERE fu.usage_type = " . 
$ilDB->quote(
"prtf:pg", 
"text") .
 
  183            " AND fu.usage_hist_nr = " . 
$ilDB->quote(0, 
"integer"));
 
  185        while ($row = 
$ilDB->fetchAssoc($set)) {
 
  186            $id = $row[
"owner"] . 
"-" . $row[
"id"];
 
  187            if (!in_array($id, $quota_done)) {
 
  198        $ilDB->manipulate(
"DELETE FROM il_disk_quota" .
 
  199            " WHERE src_type = " . 
$ilDB->quote(
"mob", 
"text"));
 
  201        $quota_done = array();
 
  204        $set = 
$ilDB->query(
"SELECT od.owner, mu.id" .
 
  205            " FROM object_data od" .
 
  206            " JOIN object_reference_ws ref ON (ref.obj_id = od.obj_id)" .
 
  207            " JOIN tree_workspace t ON (t.child = ref.wsp_id)" .
 
  208            " JOIN il_blog_posting blp ON (blp.blog_id = od.obj_id)" .
 
  209            " JOIN mob_usage mu ON (mu.usage_id = blp.id)" .
 
  210            " WHERE mu.usage_type = " . 
$ilDB->quote(
"blp:pg", 
"text") .
 
  211            " AND mu.usage_hist_nr = " . 
$ilDB->quote(0, 
"integer"));
 
  212        while ($row = 
$ilDB->fetchAssoc($set)) {
 
  213            $id = $row[
"owner"] . 
"-" . $row[
"id"];
 
  214            if (!in_array($id, $quota_done)) {
 
  221        $set = 
$ilDB->query(
"SELECT od.owner, mu.id" .
 
  222            " FROM object_data od" .
 
  223            " JOIN usr_portfolio_page prtf ON (prtf.portfolio_id = od.obj_id)" .
 
  224            " JOIN mob_usage mu ON (mu.usage_id = prtf.id)" .
 
  225            " WHERE mu.usage_type = " . 
$ilDB->quote(
"prtf:pg", 
"text") .
 
  226            " AND mu.usage_hist_nr = " . 
$ilDB->quote(0, 
"integer"));
 
  227        while ($row = 
$ilDB->fetchAssoc($set)) {
 
  228            $id = $row[
"owner"] . 
"-" . $row[
"id"];
 
  229            if (!in_array($id, $quota_done)) {
 
  239        $ilDB->manipulate(
"DELETE FROM il_disk_quota" .
 
  240            " WHERE src_type = " . 
$ilDB->quote(
"prtf", 
"text"));
 
  241        $ilDB->manipulate(
"DELETE FROM il_disk_quota" .
 
  242            " WHERE src_type = " . 
$ilDB->quote(
"blog", 
"text"));
 
  245        $set = 
$ilDB->query(
"SELECT od.owner, od.obj_id" .
 
  246            " FROM object_data od" .
 
  247            " JOIN usr_portfolio prtf ON (prtf.id = od.obj_id)" .
 
  248            " WHERE od.type = " . 
$ilDB->quote(
"prtf", 
"text") .
 
  249            " AND prtf.img IS NOT NULL");
 
  250        while ($row = 
$ilDB->fetchAssoc($set)) {
 
  255        $set = 
$ilDB->query(
"SELECT od.owner, od.obj_id" .
 
  256            " FROM object_data od" .
 
  257            " JOIN object_reference_ws ref ON (ref.obj_id = od.obj_id)" .
 
  258            " JOIN tree_workspace t ON (t.child = ref.wsp_id)" .
 
  259            " JOIN il_blog blog ON (blog.id = od.obj_id)" .
 
  260            " WHERE od.type = " . 
$ilDB->quote(
"blog", 
"text") .
 
  261            " AND blog.img IS NOT NULL" .
 
  262            " AND t.tree = od.owner");
 
  263        while ($row = 
$ilDB->fetchAssoc($set)) {
 
  273        $ilDB->manipulate(
"DELETE FROM il_disk_quota" .
 
  274            " WHERE src_type = " . 
$ilDB->quote(
"tstv", 
"text"));
 
  275        $ilDB->manipulate(
"DELETE FROM il_disk_quota" .
 
  276            " WHERE src_type = " . 
$ilDB->quote(
"excv", 
"text"));
 
  279        $set = 
$ilDB->query(
"SELECT od.owner, od.obj_id, od.type" .
 
  280            " FROM object_data od" .
 
  281            " JOIN object_reference_ws ref ON (ref.obj_id = od.obj_id)" .
 
  282            " JOIN tree_workspace t ON (t.child = ref.wsp_id)" .
 
  283            " WHERE " . 
$ilDB->in(
"od.type", array(
"tstv", 
"excv"), 
"", 
"text") .
 
  284            " AND t.tree = od.owner");
 
  285        while ($row = 
$ilDB->fetchAssoc($set)) {
 
  302        for (
$i = 3; 
$i > 0; 
$i--) {
 
  303            $factor = pow(100, 
$i);
 
  304            if (($tmp = (
int) ($tnum / $factor)) or $tfound) {
 
  306                $tnum = $tnum % $factor;
 
  313            $file_path .= (implode(
'/', $tpath) . 
'/');
 
  315        $file_path .= 
"file_" . $a_obj_id;
 
  316        if (file_exists($file_path)) {
 
  318            if ($file_size > 0) {
 
  319                $ilDB->manipulate(
"INSERT INTO il_disk_quota" .
 
  320                    " (owner_id, src_type, src_obj_id, src_size)" .
 
  321                    " VALUES (" . 
$ilDB->quote($a_owner_id, 
"integer") .
 
  322                    ", " . 
$ilDB->quote(
"file", 
"text") .
 
  323                    ", " . 
$ilDB->quote($a_obj_id, 
"integer") .
 
  324                    ", " . 
$ilDB->quote($file_size, 
"integer") . 
")");
 
  337        $file_path = CLIENT_WEB_DIR . 
"/mobs/mm_" . $a_obj_id;
 
  338        if (file_exists($file_path)) {
 
  340            if ($file_size > 0) {
 
  341                $ilDB->manipulate(
"INSERT INTO il_disk_quota" .
 
  342                    " (owner_id, src_type, src_obj_id, src_size)" .
 
  343                    " VALUES (" . 
$ilDB->quote($a_owner_id, 
"integer") .
 
  344                    ", " . 
$ilDB->quote(
"mob", 
"text") .
 
  345                    ", " . 
$ilDB->quote($a_obj_id, 
"integer") .
 
  346                    ", " . 
$ilDB->quote($file_size, 
"integer") . 
")");
 
  365        for (
$i = 3; 
$i > 0; 
$i--) {
 
  366            $factor = pow(100, 
$i);
 
  367            if (($tmp = (
int) ($tnum / $factor)) or $tfound) {
 
  369                $tnum = $tnum % $factor;
 
  374        $file_path = CLIENT_WEB_DIR . 
"/" . $a_dir . 
"/";
 
  376            $file_path .= (implode(
'/', $tpath) . 
'/');
 
  378        $file_path .= 
$a_type . 
"_" . $a_obj_id;
 
  380        if (file_exists($file_path)) {
 
  382            if ($file_size > 0) {
 
  383                $ilDB->manipulate(
"INSERT INTO il_disk_quota" .
 
  384                    " (owner_id, src_type, src_obj_id, src_size)" .
 
  385                    " VALUES (" . 
$ilDB->quote($a_owner_id, 
"integer") .
 
  387                    ", " . 
$ilDB->quote($a_obj_id, 
"integer") .
 
  388                    ", " . 
$ilDB->quote($file_size, 
"integer") . 
")");
 
  406        for (
$i = 3; 
$i > 0;
$i--) {
 
  407            $factor = pow(100, 
$i);
 
  408            if (($tmp = (
int) ($tnum / $factor)) or $tfound) {
 
  410                $tnum = $tnum % $factor;
 
  417            $file_path .= (implode(
'/', $tpath) . 
'/');
 
  419        $file_path .= 
"vrfc_" . $a_obj_id;
 
  420        if (file_exists($file_path)) {
 
  422            if ($file_size > 0) {
 
  423                $ilDB->manipulate(
"INSERT INTO il_disk_quota" .
 
  424                    " (owner_id, src_type, src_obj_id, src_size)" .
 
  425                    " VALUES (" . 
$ilDB->quote($a_owner_id, 
"integer") .
 
  427                    ", " . 
$ilDB->quote($a_obj_id, 
"integer") .
 
  428                    ", " . 
$ilDB->quote($file_size, 
"integer") . 
")");
 
An exception for terminatinating execution or to throw for unit testing.
Cron job result data container.
Cron job application base class.
const SCHEDULE_TYPE_DAILY
getDefaultScheduleType()
Get schedule type.int
getTitle()
Get title.string
recalculate()
Recalculate.
hasCustomSettings()
Has cron job any custom setting which can be edited?boolean
getDefaultScheduleValue()
Get schedule value.int|array
run()
Run job.ilCronJobResult
hasFlexibleSchedule()
Can the schedule be configured?boolean
quotaHandleVerification($a_type, $a_obj_id, $a_owner_id)
quotaHandleFileStorage($a_type, $a_obj_id, $a_owner_id, $a_dir)
hasAutoActivation()
Is to be activated on "installation".boolean
quotaHandleFile($a_obj_id, $a_owner_id)
getDescription()
Get description.string
quotaHandleMob($a_obj_id, $a_owner_id)
__construct()
Constructor.
static getDataDir()
get data directory (outside webspace)
static dirsize($directory)
get size of a directory or a file.