From 65663a24f14bf544c8391c169239d0811eed4ffb Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Mon, 27 Jun 2005 08:40:23 +0000 Subject: move and break, move and break --- lib/batch.lib.php | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 lib/batch.lib.php (limited to 'lib/batch.lib.php') diff --git a/lib/batch.lib.php b/lib/batch.lib.php new file mode 100644 index 00000000..f30f6f16 --- /dev/null +++ b/lib/batch.lib.php @@ -0,0 +1,66 @@ +status != 'disabled') { + $user->update_stats( $song_id ); + $total_size += sprintf("%.2f",($song->size/1048576)); + array_push( $song_files, $song->file ); + } // if song isn't disabled + } + return array($song_files,$total_size); +} //get_song_files + + +/** + * send_zip + * takes array of full paths to songs + * zips them and sends them + * @param $name name of the zip file to be created + * @param $song_files array of full paths to songs to zip create w/ call to get_song_files + */ +function send_zip( $name, $song_files ) { + + /* Require needed library */ + require_once(conf('prefix') . '/lib/archive.lib.php' ); + $arc = new zip_file( $name . ".zip" ); + $options = array( + 'inmemory' => 1, // create archive in memory + 'storepaths' => 0, // only store file name, not full path + 'level' => 0 // no compression + ); + $arc->set_options( $options ); + $arc->add_files( $song_files ); + $arc->create_archive(); + $arc->download_file(); + +} // send_zip +?> -- cgit