Skip to content

Commit

Permalink
# [joomla#28280] Regression in the com_installer warnings. Thanks Ro…
Browse files Browse the repository at this point in the history
…uven
  • Loading branch information
realityking authored and infograf768 committed Mar 22, 2012
1 parent f6f375c commit 3448e18
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
38 changes: 29 additions & 9 deletions administrator/components/com_installer/models/warnings.php
Expand Up @@ -6,10 +6,8 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access
defined('_JEXEC') or die;

// Import library dependencies
jimport('joomla.application.component.modellist');
jimport('joomla.filesystem.folder');

Expand All @@ -28,6 +26,32 @@ class InstallerModelWarnings extends JModelList
*/
var $type = 'warnings';

/**
* Return the byte value of a particular string.
*
* @param string String optionally with G, M or K suffix
*
* @return int size in bytes
*
* @since 1.6
*/
function return_bytes($val)
{
$val = trim($val);
$last = strtolower($val{strlen($val)-1});
switch($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1024;
case 'm':
$val *= 1024;
case 'k':
$val *= 1024;
}

return $val;
}

/**
* Load the data.
*
Expand Down Expand Up @@ -66,19 +90,16 @@ function getItems()
}
}

//$memory_limit = $this->return_bytes(ini_get('memory_limit'));
$memory_limit = JHtml::_('number.bytes', ini_get('memory_limit'));
$memory_limit = $this->return_bytes(ini_get('memory_limit'));
if ($memory_limit < (8 * 1024 * 1024)) { // 8MB
$messages[] = array('message'=>JText::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYWARN'), 'description'=>JText::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYDESC'));
} elseif ($memory_limit < (16 * 1024 * 1024)) { //16MB
$messages[] = array('message'=>JText::_('COM_INSTALLER_MSG_WARNINGS_MEDMEMORYWARN'), 'description'=>JText::_('COM_INSTALLER_MSG_WARNINGS_MEDMEMORYDESC'));
}


//$post_max_size = $this->return_bytes(ini_get('post_max_size'));
$post_max_size = JHtml::_('number.bytes', ini_get('post_max_size'));
//$upload_max_filesize = $this->return_bytes(ini_get('upload_max_filesize'));
$upload_max_filesize = JHtml::_('number.bytes', ini_get('upload_max_filesize'));
$post_max_size = $this->return_bytes(ini_get('post_max_size'));
$upload_max_filesize = $this->return_bytes(ini_get('upload_max_filesize'));

if($post_max_size < $upload_max_filesize)
{
Expand All @@ -95,7 +116,6 @@ function getItems()
$messages[] = array('message'=>JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZE'), 'description'=>JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZEDESC'));
}


return $messages;
}
}
1 change: 1 addition & 0 deletions installation/CHANGELOG
Expand Up @@ -28,6 +28,7 @@ $ -> Language fix or change

22-Mar-2012 Jean-Marie Simonet
$ Updating installation ini files cbq-IQ, de-DE, sv-SE
# [#28280] Regression in the com_installer warnings. Thanks Rouven

21-Mar-2012 Jean-Marie Simonet
$ Updating installation ini files af-ZA, ar-AA, az-AZ, bg-BG, hr-HR, ro-RO
Expand Down

0 comments on commit 3448e18

Please sign in to comment.