Merge pull request #163 from creative-commoners/pulls/4/php81

ENH PHP 8.1 compatibility
This commit is contained in:
Guy Sartorelli 2022-04-26 17:58:20 +12:00 committed by GitHub
commit 9f7b0e2169
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View File

@ -132,13 +132,13 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
$familyIDs = $group->collateFamilyIDs(); $familyIDs = $group->collateFamilyIDs();
if (is_array($familyIDs)) { if (is_array($familyIDs)) {
$groupIDs = array_merge($groupIDs, array_values($familyIDs)); $groupIDs = array_merge($groupIDs, array_values($familyIDs ?? []));
} }
} }
array_unique($groupIDs); array_unique($groupIDs ?? []);
if (count($groupIDs)) { if (count($groupIDs ?? [])) {
$groupMembers = DataObject::get(Member::class) $groupMembers = DataObject::get(Member::class)
->where("\"Group\".\"ID\" IN (" . implode(",", $groupIDs) . ")") ->where("\"Group\".\"ID\" IN (" . implode(",", $groupIDs) . ")")
->leftJoin("Group_Members", "\"Member\".\"ID\" = \"Group_Members\".\"MemberID\"") ->leftJoin("Group_Members", "\"Member\".\"ID\" = \"Group_Members\".\"MemberID\"")
@ -676,7 +676,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
$runHour = Config::inst()->get(ContentReviewNotificationJob::class, "first_run_hour"); $runHour = Config::inst()->get(ContentReviewNotificationJob::class, "first_run_hour");
$firstRunTime = date( $firstRunTime = date(
"Y-m-d H:i:s", "Y-m-d H:i:s",
mktime($runHour, 0, 0, date("m"), date("d") + 1, date("y")) mktime($runHour ?? 0, 0, 0, date("m"), date("d") + 1, date("y"))
); );
singleton(QueuedJobService::class)->queueJob( singleton(QueuedJobService::class)->queueJob(

View File

@ -108,7 +108,7 @@ class ContentReviewNotificationJob extends AbstractQueuedJob implements QueuedJo
$nextRun = new ContentReviewNotificationJob(); $nextRun = new ContentReviewNotificationJob();
$nextRunTime = mktime( $nextRunTime = mktime(
Config::inst()->get(__CLASS__, 'next_run_hour'), Config::inst()->get(__CLASS__, 'next_run_hour') ?? 0,
Config::inst()->get(__CLASS__, 'next_run_minute'), Config::inst()->get(__CLASS__, 'next_run_minute'),
0, 0,
date("m"), date("m"),

View File

@ -77,8 +77,8 @@ class PagesDueForReviewReport extends Report
public function columns() public function columns()
{ {
$linkBase = singleton(CMSPageEditController::class)->Link("show"); $linkBase = singleton(CMSPageEditController::class)->Link("show");
$linkPath = parse_url($linkBase, PHP_URL_PATH); $linkPath = parse_url($linkBase ?? '', PHP_URL_PATH);
$linkQuery = parse_url($linkBase, PHP_URL_QUERY); $linkQuery = parse_url($linkBase ?? '', PHP_URL_QUERY);
$fields = [ $fields = [
"Title" => [ "Title" => [
@ -182,7 +182,7 @@ class PagesDueForReviewReport extends Report
// TODO Get value from DateField->dataValue() once we have access to form elements here // TODO Get value from DateField->dataValue() once we have access to form elements here
$nextReviewUnixSec = strtotime( $nextReviewUnixSec = strtotime(
' + 1 day', ' + 1 day',
strtotime($params['ReviewDateBefore']) strtotime($params['ReviewDateBefore'] ?? '')
); );
$records = $records->where( $records = $records->where(
sprintf( sprintf(
@ -209,7 +209,7 @@ class PagesDueForReviewReport extends Report
$virtualPageClasses = ClassInfo::subclassesFor(VirtualPage::class); $virtualPageClasses = ClassInfo::subclassesFor(VirtualPage::class);
$records = $records->where(sprintf( $records = $records->where(sprintf(
"\"SiteTree\".\"ClassName\" NOT IN ('%s')", "\"SiteTree\".\"ClassName\" NOT IN ('%s')",
implode("','", array_values($virtualPageClasses)) implode("','", array_values($virtualPageClasses ?? []))
)); ));
} }

View File

@ -46,8 +46,8 @@ class PagesWithoutReviewScheduleReport extends Report
public function columns() public function columns()
{ {
$linkBase = singleton(CMSPageEditController::class)->Link("show"); $linkBase = singleton(CMSPageEditController::class)->Link("show");
$linkPath = parse_url($linkBase, PHP_URL_PATH); $linkPath = parse_url($linkBase ?? '', PHP_URL_PATH);
$linkQuery = parse_url($linkBase, PHP_URL_QUERY); $linkQuery = parse_url($linkBase ?? '', PHP_URL_QUERY);
$fields = [ $fields = [
"Title" => [ "Title" => [
@ -123,7 +123,7 @@ class PagesWithoutReviewScheduleReport extends Report
$virtualPageClasses = ClassInfo::subclassesFor(VirtualPage::class); $virtualPageClasses = ClassInfo::subclassesFor(VirtualPage::class);
$records = $records->where(sprintf( $records = $records->where(sprintf(
"\"SiteTree\".\"ClassName\" NOT IN ('%s')", "\"SiteTree\".\"ClassName\" NOT IN ('%s')",
implode("','", array_values($virtualPageClasses)) implode("','", array_values($virtualPageClasses ?? []))
)); ));
} }