Skip to content

Commit

Permalink
Remove the 'format' quota parameter
Browse files Browse the repository at this point in the history
It's confusing to describe, and the order of the parameters is hardwired
so it's not really configurable.

This can just as easily be changed via gettext anyway, if someone really
wants to do it.
  • Loading branch information
slusarz committed Oct 11, 2013
1 parent 76147db commit 70792b0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 31 deletions.
17 changes: 0 additions & 17 deletions imp/config/backends.php
Expand Up @@ -111,23 +111,6 @@
* - hide_when_unlimited: (boolean) True if you want to hide quota
* output when the server reports an unlimited
* quota.
* - format: (array) Specifies the formats of the quota messages displayed
* to the user. The array must contain the following four keys:
* - long
* - short
* - nolimit_long
* - nolimit_short
* The values for each of these keys are strings that will be
* passed through PHP's sprintf() command.
*
* The default values for each key is as follows (these might
* appear slightly different based on the current language;
* [UNIT] will be replaced with the value of the 'unit'
* parameter):
* - long: Quota status: %.2f [UNIT] / %.2f [UNIT] (%.2f%%)
* - nolimit_long: Quota status: %.2f [UNIT] / NO LIMIT
* - short: %.0f%% of %.0f [UNIT]
* - nolimit_short: %.0f [UNIT]
* - unit: (string) What storage unit the quota messages should be
* displayed in. One of:
* - GB
Expand Down
8 changes: 7 additions & 1 deletion imp/docs/UPGRADING
Expand Up @@ -30,7 +30,13 @@ outdated.


Upgrading IMP From 6.1.x To 6.2
=================================
===============================

Server Options (backends.php)
-----------------------------

The 'format' quota option has been removed.


Configuration Options (conf.php)
--------------------------------
Expand Down
22 changes: 9 additions & 13 deletions imp/lib/Quota.php
Expand Up @@ -36,25 +36,21 @@ abstract class IMP_Quota
* Constructor.
*
* @param array $params Parameters:
* - format: (string) The formats of the quota messages in the user
* interface. Must be a hash with the four possible elements
* 'long', 'short', 'nolimit_long', and 'nolimit_short'. The
* strings will be passed through sprintf().
* - unit: (string) What storage unit the quota messages should be
* displayed in. Either 'GB', 'MB', or 'KB'.
* - username: (string) The username to query.
*/
public function __construct(array $params = array())
{
$this->_params = array_merge($this->_params, $params);

$this->_params['format'] = array(
'short' => isset($this->_params['format']['short'])
? $this->_params['format']['short']
: _("%.0f%% of %.0f %s"),
'nolimit_short' => isset($this->_params['format']['nolimit_short'])
? $this->_params['format']['nolimit_short']
: _("%.0f %s")
$this->_params = array_merge(
$this->_params,
array(
'format' => array(
'nolimit_short' => _("%.0f %s"),
'short' => _("%.0f%% of %.0f %s")
)
),
$params
);
}

Expand Down

0 comments on commit 70792b0

Please sign in to comment.