Fix Laravel Pint formatting
This commit is contained in:
@@ -10,7 +10,7 @@ class CleanupSchedulerService
|
||||
public function shouldRun(string $cacheKey, int $minutes): bool
|
||||
{
|
||||
$lastRun = Cache::get($cacheKey);
|
||||
if (!$lastRun) {
|
||||
if (! $lastRun) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,31 +24,34 @@ class ConfigUpdateService
|
||||
|
||||
public function runTask(string $task, bool $dry, bool $force, DateTimeZone $tz): array
|
||||
{
|
||||
if (!isset($this->tasks[$task])) {
|
||||
if (! isset($this->tasks[$task])) {
|
||||
return ['ok' => false, 'message' => 'Unknown task.'];
|
||||
}
|
||||
|
||||
$lockFile = storage_path('app/locks/config_update_' . $task . '.lock');
|
||||
if (!is_dir(dirname($lockFile))) {
|
||||
$lockFile = storage_path('app/locks/config_update_'.$task.'.lock');
|
||||
if (! is_dir(dirname($lockFile))) {
|
||||
@mkdir(dirname($lockFile), 0775, true);
|
||||
}
|
||||
|
||||
$fp = @fopen($lockFile, 'c+');
|
||||
if (!$fp) {
|
||||
if (! $fp) {
|
||||
return ['ok' => false, 'message' => 'Unable to open lock file.'];
|
||||
}
|
||||
|
||||
if (!$force && !flock($fp, LOCK_EX | LOCK_NB)) {
|
||||
if (! $force && ! flock($fp, LOCK_EX | LOCK_NB)) {
|
||||
fclose($fp);
|
||||
|
||||
return ['ok' => false, 'message' => 'Task is already running.'];
|
||||
}
|
||||
|
||||
try {
|
||||
$method = $this->tasks[$task];
|
||||
$ok = (bool) $this->{$method}($dry, $force, $tz);
|
||||
|
||||
return ['ok' => $ok, 'task' => $task];
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('ConfigUpdate task failed: ' . $e->getMessage());
|
||||
Log::error('ConfigUpdate task failed: '.$e->getMessage());
|
||||
|
||||
return ['ok' => false, 'message' => $e->getMessage()];
|
||||
} finally {
|
||||
try {
|
||||
@@ -74,11 +77,12 @@ class ConfigUpdateService
|
||||
{
|
||||
$now = new DateTimeImmutable('now', $tz);
|
||||
$isJune1 = $now->format('n-j') === '6-1';
|
||||
if (!$isJune1 && !$force) {
|
||||
if (! $isJune1 && ! $force) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$value = $now->format('Y') . '-12-31';
|
||||
$value = $now->format('Y').'-12-31';
|
||||
|
||||
return $dry ? true : Configuration::setConfigValueByKey('date_age_reference', $value);
|
||||
}
|
||||
|
||||
@@ -86,7 +90,7 @@ class ConfigUpdateService
|
||||
{
|
||||
$now = new DateTimeImmutable('now', $tz);
|
||||
$isFeb1 = $now->format('n-j') === '2-1';
|
||||
if (!$isFeb1 && !$force) {
|
||||
if (! $isFeb1 && ! $force) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -97,7 +101,7 @@ class ConfigUpdateService
|
||||
{
|
||||
$now = new DateTimeImmutable('now', $tz);
|
||||
$isJun1 = $now->format('n-j') === '6-1';
|
||||
if (!$isJun1 && !$force) {
|
||||
if (! $isJun1 && ! $force) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ class HealthCheckService
|
||||
$uploadsBase = storage_path('app/uploads');
|
||||
$paths = [
|
||||
'uploads' => $uploadsBase,
|
||||
'uploads/reimbursements' => $uploadsBase . DIRECTORY_SEPARATOR . 'reimbursements',
|
||||
'uploads/receipts' => $uploadsBase . DIRECTORY_SEPARATOR . 'receipts',
|
||||
'uploads/checks' => $uploadsBase . DIRECTORY_SEPARATOR . 'checks',
|
||||
'uploads/early_dismissal_signatures' => $uploadsBase . DIRECTORY_SEPARATOR . 'early_dismissal_signatures',
|
||||
'uploads/reimbursements' => $uploadsBase.DIRECTORY_SEPARATOR.'reimbursements',
|
||||
'uploads/receipts' => $uploadsBase.DIRECTORY_SEPARATOR.'receipts',
|
||||
'uploads/checks' => $uploadsBase.DIRECTORY_SEPARATOR.'checks',
|
||||
'uploads/early_dismissal_signatures' => $uploadsBase.DIRECTORY_SEPARATOR.'early_dismissal_signatures',
|
||||
];
|
||||
|
||||
$pathsStatus = [];
|
||||
@@ -48,10 +48,10 @@ class HealthCheckService
|
||||
}, true);
|
||||
|
||||
$okDb = true;
|
||||
if ($dbChecks['user_preferences_exists'] && !$dbChecks['user_preferences_has_timezone']) {
|
||||
if ($dbChecks['user_preferences_exists'] && ! $dbChecks['user_preferences_has_timezone']) {
|
||||
$okDb = false;
|
||||
}
|
||||
if ($dbChecks['settings_exists'] && !$dbChecks['settings_has_timezone']) {
|
||||
if ($dbChecks['settings_exists'] && ! $dbChecks['settings_has_timezone']) {
|
||||
$okDb = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class TimeService
|
||||
public function toUtc($value, ?string $fromTz = null, string $format = 'Y-m-d H:i:s'): ?string
|
||||
{
|
||||
$dt = $this->parse($value, $fromTz);
|
||||
if (!$dt) {
|
||||
if (! $dt) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class TimeService
|
||||
public function toLocal($value, ?string $sourceTz = null, ?string $targetTz = null, string $format = 'Y-m-d H:i:s'): ?string
|
||||
{
|
||||
$dt = $this->parse($value, $sourceTz);
|
||||
if (!$dt) {
|
||||
if (! $dt) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ class TimeService
|
||||
public function formatLocal($value, string $format = 'Y-m-d', ?string $sourceTz = null): string
|
||||
{
|
||||
$dt = $this->parse($value, $sourceTz);
|
||||
if (!$dt) {
|
||||
if (! $dt) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user