blob: 50c6e4b59277613b0e539ace9a2d18fb8e19a104 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env php
<?php
require_once(__DIR__ . '/studip_cli_env.inc.php');
$keep_exceptions = true;
$options = getopt('h', ['remove-exceptions']);
if (array_key_exists('h', $options)) {
echo("Usage:\tupdate-resource-booking-intervals.php [--remove-exceptions]\n");
echo("\tIf --remove-exceptions is set, exceptions for a booking with repetitions\n");
echo("\twill be removed. By default, they are kept.\n");
exit(0);
}
if (array_key_exists('remove-exceptions', $options)) {
$keep_exceptions = false;
echo("Exceptions in bookings with repetitions will be removed!\n");
}
$bookings = ResourceBooking::findBySql('TRUE');
if (!$bookings) {
echo("There are no bookings in your database! Nothing to do!\n");
exit(0);
}
foreach ($bookings as $booking) {
$booking->updateIntervals($keep_exceptions);
}
echo("End of script. The resource_booking_intervals table is up to date again!\n");
|