Skip to content

Commit

Permalink
Bugfix: Omit PHP deprecation warnings on PHP 8.2, solves #411
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch authored and abias committed Oct 7, 2023
1 parent 2de01d0 commit 83128d1
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changes

### Unreleased

* 2023-10-01 - Bugfix: Omit PHP deprecation warnings on PHP 8.2, solves #411.
* 2023-10-01 - Test: Run Moodle Plugin CI with PHP 8.2 as well.
* 2023-10-01 - Bugfix: Smart menus did not support multilanguage filters, solves #376.
* 2023-09-28 - Release: Make sure that Smart Menu SCSS does not affect installations which do not use smart menus, solves #380.
Expand Down
10 changes: 10 additions & 0 deletions classes/table/flavours_overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@
*/
class flavours_overview extends \table_sql {

/**
* @var int $count Flavours count.
*/
private $count;

/**
* @var int $totalflavours Total flavours count.
*/
private $totalflavours;

/**
* Setup table.
*
Expand Down
15 changes: 15 additions & 0 deletions classes/table/smartmenus_items.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@
*/
class smartmenus_items extends \table_sql {

/**
* @var int $count Smart menu items count.
*/
private $count;

/**
* @var int $totalmenuitems Total menu items count.
*/
private $totalmenuitems;

/**
* @var int $menuid Menu ID.
*/
private $menuid;

/**
* Setup table.
*
Expand Down
10 changes: 10 additions & 0 deletions classes/table/smartmenus_menus.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@
*/
class smartmenus_menus extends \table_sql {

/**
* @var int $count Smart menu menus count.
*/
private $count;

/**
* @var int $totalmenus Total menu count.
*/
private $totalmenus;

/**
* Setup table.
*
Expand Down
5 changes: 5 additions & 0 deletions layout/includes/blockregions.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
*/
class additionalregions {

/**
* @var array $regions List of page regions.
*/
private $regions;

/**
* Constructor.
* Get the all regions in theme_boost_union_get_additional_regions function.
Expand Down
14 changes: 7 additions & 7 deletions smartmenus/menulib.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,16 +443,16 @@ public static function purge_cache_session_cohort(int $cohortid, int $userid) {
if ($menus = self::find_condition_used_menus($cohortid)) {
// Remove the menus cache for the user.
$menus = array_column($menus, 'id');
array_walk($menus, ['self', 'remove_user_cachemenu'], $userid);
array_walk($menus, [self::class, 'remove_user_cachemenu'], $userid);
}

if ($items = self::find_condition_used_menuitems($cohortid)) {
// Get the list of menus related to the items.
$menus = array_unique(array_column($items, 'menu'));
$items = array_column($items, 'id');
// Remove the menus and item cache for the user.
array_walk($menus, ['self', 'remove_user_cachemenu'], $userid);
array_walk($items, ['self', 'remove_user_cacheitem'], $userid);
array_walk($menus, [self::class, 'remove_user_cachemenu'], $userid);
array_walk($items, [self::class, 'remove_user_cacheitem'], $userid);

}
}
Expand All @@ -472,16 +472,16 @@ public static function purge_cache_session_roles(int $roleid, int $userid) {
if ($menus = self::find_condition_used_menus($roleid, 'roles')) {
// Remove the menus cache for the user.
$menus = array_column($menus, 'id');
array_walk($menus, ['self', 'remove_user_cachemenu'], $userid);
array_walk($menus, [self::class, 'remove_user_cachemenu'], $userid);
}

if ($items = self::find_condition_used_menuitems($roleid, 'roles')) {
// Get the list of menus related to the items.
$menus = array_unique(array_column($items, 'menu'));
$items = array_column($items, 'id');
// Remove the menus and item cache for the user.
array_walk($menus, ['self', 'remove_user_cachemenu'], $userid);
array_walk($items, ['self', 'remove_user_cacheitem'], $userid);
array_walk($menus, [self::class, 'remove_user_cachemenu'], $userid);
array_walk($items, [self::class, 'remove_user_cacheitem'], $userid);
}
}

Expand All @@ -497,7 +497,7 @@ public static function purge_cache_dynamic_courseitems() {
// List of items to purge.
$items = array_column($items, 'id');
// Remove the menus items for the user.
array_walk($items, ['self', 'purge_item_cache']);
array_walk($items, [self::class, 'purge_item_cache']);
}
}

Expand Down

0 comments on commit 83128d1

Please sign in to comment.