Хранилища Subversion ant

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

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

/branches/ant/0.9.x/lib/core.php
600,7 → 600,54
*/
public function showSourcesList($data) {
//TODO Написать генератор sources.list
// Извлекаем информацию о дистрибутиве и его версии
$query = "SELECT * FROM ".$this->prefix."distribution d ";
$query .= "JOIN ".$this->prefix."version v ON v.version_id=d.version ";
$query .= "JOIN ".$this->prefix."dtype t ON d.disttype=t.type_id ";
$query .= "WHERE d.dist_id='".$data["dist_id"]."' AND d.version='".$data["version_id"]."'";
$rq =& $this->db->query($query);
$rq->fetchInto($dist);
 
header("content-type: text/plain\n\n");
$show = "# Список репозиториев для ".$this->secure->checkStr($dist["distname"],1)." ".$this->secure->checkStr($dist["version"],1)." ".$this->secure->checkStr($dist["vname"],1);
 
// Извлекаем информацию о репозиториях и строим sources.list
if ($dist["type"]=="deb") {
// Базовый репозиторий
$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=p.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 rtype_id='1'";
$rq =& $this->db->query($query);
$rq->fetchInto($base);
// Формируем type proto://host/folder
$show .= $this->secure->checkStr($dist["type"],1)." ".$this->secure->checkStr($dist["proto"],1).$this->secure->checkStr($dist["rhost"],1).$this->secure->checkStr($dist["rfolder"],1);
$dvname = str_replace("{DIST}",$this->secure->checkStr($dist["vcodename"],1),$this->secure->checkStr($dist["scheme"],1));
// Формируем distname
$show .= " ".$dvname." ";
// Формируем 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 .= "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";
 
}
 
return $show;
}