/*!
\static
\return the maximum size for a log file in bytes.
490359
static function maxLogSize()
    {
        $maxLogSize =& $GLOBALS['eZMaxLogSize'];
        if ( isset( $maxLogSize ) )
        {
            return $maxLogSize;
        }
        else if ( defined( 'CUSTOM_LOG_MAX_FILE_SIZE' ) )
        {
            self::setMaxLogSize( (int)CUSTOM_LOG_MAX_FILE_SIZE );
            return (int)CUSTOM_LOG_MAX_FILE_SIZE;
        }
        return self::MAX_LOGFILE_SIZE;
    }
1341368
public function getSize()
    {
        if ($this->isDirty && $this->bytes) {
            return strlen($this->bytes);
        }
        if ($this->isDirty && $this->filename) {
            return filesize($this->filename);
        }
        if ($this->mongoGridFSFile instanceof \MongoGridFSFile) {
            return $this->mongoGridFSFile->getSize();
        }
        return 0;
    }
491232
def _CheckLogFileSize(cursor):
  """"""

  # Do not fail, because users might not be able to change this for their
  # database. Instead, warn the user about the impacts.

  innodb_log_file_size = int(_ReadVariable("innodb_log_file_size", cursor))
  required_size = 10 * mysql_blobs.BLOB_CHUNK_SIZE
  if innodb_log_file_size < required_size:
    # See MySQL error 1118: The size of BLOB/TEXT data inserted in one
    # transaction is greater than 10% of redo log size. Increase the redo log
    # size using innodb_log_file_size.
    max_blob_size = innodb_log_file_size / 10
    max_blob_size_mib = max_blob_size / 2**20
    logging.warning(
        "MySQL innodb_log_file_size of %d is required, got %d. "
        "Storing Blobs bigger than %.4f MiB will fail.", required_size,
        innodb_log_file_size, max_blob_size_mib)
111331
public function getMaxSize( $default = null ) {

		$prop = $this->properties[ self::PROP_MAX_SIZE ];

		if( isset( $prop ) && strlen( $prop ) > 0 ) {

			return $prop;
		}

		return $default;
	}
769150
public static function size($file = false, $format = 'bytes') {

        if ($file && self::isFile($file)) {

            $size = filesize($file);

            switch ($format) {
                case 'bytes':
                    return $size;
                    break;
                case 'kb':
                    return Number::round(($size / 1024), 2);
                    break;
                case 'mb':
                    return Number::round(($size / 1048576), 2);
                    break;
            }
        }

        return false;
    }
1354359
public function getMaxOpenFilesLimit()
    {
        static $limit = null;

        if (null === $limit) {
            $process = new Process('ulimit -n');
            $process->run();

            if ($process->isSuccessful()) {
                $limit = (int) trim($process->getOutput());
            }

            unset($process);
        }

        return $limit;
    }
1221471
protected function max($value, $rule)
    {
        if (is_array($value)) {
            $length=count($value);
        } elseif ($value instanceof File) {
            $length=$value->getSize();
        } else {
            $length=mb_strlen((string) $value);
        }
        return $length <= $rule;
    }
1015961
protected function getPostMaxSize()
    {
        $postMaxSize = ini_get('post_max_size');

        switch (substr($postMaxSize, -1)) {
            case 'M':
            case 'm':
                return (int) $postMaxSize * 1048576;
            case 'K':
            case 'k':
                return (int) $postMaxSize * 1024;
            case 'G':
            case 'g':
                return (int) $postMaxSize * 1073741824;
        }

        return (int) $postMaxSize;
    }
1045036
public function getRealFileSize($fileSize)
    {
        //B goes at the end because it's always matched otherwise
        $validUnits = ['KB', 'MB', 'GB', 'TB'];
        $value = str_replace(' ', '', $fileSize);

        $pattern = '/\d+/';
        preg_match($pattern, $value, $match);

        foreach ($validUnits as $unit) {
            if (strpos($fileSize, $unit)) {
                switch ($unit) {
                    case 'B':
                        return $match[0] * pow(1024, 0);
                    case 'KB':
                        return $match[0] * pow(1024, 1);
                    case 'MB':
                        return $match[0] * pow(1024, 2);
                    case 'GB':
                        return $match[0] * pow(1024, 3);
                    case 'TB':
                        return $match[0] * pow(1024, 4);
                }
            }
        }

        return $fileSize;
    }
1232609
public function getPostMaxSize()
    {
        $iniMax = strtolower($this->getNormalizedIniPostMaxSize());

        if ('' === $iniMax) {
            return;
        }

        $max = ltrim($iniMax, '+');
        if (0 === strpos($max, '0x')) {
            $max = \intval($max, 16);
        } elseif (0 === strpos($max, '0')) {
            $max = \intval($max, 8);
        } else {
            $max = (int) $max;
        }

        switch (substr($iniMax, -1)) {
            case 't': $max *= 1024;
            // no break
            case 'g': $max *= 1024;
            // no break
            case 'm': $max *= 1024;
            // no break
            case 'k': $max *= 1024;
        }

        return $max;
    }
1324889
function setMaxbytes($maxbytes) {
        global $CFG, $PAGE;
        $this->_options['maxbytes'] = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $maxbytes);
    }
379327
public static function getReadableSize($bytes)
    {
        $unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
        $exp = floor(log($bytes, 1024)) | 0;

        return round($bytes / (pow(1024, $exp)), 2) . " $unit[$exp]";
    }
206256
public function remainingBytes(): int
    {
        /** @var array $stat */
        $stat = \fstat($this->fp);
        /** @var int $pos */
        $pos = \ftell($this->fp);
        return (int) (
            PHP_INT_MAX & (
                (int) $stat['size'] - $pos
            )
        );
    }
853549
public int logFileSize()
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "logFileSize", this);
        if (tc.isEntryEnabled())
            Tr.exit(tc, "logFileSize", new Integer(_logFileSize));
        return _logFileSize;
    }
1341470
public function get_size()
  {
    if ( $this->file && $this->size === 0 ){
      $this->size = filesize($this->file);
    }
    return $this->size;
  }
402863
public function getArchiveSize() {
        if (!is_resource($this->zipFile)) {
            return strlen($this->zipData);
        }
        $filestat = fstat($this->zipFile);

        return $filestat['size'];
    }
311170
public static function max_upload_size()
    {
        // find max filesize value
        $max_filesize = parse_bytes(ini_get('upload_max_filesize'));
        $max_postsize = parse_bytes(ini_get('post_max_size'));

        if ($max_postsize && $max_postsize < $max_filesize) {
            $max_filesize = $max_postsize;
        }

        return $max_filesize;
    }