Skip to content

Commit ae08475

Browse files
committed
Panel: Use !str_contains instead of old stripos === false
1 parent 73b6627 commit ae08475

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

includes/inc.panel.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -381,15 +381,18 @@ function compatibilityUpdater() : void
381381

382382
foreach ($a_commits as $commit => $value)
383383
{
384-
if (stripos($post->message, substr((string) $commit, 0, 8)) !== false)
384+
// Skip posts with no commits
385+
if (!str_contains($post->message, substr((string) $commit, 0, 8)))
385386
{
386-
$a_inserts[$thread->tid]['thread']->set_post_id($post->pid);
387-
$a_inserts[$thread->tid]['commit'] = (string) $commit;
388-
$a_inserts[$thread->tid]['pr'] = $value["pr"];
389-
$a_inserts[$thread->tid]['last_update'] = date('Y-m-d', $post->dateline);
390-
$a_inserts[$thread->tid]['author'] = $post->username;
391-
break 2;
387+
continue;
392388
}
389+
390+
$a_inserts[$thread->tid]['thread']->set_post_id($post->pid);
391+
$a_inserts[$thread->tid]['commit'] = (string) $commit;
392+
$a_inserts[$thread->tid]['pr'] = $value["pr"];
393+
$a_inserts[$thread->tid]['last_update'] = date('Y-m-d', $post->dateline);
394+
$a_inserts[$thread->tid]['author'] = $post->username;
395+
break 2;
393396
}
394397
}
395398

@@ -494,8 +497,10 @@ function compatibilityUpdater() : void
494497
foreach ($a_commits as $commit => $value)
495498
{
496499
// Skip posts with no commits
497-
if (stripos($post->message, substr((string) $commit, 0, 8)) === false)
500+
if (!str_contains($post->message, substr((string) $commit, 0, 8)))
501+
{
498502
continue;
503+
}
499504

500505
// If current commit is newer than the previously recorded one, replace
501506
// TODO: Check distance between commit date and post here

0 commit comments

Comments
 (0)