mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-16 21:41:31 +02:00
Add conditions before calling update_maintenance_later() #172.
This commit is contained in:
@@ -135,7 +135,7 @@ class outagedb {
|
||||
}
|
||||
|
||||
// Trigger outages modified events.
|
||||
outagelib::prepare_next_outage();
|
||||
outagelib::prepare_next_outage(true);
|
||||
|
||||
// All done, return the id.
|
||||
return $outage->id;
|
||||
|
||||
@@ -163,16 +163,25 @@ class outagelib {
|
||||
|
||||
/**
|
||||
* Executed when outages are modified (created, updated or deleted).
|
||||
*
|
||||
* @param bool $reenablemaint should we re-enable maintenance mode for ongoing outage
|
||||
* @throws coding_exception
|
||||
* @throws file_exception
|
||||
*/
|
||||
public static function prepare_next_outage() {
|
||||
public static function prepare_next_outage($reenablemaint = false) {
|
||||
// If there is an ongoing outage, prepare it instead.
|
||||
$outage = outagedb::get_ongoing();
|
||||
if (is_null($outage)) {
|
||||
$outage = outagedb::get_next_starting();
|
||||
$ongoingoutage = false;
|
||||
} else {
|
||||
$ongoingoutage = true;
|
||||
}
|
||||
maintenance_static_page::create_from_outage($outage)->generate();
|
||||
self::update_climaintenance_code($outage);
|
||||
self::update_maintenance_later($outage);
|
||||
if (!$ongoingoutage || $reenablemaint || is_null($outage)) {
|
||||
self::update_maintenance_later($outage);
|
||||
}
|
||||
}
|
||||
|
||||
private static function check_wwwroot_accessible() {
|
||||
|
||||
Reference in New Issue
Block a user