Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion webapp/src/Entity/Contest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ public function validate(ExecutionContextInterface $context): void
{
foreach (['Activate', 'Deactivate', 'Start', 'End', 'Freeze', 'Unfreeze'] as $timeString) {
$tmpValue = $this->{'get' . $timeString . 'timeString'}();
if ($tmpValue === null) continue;
if ($tmpValue === null) continue; // phpcs:ignore Generic.ControlStructures.InlineControlStructure.NotAllowed
try {
$this->checkValidTimeString($tmpValue);
} catch (Exception $e) {
Expand Down
7 changes: 3 additions & 4 deletions webapp/src/Service/DOMJudgeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,7 @@ public function cacherCheckNewVersion(ItemInterface $item): array|false {
* Returns either the next strictly higher version or false when nothing is found/requested.
*/
public function checkNewVersion(): string|false {
if ($this->config->get('check_new_version', false) === UpdateStrategy::Strategy_none) {
if ($this->config->get('check_new_version', false) === UpdateStrategy::NONE) {
return false;
}
// The local version is something like "x.y.z / commit hash", e.g. "8.4.0DEV/4e25adb13" for development
Expand All @@ -1775,7 +1775,7 @@ public function checkNewVersion(): string|false {

preg_match("/\d.\d.\d/", $this->domjudgeVersion, $matches);
$extractedLocalVersionString = $matches[0];
if ($this->config->get('check_new_version', false) === UpdateStrategy::Strategy_incremental) {
if ($this->config->get('check_new_version', false) === UpdateStrategy::INCREMENTAL) {
/* Steer towards the nearest highest patch release first
* So the expected path would be:
* DJ6.0.0 -> DJ6.0.6 -> DJ6.6.0 -> DJ9.1.2 instead of
Expand All @@ -1801,8 +1801,7 @@ public function checkNewVersion(): string|false {
}
}
}
}
elseif ($this->config->get('check_new_version', false) === UpdateStrategy::Strategy_major_release) {
} elseif ($this->config->get('check_new_version', false) === UpdateStrategy::MAJOR_RELEASE) {
/* Steer towards the latest version directly
* So the expected path would be:
* DJ6.0.0 -> DJ9.1.2
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/Service/EventLogService.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public function addMissingStateEvents(Contest $contest): void
$this->dj->withAllRoles(function () use ($url, &$awards) {
$response = $this->dj->internalApiRequest($url);
if (!empty($response)) {
$awards = Utils::jsonDecode($response);
$awards = Utils::jsonDecode($response);
}
});
foreach ($awards as $award) {
Expand Down
12 changes: 6 additions & 6 deletions webapp/src/Utils/UpdateStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

enum UpdateStrategy: string
{
case Strategy_incremental = 'incremental';
case Strategy_major_release = 'major';
case Strategy_none = 'none';
case INCREMENTAL = 'incremental';
case MAJOR_RELEASE = 'major';
case NONE = 'none';

public function getConfigDescription(): string
{
return match ($this) {
self::Strategy_incremental => 'Report on next patch releases, favoring reliability over features',
self::Strategy_major_release => 'Report on newest Major/minor releases, favoring being close to the version maintainers run',
self::Strategy_none => 'Do not report on any new versions',
self::INCREMENTAL => 'Report on next patch releases, favoring reliability over features',
self::MAJOR_RELEASE => 'Report on newest Major/minor releases, favoring being close to the version maintainers run',
self::NONE => 'Do not report on any new versions',
};
}
}
4 changes: 2 additions & 2 deletions webapp/src/Utils/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -1082,10 +1082,10 @@ public static function extendMaxExecutionTime(int $minimumMaxExecutionTime): voi
/**
* Call ob_flush() unless the top-level output buffer does not allow it.
*/
public static function ob_flush_if_possible(): bool
public static function ob_flush_if_possible(): bool // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
{
$status = ob_get_status();
if ( empty($status) || ($status['flags'] & PHP_OUTPUT_HANDLER_CLEANABLE) ) {
if (empty($status) || ($status['flags'] & PHP_OUTPUT_HANDLER_CLEANABLE)) {
return ob_flush();
}
return false;
Expand Down
Loading