Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 16... Línea 16...
16
 
16
 
Línea 17... Línea 17...
17
declare(strict_types=1);
17
declare(strict_types=1);
Línea 18... Línea 18...
18
 
18
 
19
namespace core_reportbuilder\task;
19
namespace core_reportbuilder\task;
-
 
20
 
20
 
21
use core\{clock, di};
21
use core_user;
22
use core\task\adhoc_task;
22
use core\task\adhoc_task;
23
use core_user;
Línea 23... Línea 24...
23
use core_reportbuilder\local\helpers\schedule as helper;
24
use core_reportbuilder\local\helpers\{report, schedule as helper};
24
use core_reportbuilder\local\models\schedule;
25
use core_reportbuilder\local\models\schedule;
Línea 106... Línea 107...
106
                \core\cron::setup_user($scheduleviewas);
107
                \core\cron::setup_user($scheduleviewas);
107
                $scheduleattachment = helper::get_schedule_report_file($schedule);
108
                $scheduleattachment = helper::get_schedule_report_file($schedule);
108
            }
109
            }
Línea 109... Línea 110...
109
 
110
 
110
            // Apply special handling if report is empty (default is to send it anyway).
111
            // Apply special handling if report is empty (default is to send it anyway).
111
            if ($schedulereportempty === schedule::REPORT_EMPTY_DONT_SEND &&
112
            if ($schedulereportempty === schedule::REPORT_EMPTY_DONT_SEND && $scheduleattachment !== null &&
Línea 112... Línea 113...
112
                    $scheduleattachment !== null && helper::get_schedule_report_count($schedule) === 0) {
113
                    report::get_report_row_count($schedule->get('reportid')) === 0) {
113
 
114
 
Línea 114... Línea 115...
114
                $this->log('Empty report, skipping');
115
                $this->log('Empty report, skipping');
Línea 123... Línea 124...
123
                        helper::send_schedule_message($schedule, $user, $scheduleattachment);
124
                        helper::send_schedule_message($schedule, $user, $scheduleattachment);
124
                    } else {
125
                    } else {
125
                        \core\cron::setup_user($user);
126
                        \core\cron::setup_user($user);
Línea 126... Línea 127...
126
 
127
 
127
                        if ($schedulereportempty === schedule::REPORT_EMPTY_DONT_SEND &&
128
                        if ($schedulereportempty === schedule::REPORT_EMPTY_DONT_SEND &&
Línea 128... Línea 129...
128
                            helper::get_schedule_report_count($schedule) === 0) {
129
                                report::get_report_row_count($schedule->get('reportid')) === 0) {
129
 
130
 
130
                            $this->log('Empty report, skipping', 2);
131
                            $this->log('Empty report, skipping', 2);
Línea 138... Línea 139...
138
                }
139
                }
139
            }
140
            }
140
        }
141
        }
Línea 141... Línea 142...
141
 
142
 
142
        // Finish, clean up (set persistent property manually to avoid updating it's user/time modified data).
143
        // Finish, clean up (set persistent property manually to avoid updating it's user/time modified data).
-
 
144
        $DB->set_field($schedule::TABLE, 'timelastsent', di::get(clock::class)->time(), [
-
 
145
            'id' => $schedule->get('id'),
Línea 143... Línea 146...
143
        $DB->set_field($schedule::TABLE, 'timelastsent', time(), ['id' => $schedule->get('id')]);
146
        ]);
144
 
147
 
145
        if ($scheduleattachment !== null) {
148
        if ($scheduleattachment !== null) {