Пример #1
0
 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);
     }
 }