diff options
author | Paul Arthur <paul.arthur@flowerysong.com> | 2013-01-26 03:00:32 -0500 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2013-01-26 03:38:46 -0500 |
commit | ef4d3660605efc7f1328d4533b0f4bfb6c1107e2 (patch) | |
tree | e4377fb129a899e65aaaf421f8c97098aecaedd5 /lib/batch.lib.php | |
parent | 8a750c3e875d590d351c3042570a134fcdf03e5d (diff) | |
download | ampache-ef4d3660605efc7f1328d4533b0f4bfb6c1107e2.tar.gz ampache-ef4d3660605efc7f1328d4533b0f4bfb6c1107e2.tar.bz2 ampache-ef4d3660605efc7f1328d4533b0f4bfb6c1107e2.zip |
Cosmetics: death to tabs
The refactoring I've been doing has reminded me of my strong preference
for spaces, and I feel inclined to impose my will on the tree.
Diffstat (limited to 'lib/batch.lib.php')
-rw-r--r-- | lib/batch.lib.php | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/lib/batch.lib.php b/lib/batch.lib.php index b9f20875..bd6be0a1 100644 --- a/lib/batch.lib.php +++ b/lib/batch.lib.php @@ -1,5 +1,5 @@ <?php -/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */ +/* vim:set softtabstop=4 shiftwidth=4 expandtab: */ /** * * LICENSE: GNU General Public License, version 2 (GPLv2) @@ -25,24 +25,24 @@ * * Takes an array of song ids and returns an array of the actual filenames * - * @param array $media_ids Media IDs. + * @param array $media_ids Media IDs. */ function get_song_files($media_ids) { - $media_files = array(); + $media_files = array(); - foreach ($media_ids as $element) { - if (is_array($element)) { - $type = array_shift($element); - $media = new $type(array_shift($element)); - } - else { - $media = new Song($element); - } - if ($media->enabled) { - $total_size += sprintf("%.2f",($media->size/1048576)); - array_push($media_files, $media->file); - } + foreach ($media_ids as $element) { + if (is_array($element)) { + $type = array_shift($element); + $media = new $type(array_shift($element)); + } + else { + $media = new Song($element); + } + if ($media->enabled) { + $total_size += sprintf("%.2f",($media->size/1048576)); + array_push($media_files, $media->file); + } } return array($media_files,$total_size); @@ -54,51 +54,51 @@ function get_song_files($media_ids) { * takes array of full paths to songs * zips them and sends them * - * @param string $name name of the zip file to be created - * @param string $song_files array of full paths to songs to zip create w/ call to get_song_files + * @param string $name name of the zip file to be created + * @param string $song_files array of full paths to songs to zip create w/ call to get_song_files */ function send_zip( $name, $song_files ) { - // Check if they want to save it to a file, if so then make sure they've - // got a defined path as well and that it's writable. - if (Config::get('file_zip_download') && Config::get('file_zip_path')) { - // Check writeable - if (!is_writable(Config::get('file_zip_path'))) { - $in_memory = '1'; - debug_event('Error','File Zip Path:' . Config::get('file_zip_path') . ' is not writable','1'); - } - else { - $in_memory = '0'; - $basedir = Config::get('file_zip_path'); - } + // Check if they want to save it to a file, if so then make sure they've + // got a defined path as well and that it's writable. + if (Config::get('file_zip_download') && Config::get('file_zip_path')) { + // Check writeable + if (!is_writable(Config::get('file_zip_path'))) { + $in_memory = '1'; + debug_event('Error','File Zip Path:' . Config::get('file_zip_path') . ' is not writable','1'); + } + else { + $in_memory = '0'; + $basedir = Config::get('file_zip_path'); + } - } else { - $in_memory = '1'; - } // if file downloads + } else { + $in_memory = '1'; + } // if file downloads - /* Require needed library */ + /* Require needed library */ require_once Config::get('prefix') . '/modules/archive/archive.lib.php'; $arc = new zip_file( $name . ".zip" ); $options = array( 'inmemory' => $in_memory, // create archive in memory - 'basedir' => $basedir, + 'basedir' => $basedir, 'storepaths' => 0, // only store file name, not full path 'level' => 0, // no compression - 'comment' => Config::get('file_zip_comment') + 'comment' => Config::get('file_zip_comment') ); $arc->set_options( $options ); $arc->add_files( $song_files ); - if (count($arc->error)) { - debug_event('archive',"Error: unable to add songs",'3'); - return false; - } // if failed to add songs + if (count($arc->error)) { + debug_event('archive',"Error: unable to add songs",'3'); + return false; + } // if failed to add songs if (!$arc->create_archive()) { - debug_event('archive',"Error: unable to create archive",'3'); - return false; - } // if failed to create archive + debug_event('archive',"Error: unable to create archive",'3'); + return false; + } // if failed to create archive $arc->download_file(); |