PMC-402
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\workflow\src\ProcessMaker\Util\Helpers;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
class ChangeAbbreviationOfDirectives extends TestCase
|
||||
{
|
||||
/**
|
||||
* Provider to define different types of configurations in the php.ini and the result expected
|
||||
*/
|
||||
public function provider()
|
||||
{
|
||||
return [
|
||||
['1024K','1024KB'],
|
||||
['600M','600MB'],
|
||||
['5G','5GB'],
|
||||
['10T','10Bytes'],
|
||||
['250','250Bytes']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the function is changed correctly the possibles directives defined in the php.ini
|
||||
*
|
||||
* @link https://www.php.net/manual/es/faq.using.php#faq.using.shorthandbytes
|
||||
*
|
||||
* @param string $configuration
|
||||
* @param string $expected
|
||||
*
|
||||
* @dataProvider provider
|
||||
* @test
|
||||
*/
|
||||
public function it_should_change_abbreviation_of_directives($configuration, $expected)
|
||||
{
|
||||
$this->assertEquals($expected, changeAbbreviationOfDirectives($configuration));
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -18230,8 +18230,8 @@ msgstr "MEMBER OF"
|
||||
# TRANSLATION
|
||||
# LABEL/ID_MEMORY_LIMIT
|
||||
#: LABEL/ID_MEMORY_LIMIT
|
||||
msgid "Memory Limit (Mb)"
|
||||
msgstr "Memory Limit (Mb)"
|
||||
msgid "Memory Limit (MB)"
|
||||
msgstr "Memory Limit (MB)"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_MEMORY_LIMIT_VALIDATE
|
||||
@@ -21362,8 +21362,8 @@ msgstr "LDAP is optional"
|
||||
# TRANSLATION
|
||||
# LABEL/ID_PROCESSMAKER_REQUIREMENTS_MEMORYLIMIT
|
||||
#: LABEL/ID_PROCESSMAKER_REQUIREMENTS_MEMORYLIMIT
|
||||
msgid "Memory Limit >= 80M"
|
||||
msgstr "Memory Limit >= 80M"
|
||||
msgid "Memory Limit >= 80MB"
|
||||
msgstr "Memory Limit >= 80MB"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_PROCESSMAKER_REQUIREMENTS_MSSQL
|
||||
|
||||
2
workflow/engine/controllers/InstallerModule.php
Normal file → Executable file
2
workflow/engine/controllers/InstallerModule.php
Normal file → Executable file
@@ -295,7 +295,7 @@ class InstallerModule extends Controller
|
||||
|
||||
// memory limit verification
|
||||
$memory = (int)ini_get('memory_limit');
|
||||
$info->memory->version = $memory . 'M';
|
||||
$info->memory->version = changeAbbreviationOfDirectives(ini_get('memory_limit'));
|
||||
$info->memory->result = $memory > 255;
|
||||
|
||||
return $info;
|
||||
|
||||
@@ -59903,7 +59903,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_MEMBER','en','Member','2014-01-15') ,
|
||||
( 'LABEL','ID_MEMBERS','en','Members','2014-01-15') ,
|
||||
( 'LABEL','ID_MEMBER_OF','en','MEMBER OF','2014-01-15') ,
|
||||
( 'LABEL','ID_MEMORY_LIMIT','en','Memory Limit (Mb)','2014-01-15') ,
|
||||
( 'LABEL','ID_MEMORY_LIMIT','en','Memory Limit (MB)','2014-01-15') ,
|
||||
( 'LABEL','ID_MEMORY_LIMIT_VALIDATE','en','Memory Limit value has to be either a positive integer or -1','2017-04-05') ,
|
||||
( 'LABEL','ID_MENU_NAME','en','Enterprise Manager','2014-10-17') ,
|
||||
( 'LABEL','ID_MESSAGE','en','Message','2014-01-15') ,
|
||||
@@ -60439,7 +60439,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_GD','en','GD Support','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_LDAP','en','LDAP Support (*)','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_LDAP_OPTIONAL','en','LDAP is optional','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_MEMORYLIMIT','en','Memory Limit >= 80M','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_MEMORYLIMIT','en','Memory Limit >= 80MB','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_MSSQL','en','MSSQL Support (*)','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_MULTIBYTESTRING','en','Multibyte Strings Support','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_MYSQL','en','MySQL Support','2014-01-15') ,
|
||||
|
||||
5
workflow/engine/methods/users/usersEdit.php
Normal file → Executable file
5
workflow/engine/methods/users/usersEdit.php
Normal file → Executable file
@@ -19,6 +19,9 @@ $mul = substr($UPLOAD_MAX_SIZE, - 1);
|
||||
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
||||
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
|
||||
|
||||
//We need to use the following abbreviations: Bytes, KB, MB, GB
|
||||
$maxFileSize = changeAbbreviationOfDirectives(ini_get('upload_max_filesize'));
|
||||
|
||||
if ($postMaxSize < $uploadMaxSize) {
|
||||
$uploadMaxSize = $postMaxSize;
|
||||
}
|
||||
@@ -46,7 +49,7 @@ $oHeadPublisher = headPublisher::getSingleton();
|
||||
$oHeadPublisher->addExtJsScript('users/users', true); //adding a javascript file .js
|
||||
$oHeadPublisher->assign('USR_UID', $_GET['USR_UID']);
|
||||
$oHeadPublisher->assign('MODE', $_GET['MODE']);
|
||||
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ');
|
||||
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $maxFileSize . ') ');
|
||||
$oHeadPublisher->assign('SYSTEM_TIME_ZONE', $arraySystemConfiguration['time_zone']);
|
||||
$oHeadPublisher->assign('TIME_ZONE_DATA', array_map(function ($value) {
|
||||
return [$value, $value];
|
||||
|
||||
5
workflow/engine/methods/users/usersInit.php
Normal file → Executable file
5
workflow/engine/methods/users/usersInit.php
Normal file → Executable file
@@ -27,6 +27,9 @@ $mul = substr($UPLOAD_MAX_SIZE, - 1);
|
||||
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
||||
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
|
||||
|
||||
//We need to use the following abbreviations: Bytes, KB, MB, GB
|
||||
$maxFileSize = changeAbbreviationOfDirectives(ini_get('upload_max_filesize'));
|
||||
|
||||
if ($postMaxSize < $uploadMaxSize) {
|
||||
$uploadMaxSize = $postMaxSize;
|
||||
}
|
||||
@@ -58,7 +61,7 @@ $oHeadPublisher->assign('infoMode', true);
|
||||
$oHeadPublisher->assign('EDITPROFILE', 1);
|
||||
$oHeadPublisher->assign('canEdit', $canEdit);
|
||||
$oHeadPublisher->assign('canEditCalendar', $canEditCalendar);
|
||||
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ');
|
||||
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $maxFileSize . ') ');
|
||||
$oHeadPublisher->assign('MODE', '');
|
||||
$oHeadPublisher->assign('SYSTEM_TIME_ZONE', $arraySystemConfiguration['time_zone']);
|
||||
$oHeadPublisher->assign('TIME_ZONE_DATA', array_map(function ($value) {
|
||||
|
||||
5
workflow/engine/methods/users/usersNew.php
Normal file → Executable file
5
workflow/engine/methods/users/usersNew.php
Normal file → Executable file
@@ -16,6 +16,9 @@ $mul = substr($UPLOAD_MAX_SIZE, - 1);
|
||||
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
||||
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
|
||||
|
||||
//We need to use the following abbreviations: Bytes, KB, MB, GB
|
||||
$maxFileSize = changeAbbreviationOfDirectives(ini_get('upload_max_filesize'));
|
||||
|
||||
if ($postMaxSize < $uploadMaxSize) {
|
||||
$uploadMaxSize = $postMaxSize;
|
||||
}
|
||||
@@ -44,7 +47,7 @@ $oHeadPublisher = headPublisher::getSingleton();
|
||||
$oHeadPublisher->addExtJsScript('users/users', true); //adding a javascript file .js
|
||||
$oHeadPublisher->assign('USR_UID', '');
|
||||
$oHeadPublisher->assign('MODE', $_GET['MODE']);
|
||||
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ');
|
||||
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $maxFileSize . ') ');
|
||||
$oHeadPublisher->assign('SYSTEM_TIME_ZONE', $arraySystemConfiguration['time_zone']);
|
||||
$oHeadPublisher->assign('TIME_ZONE_DATA', array_map(function ($value) {
|
||||
return [$value, $value];
|
||||
|
||||
@@ -196,7 +196,7 @@ class FilesLogs extends Files
|
||||
*/
|
||||
private function size($size, $format = null)
|
||||
{
|
||||
$sizes = ['Bytes', 'Kbytes', 'Mbytes', 'Gbytes', 'Tbytes', 'Pbytes', 'Ebytes', 'Zbytes', 'Ybytes'];
|
||||
$sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
if ($format === null) {
|
||||
$format = ' % 01.2f % s';
|
||||
}
|
||||
|
||||
23
workflow/engine/src/ProcessMaker/Util/helpers.php
Normal file → Executable file
23
workflow/engine/src/ProcessMaker/Util/helpers.php
Normal file → Executable file
@@ -450,6 +450,29 @@ function replacePrefixes($outDocFilename, $prefix = '@=')
|
||||
return $outDocFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the abbreviation of directives used in the php.ini configuration
|
||||
*
|
||||
* @param string $size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function changeAbbreviationOfDirectives($size)
|
||||
{
|
||||
$sizeValue = (int)$size;
|
||||
|
||||
switch (substr($size, -1)) {
|
||||
case 'K':
|
||||
return $sizeValue . 'KB';
|
||||
case 'M':
|
||||
return $sizeValue . 'MB';
|
||||
case 'G':
|
||||
return $sizeValue . 'GB';
|
||||
default:
|
||||
return $sizeValue . 'Bytes';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encoding header filename used in Content-Disposition
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user