HOR-767 Modificar el endpoint de /light/config para obtener el maximum file upload del php.ini

fix in old code
This commit is contained in:
Ronald Q
2016-04-15 12:18:50 -04:00
parent 6a31bd4b0d
commit 82153c0159
2 changed files with 26 additions and 3 deletions

View File

@@ -1255,7 +1255,7 @@ class Light
* Get configuration
* @return mixed
*/
public function getConfiguration()
public function getConfiguration($params)
{
$sysConf = \Bootstrap::getSystemConfiguration('','',SYS_SYS);
$multiTimeZone = false;
@@ -1304,9 +1304,29 @@ class Light
$languagesList[] = $languages;
}
$response['listLanguage'] = $languagesList;
if ($params['fileLimit']) {
$response['fileLimit'] = $this->return_bytes(ini_get('post_max_size'));
}
return $response;
}
public function return_bytes($size_str)
{
switch (substr($size_str, -1)) {
case 'M':
case 'm':
return (int)$size_str * 1048576;
case 'K':
case 'k':
return (int)$size_str * 1024;
case 'G':
case 'g':
return (int)$size_str * 1073741824;
default:
return $size_str;
}
}
public function getInformationDerivatedCase($app_uid, $del_index)
{
$oCriteria = new Criteria( 'workflow' );

View File

@@ -1498,12 +1498,15 @@ class Light extends Api
*
* @access public
* @url GET /config
*
* @param string $fileLimit {@from path}
*/
public function getConfiguration()
public function getConfiguration($fileLimit = false)
{
try {
$params = array('fileLimit' => $fileLimit);
$oMobile = new \ProcessMaker\BusinessModel\Light();
$response = $oMobile->getConfiguration();
$response = $oMobile->getConfiguration($params);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}