/** * Formats a file value into a human readable format * * @param string $string * @return \mithra62\string */ public function m62FileSize($string, $html = true) { if ($string == '') { return $this->m62Lang('na'); } $formatted_size = $this->file->filesizeFormat($string); $return = ''; if ($html) { $return = '<span class="backup_pro_filesize" title="' . number_format($string) . ' bytes">' . $formatted_size . '</span>'; } else { $return = $formatted_size; } return $return; }
/** * Inspects the system and returns an array prototype that includes the details per configuration * @param bool $auto_threshold Whether to compile for viewing or use * @param array $backups The existing backups on the system to use for determining data * @return multitype:number */ public function getAvailableSpace($auto_threshold = false, array $backups) { $options = array('available_space' => 0, 'available_space_raw' => 0, 'available_percentage' => 0, 'max_space' => 0); $meta = $this->getBackupMeta($backups); if ($auto_threshold) { $return = $options; $return['available_space_raw'] = $auto_threshold - $meta['global']['total_space_used_raw']; $return['available_space'] = $this->file->filesizeFormat($return['available_space_raw']); $percentage = $meta['global']['total_space_used_raw'] / $auto_threshold * 100; $return['available_percentage'] = round(100 - $percentage, 2); $return['max_space'] = $this->file->filesizeFormat($auto_threshold); } else { $return = $options; } return $return; }
/** * Formats a file value into a human readable format * @param string $string * @return \mithra62\string */ public function m62FileSize($string) { return $this->file->filesizeFormat($string); }