--- module_builder.api.inc.orig 2008-01-02 03:49:33.000000000 +0100 +++ module_builder.api.inc 2008-03-26 14:02:26.000000000 +0100 @@ -173,17 +173,31 @@ $edit = unserialize(db_result(db_query("SELECT data FROM {module_builder_data} WHERE type = '%s' AND mid = %d", 'edit', $module->mid))); $module = (object) ((array) $module + (array) $edit + array('description' => '', 'machine' => '')); if ($file == 'info') { - header('Content-disposition: attachment'); + header('Content-disposition: attachment; filename="'.$module->machine.'.info"'); print _module_builder_export_info($module); exit(); } elseif ($file == 'module') { - header('Content-disposition: attachment'); + header('Content-disposition: attachment; filename="'.$module->machine.'.module"'); print _module_builder_export_module($module); exit(); } elseif ($file == 'tar') { - + include_once(drupal_get_path('module', 'module_builder') .'/archive_tar/archive_tar.php'); + $tarname = file_directory_path().'/'.$module->machine.'.tar.gz'; + $tarchive = new Archive_Tar($tarname, 'gz'); + if ($tarchive->addString($module->machine.'/'.$module->machine.'.info', _module_builder_export_info($module)) && + $tarchive->addString($module->machine.'/'.$module->machine.'.module', _module_builder_export_module($module))) { + header('Content-type: application/x-gzip'); + header('Content-disposition: attachment; filename="'.$module->machine.'.tar.gz"'); + print file_get_contents($tarname); + unlink($tarname); + exit(); + } + else { + drupal_set_message('Creating GZ compressed TAR archive failed.', 'error'); + drupal_not_found(); + } } else { drupal_not_found(); --- module_builder.components.inc.orig 2008-01-02 03:49:33.000000000 +0100 +++ module_builder.components.inc 2008-03-26 14:02:26.000000000 +0100 @@ -310,15 +310,14 @@ if (!module_builder_archive_tar_enabled()) { $form['note'] = array( '#type' => 'item', - '#value' => t('Several file downloads have started. Please put them all in a single directory, %dir.', array('%dir' => unserialize(db_result(db_query("SELECT data FROM {module_builder_data} WHERE mid = '%d' AND type = '%s'", menu_get_object('module_builder', 4)->mid, 'edit')))->machine)), + '#value' => t('The module skeleton has been generated. Please download the files below and put them in a single directory, %dir.', array('%dir' => unserialize(db_result(db_query("SELECT data FROM {module_builder_data} WHERE mid = '%d' AND type = '%s'", menu_get_object('module_builder', 4)->mid, 'edit')))->machine)), ); $form['info_file'] = array( - '#value' => '', - '#prefix' => '
', + '#value' => '.module file', ); $form['enhanced'] = array( '#type' => 'item', @@ -326,6 +325,13 @@ ); } else { + $form['note'] = array( + '#type' => 'item', + '#value' => t('The module skeleton has been generated. Click below to download a GZipped TAR archive of the module directory.'), + ); + $form['tar_file'] = array( + '#value' => '.tar.gz file', + ); } return $form; }