/** * Checks various php.ini values and the maximum file size to determine * the maximum size chunks a file can be split up into for upload * * @return int */ public function get_chunk_size() { $max = min($this->php_ini->getBytes('upload_max_filesize'), $this->php_ini->getBytes('post_max_size'), max(1, $this->php_ini->getBytes('memory_limit')), $this->config['max_filesize']); // Use half of the maximum possible to leave plenty of room for other // POST data. return floor($max / 2); }
/** * Filling up system_data array */ protected function setup_system_data() { // Query maximum runtime from php.ini $execution_time = $this->php_ini->getNumeric('max_execution_time'); $execution_time = min(15, $execution_time / 2); $this->system_data['max_execution_time'] = $execution_time; // Set start time $this->system_data['start_time'] = microtime(true); // Get memory limit $this->system_data['memory_limit'] = $this->php_ini->getBytes('memory_limit'); }
/** * アップロードできるファイルの最大バイト数を取得します。 * @return int */ protected function getMaxFileBytes() : int { $iniGetWrapper = new IniGetWrapper(); return min($iniGetWrapper->getBytes('upload_max_filesize'), $iniGetWrapper->getBytes('post_max_size'), $iniGetWrapper->getBytes('memory_limit')); }
/** * @return array (string => string|int) */ public function getData() { return ['version' => $this->cleanVersion(PHP_VERSION), 'memory_limit' => $this->phpIni->getBytes('memory_limit'), 'max_execution_time' => $this->phpIni->getNumeric('max_execution_time'), 'upload_max_filesize' => $this->phpIni->getBytes('upload_max_filesize')]; }