Хранилища Subversion ant

Сравнить редакции

Не учитывать пробелы Редакция 667 → Редакция 668

/branches/ant/0.9.x/lib/core.php
598,8 → 598,7
* @param array $data
* @return string
*/
public function showSourcesList($data) {
//TODO Написать генератор sources.list
public function showSourcesList($data) {
// Извлекаем информацию о дистрибутиве и его версии
$query = "SELECT * FROM ".$this->prefix."distribution d ";
$query .= "JOIN ".$this->prefix."version v ON v.dist_id=d.dist_id ";
678,12 → 677,97
while ($rq->fetchInto($sections)) {
$show .= $sections["secname"]." ";
}
$show .= "\n";
$show .= "\n\n";
}
$show .= "\n";
} else {
// Базовый репозиторий
$query = "SELECT * FROM ".$this->prefix."repository r ";
$query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id ";
$query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id ";
$query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id ";
$query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id ";
$query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id ";
$query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id ";
$query .= "WHERE v.version_id='".$data["version_id"]."' AND r.rtype_id='1'";
$rq =& $this->db->query($query);
$rq->fetchInto($base);
// Формируем type proto://host/folder
$show .= "# ".$this->secure->checkStr($base["repinfo"],1)."\n";
$show .= $this->secure->checkStr($dist["type"],1)." ";
if ($base["sign_id"]!=0) {
$query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$base["sign_id"]."'";
$rq =& $this->db->query($query);
$rq->fetchInto($sign);
$show .= "[".$this->secure->checkStr($sign["sign"],1)."] ";
}
$show .= $this->secure->checkStr($base["proto"],1).$this->secure->checkStr($base["rhost"],1).$this->secure->checkStr($base["rfolder"],1)." ";
$show .= $this->secure->checkStr($base["scheme"],1);
 
// Формируем sections
$query = "SELECT * FROM ".$this->prefix."section s ";
$query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id ";
$query .= "WHERE r.rep_id='".$base["rep_id"]."' AND (";
for($i=0;$i<count($data["section"]);$i++) {
$query .= "s.sect_id='".$data["section"][$i]."' ";
if ($i<count($data["section"])-1) {
$query .= " OR ";
}
}
$query .= ")";
$rq =& $this->db->query($query);
while ($rq->fetchInto($sections)) {
$show .= $sections["secname"]." ";
}
$show .= "\n\n";
 
// Репозитории обновлений и третьих лиц
$query = "SELECT * FROM ".$this->prefix."repository r ";
$query .= "JOIN ".$this->prefix."protos p ON r.proto_id=p.proto_id ";
$query .= "JOIN ".$this->prefix."rephost h ON r.rhost_id=h.rhost_id ";
$query .= "JOIN ".$this->prefix."repfolder f ON r.rfolder_id=f.rfolder_id ";
$query .= "JOIN ".$this->prefix."version v ON r.version=v.version_id ";
$query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id ";
$query .= "JOIN ".$this->prefix."repscheme s ON r.scheme_id=s.scheme_id ";
$query .= "WHERE r.rtype_id>'1' AND (";
for($i=0;$i<count($data["repository"]);$i++) {
$query .= "r.rep_id='".$data["repository"][$i]."' ";
if ($i<count($data["repository"])-1) {
$query .= " OR ";
}
}
$query .= ") ORDER BY r.rtype_id ASC";
$req =& $this->db->query($query);
while ($req->fetchInto($updates)) {
// Формируем type proto://host/folder
$show .= "# ".$this->secure->checkStr($updates["repinfo"],1)."\n";
$show .= $this->secure->checkStr($dist["type"],1)." ";
if ($updates["sign_id"]!=0) {
$query = "SELECT * FROM ".$this->prefix."signs WHERE sign_id='".$base["sign_id"]."'";
$rqs =& $this->db->query($query);
$rqs->fetchInto($sign);
$show .= "[".$this->secure->checkStr($sign["sign"],1)."] ";
}
$show .= $this->secure->checkStr($updates["proto"],1).$this->secure->checkStr($updates["rhost"],1).$this->secure->checkStr($updates["rfolder"],1)." ";
$show .= $this->secure->checkStr($updates["scheme"],1);
// Формируем sections
$query = "SELECT * FROM ".$this->prefix."section s ";
$query .= "JOIN ".$this->prefix."sect2rep r ON s.sect_id=r.sect_id ";
$query .= "WHERE r.rep_id='".$updates["rep_id"]."'";
$rq =& $this->db->query($query);
while ($rq->fetchInto($sections)) {
$show .= $sections["secname"]." ";
}
$show .= "\n\n";
}
$show .= "\n";
}
 
$HTTPHeader1 = "Content-length: ".strlen($show);
$HTTPHeader2 = "Content-disposition: attachment; filename=sources.list\n\n";
 
header($HTTPHeader1);
header($HTTPHeader2);
return $show;
}