diff --git a/includes/Helpers/ManageWikiPermissions.php b/includes/Helpers/ManageWikiPermissions.php index a7916df..255f965 100644 --- a/includes/Helpers/ManageWikiPermissions.php +++ b/includes/Helpers/ManageWikiPermissions.php @@ -61,7 +61,7 @@ public function __construct( string $wiki ) { 'removegroups' => json_decode( $perm->perm_removegroups, true ), 'addself' => json_decode( $perm->perm_addgroupstoself, true ), 'removeself' => json_decode( $perm->perm_removegroupsfromself, true ), - 'autopromote' => json_decode( $perm->perm_autopromote, true ) + 'autopromote' => json_decode( $perm->perm_autopromote ?? '', true ) ]; } } @@ -171,7 +171,7 @@ public function commit() { 'perm_removegroups' => json_encode( $this->livePermissions[$group]['removegroups'] ), 'perm_addgroupstoself' => json_encode( $this->livePermissions[$group]['addself'] ), 'perm_removegroupsfromself' => json_encode( $this->livePermissions[$group]['removeself'] ), - 'perm_autopromote' => $this->livePermissions[$group]['autopromote'] === null ? null : json_encode( $this->livePermissions[$group]['autopromote'] ) + 'perm_autopromote' => $this->livePermissions[$group]['autopromote'] === null ? null : json_encode( $this->livePermissions[$group]['autopromote'] ?? '' ) ]; $this->dbw->upsert( diff --git a/includes/Hooks.php b/includes/Hooks.php index 400a5f7..0473257 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -172,16 +172,16 @@ public static function onCreateWikiJsonBuilder( string $wiki, DBConnRef $dbr, ar } } - $permissions = array_merge( json_decode( $perm->perm_permissions, true ) ?? [], $addPerms ); + $permissions = array_merge( json_decode( $perm->perm_permissions ?? '', true ) ?? [], $addPerms ); $filteredPermissions = array_diff( $permissions, $removePerms ); $jsonArray['permissions'][$perm->perm_group] = [ 'permissions' => $filteredPermissions, - 'addgroups' => array_merge( json_decode( $perm->perm_addgroups, true ) ?? [], self::getConfig( 'ManageWikiPermissionsAdditionalAddGroups' )[$perm->perm_group] ?? [] ), - 'removegroups' => array_merge( json_decode( $perm->perm_removegroups, true ) ?? [], self::getConfig( 'ManageWikiPermissionsAdditionalRemoveGroups' )[$perm->perm_group] ?? [] ), - 'addself' => array_merge( json_decode( $perm->perm_addgroupstoself, true ) ?? [], self::getConfig( 'ManageWikiPermissionsAdditionalAddGroupsSelf' )[$perm->perm_group] ?? [] ), - 'removeself' => array_merge( json_decode( $perm->perm_removegroupsfromself, true ) ?? [], self::getConfig( 'ManageWikiPermissionsAdditionalRemoveGroupsSelf' )[$perm->perm_group] ?? [] ), - 'autopromote' => json_decode( $perm->perm_autopromote, true ) + 'addgroups' => array_merge( json_decode( $perm->perm_addgroups ?? '', true ) ?? [], self::getConfig( 'ManageWikiPermissionsAdditionalAddGroups' )[$perm->perm_group] ?? [] ), + 'removegroups' => array_merge( json_decode( $perm->perm_removegroups ?? '', true ) ?? [], self::getConfig( 'ManageWikiPermissionsAdditionalRemoveGroups' )[$perm->perm_group] ?? [] ), + 'addself' => array_merge( json_decode( $perm->perm_addgroupstoself ?? '', true ) ?? [], self::getConfig( 'ManageWikiPermissionsAdditionalAddGroupsSelf' )[$perm->perm_group] ?? [] ), + 'removeself' => array_merge( json_decode( $perm->perm_removegroupsfromself ?? '', true ) ?? [], self::getConfig( 'ManageWikiPermissionsAdditionalRemoveGroupsSelf' )[$perm->perm_group] ?? [] ), + 'autopromote' => json_decode( $perm->perm_autopromote ?? '', true ) ]; }