Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
b775bf71
Unverified
Commit
b775bf71
authored
4 years ago
by
Eileen McNaughton
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #19382 from totten/master-maxfile
"Admin => Misc" - Fix validation of "Maximum File Size"
parents
6fea2a85
daebb75b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Admin/Form/Setting/Miscellaneous.php
+7
-5
7 additions, 5 deletions
CRM/Admin/Form/Setting/Miscellaneous.php
with
7 additions
and
5 deletions
CRM/Admin/Form/Setting/Miscellaneous.php
+
7
−
5
View file @
b775bf71
...
...
@@ -44,13 +44,10 @@ class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting {
'prevNextBackend'
=>
CRM_Core_BAO_Setting
::
SEARCH_PREFERENCES_NAME
,
];
public
$_uploadMaxSize
;
/**
* Basic setup.
*/
public
function
preProcess
()
{
$this
->
_uploadMaxSize
=
(
int
)
ini_get
(
'upload_max_filesize'
);
// check for post max size
CRM_Utils_Number
::
formatUnitSize
(
ini_get
(
'post_max_size'
),
TRUE
);
// This is a temp hack for the fact we really don't need to hard-code each setting in the tpl but
...
...
@@ -101,8 +98,13 @@ class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting {
$errors
=
[];
// validate max file size
if
(
$fields
[
'maxFileSize'
]
>
$options
->
_uploadMaxSize
)
{
$errors
[
'maxFileSize'
]
=
ts
(
"Maximum file size cannot exceed Upload max size ('upload_max_filesize') as defined in PHP.ini."
);
$iniBytes
=
CRM_Utils_Number
::
formatUnitSize
(
ini_get
(
'upload_max_filesize'
),
FALSE
);
$inputBytes
=
CRM_Utils_Number
::
formatUnitSize
(
$fields
[
'maxFileSize'
]
.
'M'
,
FALSE
);
if
(
$inputBytes
>
$iniBytes
)
{
$errors
[
'maxFileSize'
]
=
ts
(
"Maximum file size cannot exceed limit defined in
\"
php.ini
\"
(
\"
upload_max_filesize=%1
\"
)."
,
[
1
=>
ini_get
(
'upload_max_filesize'
),
]);
}
// validate recent items stack size
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment