Delete the corresponding row from the database Delete the corresponding directory from the server */ if (!$frsrf->delete_release($group_id, $release_id)) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('file_admin_editreleases', 'rel_not_yours')); } else { $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('file_admin_editreleases', 'rel_del')); } } $GLOBALS['Response']->redirect('/file/?group_id=' . $group_id); break; case 'add': $release = new FRSRelease(); $release->setPackageId($package_id); $release->setStatusId($frsrf->STATUS_ACTIVE); $release->setReleaseDate(time()); frs_display_release_form($is_update = false, $release, $group_id, $Language->getText('file_admin_editreleases', 'create_new_release'), '?func=create&postExpected=&group_id=' . $group_id . '&package_id=' . $package_id); break; case 'create': if ($request->exist('cancel')) { $GLOBALS['Response']->addFeedback('info', $Language->getText('file_admin_editreleases', 'create_canceled')); $GLOBALS['Response']->redirect('/file/?group_id=' . $group_id); } else { frs_process_release_form($is_update = false, $request, $group_id, $Language->getText('file_admin_editreleases', 'release_new_file_version'), '?func=create&postExpected=&group_id=' . $group_id . '&package_id=' . $package_id); } break; case 'edit': if ($request->valid(new Valid_UInt('id'))) { $release_id = $request->get('id'); if ($release =& $frsrf->getFRSReleaseFromDb($release_id, $group_id)) { frs_display_release_form($is_update = true, $release, $group_id, $Language->getText('file_admin_editreleases', 'edit_release'), '?func=update&postExpected=&group_id=' . $group_id . '&package_id=' . $package_id . '&id=' . $release_id);
private function importRelease(Project $project, FRSPackage $package, SimpleXMLElement $xml_rel, $extraction_path) { $user = $this->user_finder->getUser($xml_rel->user); $attrs = $xml_rel->attributes(); $release = new FRSRelease(); $release->setProject($project); $release->setReleaseDate(strtotime($attrs['time'])); $release->setName((string) $attrs['name']); $release->setStatusID(FRSRelease::STATUS_ACTIVE); $release->setPackageID($package->getPackageID()); $release->setNotes((string) $xml_rel->notes); $release->setChanges((string) $xml_rel->changes); $release->setPreformatted($attrs['preformatted'] == '1' || $attrs['preformatted'] == 'true'); $release->setReleasedBy($user->getId()); $release->setReleaseID($this->release_factory->create($release->toArray())); $read_perms = array(); foreach ($xml_rel->{'read-access'} as $perm) { $ugroup_name = (string) $perm->ugroup; $ugroup = $this->getUGroupManager()->getUGroupByName($project, $ugroup_name); $read_perms[] = $ugroup->getId(); } $this->getPermissionsManager()->savePermissions($project, $release->getReleaseID(), FRSRelease::PERM_READ, $read_perms); foreach ($xml_rel->xpath('file') as $xml_file) { $this->importFile($project, $release, $user, $xml_file, $extraction_path); } }