// preference admin controller updated and tools convertbyte too

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11623 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
vChabot
2011-12-22 15:56:34 +00:00
parent 60fd01ec60
commit 99007ec463
2 changed files with 6 additions and 5 deletions
@@ -385,14 +385,15 @@ class AdminPreferencesControllerCore extends AdminController
/**
* Update PS_ATTACHMENT_MAXIMUM_SIZE
*/
public function updateOptionPsAttachementMaximumSize($value)
public function updateOptionPsAttachmentMaximumSize($value)
{
if (!$value)
return;
$upload_max_size = (int)str_replace('M', '', ini_get('upload_max_filesize'));
$post_max_size = (int)str_replace('M', '', ini_get('post_max_size'));
$max_size = $upload_max_size < $post_max_size ? $upload_max_size : $post_max_size;
$upload_max_size = Tools::convertBytes(ini_get('upload_max_filesize'));
$post_max_size = Tools::convertBytes(ini_get('post_max_size'));
$max_size = ($upload_max_size < $post_max_size ? $upload_max_size : $post_max_size) / 1048576;
// at this point, all values are in megaBytes
$value = ($max_size < Tools::getValue('PS_ATTACHMENT_MAXIMUM_SIZE')) ? $max_size : Tools::getValue('PS_ATTACHMENT_MAXIMUM_SIZE');
Configuration::update('PS_ATTACHMENT_MAXIMUM_SIZE', $value);
}