Convert loop_limit to a config item

This commit is contained in:
Andrew Ruthven 2022-12-15 11:05:46 +13:00
parent 513db6b8d1
commit 7a8c7b5b25
4 changed files with 27 additions and 7 deletions

View File

@ -433,6 +433,18 @@ $c->admin_email ='calendar-admin@example.com';
*/
// $c->disable_caldav_proxy_propfind_collections = array( 'User-Agent'=>'#regex1#', 'X-Client'=>'#regex2#');
/**
* A limiter on how many times we'll apply the recurrence rules for an event
* to find the next valid one.
*
* Default: 100
*
* If you see the following error message, you may want to consider increasing
* it:
* RRULE, loop limit has been hit in GetMoreInstances, you probably want to increase $c->rrule_loop_limit
*/
// $c->rrule_loop_limit = 100;
/**
* EXPERIMENTAL:
* If true, names of groups (prefixed with "@") given as an event attendee

View File

@ -109,11 +109,11 @@ function early_catch_fatal_error() {
register_shutdown_function('early_catch_fatal_error');
$c->default_timezone = ini_get ( 'date.timezone' );
if (empty ( $c->default_timezone )) {
if (isset ( $_SERVER ['HTTP_X_DAVICAL_TESTCASE'] ) ) {
$c->default_timezone = 'Pacific/Auckland';
}
else if (empty ( $c->default_timezone )) {
$c->default_timezone = 'UTC';
if (isset ( $_SERVER ['HTTP_X_DAVICAL_TESTCASE'] )) {
$c->default_timezone = 'Pacific/Auckland';
}
}
// Default some of the configurable values
@ -160,6 +160,10 @@ $c->readonly_webdav_collections = true; // WebDAV access is readonly
// Kind of private configuration values
$c->total_query_time = 0;
// Any many times GetMoreInstances in inc/RRule.php should loop trying to
// find more instances.
$c->rrule_loop_limit = 100;
$c->dbg = array();

View File

@ -815,14 +815,14 @@ class RepeatRule {
}
private function GetMoreInstances($return_floating_times=false) {
global $c;
if ( $this->finished ) return;
$got_more = false;
$loop_limit = 100;
$loops = 0;
if ( $return_floating_times ) $this->base->setAsFloat();
while( !$this->finished && !$got_more) {
if ($loops++ > $loop_limit ) {
dbg_error_log ('ERROR', "RRULE, loop limit has been hit in GetMoreInstances, this probably needs to be increased (loop_limit: %d)", $loop_limit);
if ($loops++ > $c->rrule_loop_limit ) {
dbg_error_log ('ERROR', "RRULE, loop limit has been hit in GetMoreInstances, you probably want to increase \$c->rrule_loop_limit (currently %d)", $c->rrule_loop_limit);
break;
}

View File

@ -160,6 +160,10 @@ $c->readonly_webdav_collections = true; // WebDAV access is readonly
// Kind of private configuration values
$c->total_query_time = 0;
// Any many times GetMoreInstances in inc/RRule.php should loop trying to
// find more instances.
$c->rrule_loop_limit = 100;
$c->dbg = array();