// Check the password "remember me" box by default (sitewide)
$wgHooks['AuthChangeFormFields'][] = function (
$requests, $fieldInfo, &$formDescriptor, $action
) {
$formDescriptor['rememberMe'] = [
'type' => 'check',
'default' => true
];
return true;
};
// Regulate upload based on file size and user group membership. ( [[Topic:Vncn3vixhr79d5pu]] )
$wgHooks['UploadVerifyUpload'][] = function (
UploadBase $upload, User $user, $props, $comment, $pageText, &$error
) {
$userGroups = $user->getGroups();
$fileSize = $upload->getFileSize();
$mb = 1024 * 1024;
if ( !in_array( 'sysop', $userGroups ) &&
!in_array( 'bureaucrat', $userGroups ) ) {
// This user is not a sysop and not a bureaucrat.
// If the file is greater than 2 MB, prevent upload.
if ( $fileSize > $mb * 2 ) {
$error = [ 'file-too-large' ];
}
}
if ( in_array( 'sysop', $userGroups ) ) {
// 25MB for sysops, else prevent upload
if ( $fileSize > $mb * 25 ) {
$error = [ 'file-too-large' ];
}
}
if ( in_array( 'bureaucrat', $userGroups ) ) {
// 5MB for bureaucrats, else prevent upload
if ( $fileSize > $mb * 5 ) {
$error = [ 'file-too-large' ];
}
}
};