From 5e4494c9e8a77d2a7457743bcb323214fba10e71 Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 21 Mar 2024 18:47:11 +0200 Subject: [PATCH] use PHP 8 str_starts_with function --- src/cli/document/clean.php | 2 +- src/cli/document/crawl.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cli/document/clean.php b/src/cli/document/clean.php index 9b64c46..3dcff8d 100644 --- a/src/cli/document/clean.php +++ b/src/cli/document/clean.php @@ -97,7 +97,7 @@ foreach ($config->cli->document->crawl->skip->stripos->url as $condition) // Delete local snaps $location = sprintf( '%s/%s', - '/' === substr($config->snap->storage->local->directory, 0, 1) ? $config->snap->storage->local->directory + str_starts_with($config->snap->storage->local->directory, '/') ? $config->snap->storage->local->directory // absolute path : __DIR__ . '/../../../' . $config->snap->storage->local->directory, implode( '/', diff --git a/src/cli/document/crawl.php b/src/cli/document/crawl.php index a9c186a..f70a032 100644 --- a/src/cli/document/crawl.php +++ b/src/cli/document/crawl.php @@ -575,7 +575,7 @@ foreach($index->search('') ); /// absolute - if ('/' === substr($config->snap->storage->tmp->directory, 0, 1)) + if (str_starts_with($config->snap->storage->tmp->directory, '/')) { $filepath = $config->snap->storage->tmp->directory; } @@ -671,7 +671,7 @@ foreach($index->search('') if ($allowed) { /// absolute - if ('/' === substr($config->snap->storage->local->directory, 0, 1)) + if (str_starts_with($config->snap->storage->local->directory, '/')) { $filepath = $config->snap->storage->local->directory; }