function test_database_zip_created() { $files = $this->tree->get_file_list_as_iterator(); $zip = new Signalfire_Cloud_Backup_Zip($files, WP_CONTENT_DIR . '/backups', 'database'); if ($path = $zip->create_zip_archive()) { $this->assertFileExists($path); unlink($path); } }
/** * Executes file backup and creates a zip. * * @since 1.0.0 * @param array $paths The paths array * @access public * @return boolean Returns if task executed successfully */ public function execute_file_backup($paths) { //Get instance of the file tree object for the provided path $tree = new Signalfire_Cloud_Backup_Filetree($paths['files']); //Get a list of files in the provided path $files = $tree->get_file_list_as_array(); //Check if there are any files to backup if (count($files) > 0) { //Get instance of the zip object passing in the files to zip, path to zip to and prefix //for filename of zio $zip = new Signalfire_Cloud_Backup_Zip($files, $paths['backup'], 'files'); //If the zip file was created successfully return path, otherwise return false if ($paths['zip'] = $zip->create_zip_archive()) { //Zip file was created, so return success for function return TRUE; } } //Function failed so return false return FALSE; }