diff --git a/config-templates/module_accounting.php b/config-templates/module_accounting.php index 828725be3cc9d61ade4860ca5de3b2669b946959..e1755cd560347486bb979db7e4450007ef53d6c0 100644 --- a/config-templates/module_accounting.php +++ b/config-templates/module_accounting.php @@ -157,13 +157,13 @@ $config = [ * * Maximum execution time for the job runner. You can use this option to limit job runner activity by combining * when the job runner will run (using cron configuration) and how long the job runner will be active - * (execution time). This can be null, meaning it will run indefinitely, or can be set as a duration + * (execution time). This can be false, meaning it will run indefinitely, or can be set as a duration * for DateInterval, examples being below. Note that when the job runner is run using Cron user * interface in SimpleSAMLphp, the duration will be taken from the 'max_execution_time' ini * setting, and will override this setting if ini setting is shorter. * @see https://www.php.net/manual/en/dateinterval.construct.php */ - ModuleConfiguration::OPTION_JOB_RUNNER_MAXIMUM_EXECUTION_TIME => null, + ModuleConfiguration::OPTION_JOB_RUNNER_MAXIMUM_EXECUTION_TIME => false, //ModuleConfiguration::OPTION_JOB_RUNNER_MAXIMUM_EXECUTION_TIME => 'PT9M', // 9 minutes //ModuleConfiguration::OPTION_JOB_RUNNER_MAXIMUM_EXECUTION_TIME => 'PT59M', // 59 minutes //ModuleConfiguration::OPTION_JOB_RUNNER_MAXIMUM_EXECUTION_TIME => 'P1D', // 1 day @@ -172,7 +172,7 @@ $config = [ * Number of processed jobs after which the job runner should take a 1-second pause. * * This option was introduced so that the job runner can act in a more resource friendly fashion when facing - * backend store. If the value is null, there will be no pause. + * backend store. If the value is false, there will be no pause. */ ModuleConfiguration::OPTION_JOB_RUNNER_SHOULD_PAUSE_AFTER_NUMBER_OF_JOBS_PROCESSED => 10, diff --git a/src/ModuleConfiguration.php b/src/ModuleConfiguration.php index 453d1b9677158bff4ec8df7749dc4299ac7e78d7..21e5d69d27db42b8cad51b9f87147246a9c90867 100644 --- a/src/ModuleConfiguration.php +++ b/src/ModuleConfiguration.php @@ -87,7 +87,7 @@ class ModuleConfiguration { $value = $this->get(self::OPTION_JOB_RUNNER_MAXIMUM_EXECUTION_TIME); - if (is_null($value)) { + if ($value === false) { return null; } @@ -109,13 +109,13 @@ class ModuleConfiguration { $value = $this->get(self::OPTION_JOB_RUNNER_SHOULD_PAUSE_AFTER_NUMBER_OF_JOBS_PROCESSED); - if (is_null($value)) { + if ($value === false) { return null; } if (! is_int($value)) { $message = sprintf( - 'Option \'%s\' must be defined either as null, or positive integer.', + 'Option \'%s\' must be defined either as false, or positive integer.', self::OPTION_JOB_RUNNER_SHOULD_PAUSE_AFTER_NUMBER_OF_JOBS_PROCESSED ); throw new InvalidConfigurationException($message); diff --git a/tests/config-templates/module_accounting.php b/tests/config-templates/module_accounting.php index 882170befdeb1d19e4908df67adb8402c21eee02..0ecea7b2269eeaff86028ce3936e23890e3aa7c9 100644 --- a/tests/config-templates/module_accounting.php +++ b/tests/config-templates/module_accounting.php @@ -48,7 +48,7 @@ $config = [ ], ], - ModuleConfiguration::OPTION_JOB_RUNNER_MAXIMUM_EXECUTION_TIME => null, + ModuleConfiguration::OPTION_JOB_RUNNER_MAXIMUM_EXECUTION_TIME => false, ModuleConfiguration::OPTION_JOB_RUNNER_SHOULD_PAUSE_AFTER_NUMBER_OF_JOBS_PROCESSED => 10, diff --git a/tests/src/ModuleConfigurationTest.php b/tests/src/ModuleConfigurationTest.php index 6c2fc0e622ce372b193565d9bd311f1b7c353aca..2c4612cbd140587fd403dba3a0c6a792b208ed5a 100644 --- a/tests/src/ModuleConfigurationTest.php +++ b/tests/src/ModuleConfigurationTest.php @@ -219,7 +219,7 @@ class ModuleConfigurationTest extends TestCase { $moduleConfiguration = new ModuleConfiguration( null, - [ModuleConfiguration::OPTION_JOB_RUNNER_MAXIMUM_EXECUTION_TIME => false] + [ModuleConfiguration::OPTION_JOB_RUNNER_MAXIMUM_EXECUTION_TIME => []] ); $this->expectException(InvalidConfigurationException::class); @@ -255,7 +255,7 @@ class ModuleConfigurationTest extends TestCase { $moduleConfiguration = new ModuleConfiguration( null, - [ModuleConfiguration::OPTION_JOB_RUNNER_SHOULD_PAUSE_AFTER_NUMBER_OF_JOBS_PROCESSED => null] + [ModuleConfiguration::OPTION_JOB_RUNNER_SHOULD_PAUSE_AFTER_NUMBER_OF_JOBS_PROCESSED => false] ); $this->assertNull($moduleConfiguration->getJobRunnerShouldPauseAfterNumberOfJobsProcessed()); @@ -268,7 +268,7 @@ class ModuleConfigurationTest extends TestCase { $moduleConfiguration = new ModuleConfiguration( null, - [ModuleConfiguration::OPTION_JOB_RUNNER_SHOULD_PAUSE_AFTER_NUMBER_OF_JOBS_PROCESSED => false] + [ModuleConfiguration::OPTION_JOB_RUNNER_SHOULD_PAUSE_AFTER_NUMBER_OF_JOBS_PROCESSED => []] ); $this->expectException(InvalidConfigurationException::class);