10^x|1024->2^x] $s = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'); $e = floor(log($bytes, $convention)); return round($bytes/pow($convention, $e), 2) . ' ' . $s[$e]; } } function backup_sync_package_php() { global $config; if ($config['installedpackages']['backup']['config'] != "") { conf_mount_rw(); foreach ($config['installedpackages']['backup']['config'] as $rowhelper) { if ($rowhelper['enabled'] != "false") { //$tmp_php = base64_decode($rowhelper['php']); if (strlen($tmp_php) > 0) { $tmp .= "// name: " . $rowhelper['name'] . " \n"; $tmp .= "// description: " . $rowhelper['description'] . " \n\n"; $tmp .= base64_decode($rowhelper['php']); $tmp .= "\n"; } } } conf_mount_ro(); } } function backup_sync_package() { global $config; backup_sync_package_php(); } function backup_install_command() { global $config; conf_mount_rw(); //create the backup directory if (!is_dir('/root/backup/')) { @mkdir("/root/backup/"); } backup_sync_package(); conf_mount_ro(); } ?>