Ejemplo n.º 1
0
 protected function checkMaxPostSizeExceeded()
 {
     if (empty($_POST) && empty($_FILES)) {
         $postMaxSize = Number::configSizeToMB(ini_get('post_max_size'));
         $uploadMaxFileSize = Number::configSizeToMB(ini_get('upload_max_filesize'));
         $maxFileSize = $postMaxSize > $uploadMaxFileSize ? $uploadMaxFileSize : $postMaxSize;
         throw new Exception(sprintf(GO::t('maybeMaxUploadExceeded'), $maxFileSize));
     }
 }
Ejemplo n.º 2
0
 /**
  * Set the memory limit in MB if the given value is higher then the current limit.
  * 
  * Note: this may be blocked by the suhosin PHP module
  * 
  * @param int $mb
  * @return boolean
  */
 public static function setMemoryLimit($mb)
 {
     $max = \GO\Base\Util\Number::configSizeToMB(ini_get("memory_limit"));
     if ($mb > $max) {
         return ini_set("memory_limit", $mb . 'M');
     } else {
         return true;
     }
 }