Редакция 217 | Редакция 234 | К новейшей редакции | Весь файл | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 217 | Редакция 219 | ||
---|---|---|---|
Строка 22... | Строка 22... | ||
22 | 22 | ||
23 | 23 | ||
24 | class Core { |
24 | class Core { |
25 | 25 | ||
26 | function getSourceList($distro,$version,$repos,$dblink) { |
26 | function getSourceList($distro,$version,$repos,$dblink) { |
- | 27 | // TODO optimize this
|
|
- | 28 | if(count($repos)==0) return; |
|
27 | // Fetch settings
|
29 | // Fetch settings
|
28 | $query =& $dblink->query("SELECT * FROM settings"); |
30 | $query =& $dblink->query("SELECT * FROM settings"); |
29 | $settings = array(); |
31 | $settings = array(); |
30 | while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC)) { |
32 | while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC)) { |
31 | $settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]); |
33 | $settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]); |
32 | }; |
34 | }; |
33 | // Fetch info about distribution
|
35 | // Fetch info about distribution
|
34 | $query =& $dblink->query("SELECT * FROM version v JOIN distribution d ON d.dist_id=v.dist_id JOIN dtype p ON d.disttype=p.type_id WHERE v.dist_id='$distro' AND v.version_id='$version'"); |
36 | $query =& $dblink->query("SELECT * FROM version v JOIN distribution d ON d.dist_id=v.dist_id JOIN dtype p ON d.disttype=p.type_id WHERE v.dist_id='$distro' AND v.version_id='$version'"); |
35 | $query->fetchInto($infodist, DB_FETCHMODE_ASSOC); |
37 | $query->fetchInto($infodist, DB_FETCHMODE_ASSOC); |
- | 38 | // Fetch default repos if not defined
|
|
- | 39 | if($repos[0]=="-1") { |
|
- | 40 | $querydrep =& $dblink->query("SELECT * FROM repository r JOIN ver2rep v ON r.rep_id=v.rep_id JOIN version v2 ON v.ver_id=v2.version_id WHERE r.defaultrep='1' AND v2.version_id='$version'"); |
|
- | 41 | $i=0; |
|
- | 42 | while ($querydrep->fetchInto($dreps,DB_FETCHMODE_ASSOC)) { |
|
- | 43 | $repos[$i] = $dreps["rep_id"]; |
|
- | 44 | $i++; |
|
- | 45 | }
|
|
- | 46 | }; |
|
- | 47 | if(count($repos)==0) return; |
|
36 | // Fetch repos
|
48 | // Processing repos
|
37 | $porigid = -1; // Previous origin id |
49 | $porigid = -1; // Previous origin id |
38 | - | ||
39 | for($i=0;$i<count($repos);$i++) { |
50 | for($i=0;$i<count($repos);$i++) { |
40 | $id=$repos[$i]; |
51 | $id=$repos[$i]; |
41 | // Fetch info about origin and scheme
|
52 | // Fetch info about origin and scheme
|
42 | $sql =& $dblink->query("SELECT * FROM repository r JOIN ver2rep v ON r.rep_id=v.rep_id JOIN origin o ON o.orig_id=r.orig_id JOIN version v2 ON v.ver_id=v2.version_id JOIN scheme s ON s.scheme_id=r.scheme_id JOIN root r2 ON r2.root_id=r.root_id WHERE r.rep_id=".$id); |
53 | $sql =& $dblink->query("SELECT * FROM repository r JOIN ver2rep v ON r.rep_id=v.rep_id JOIN origin o ON o.orig_id=r.orig_id JOIN version v2 ON v.ver_id=v2.version_id JOIN scheme s ON s.scheme_id=r.scheme_id JOIN root r2 ON r2.root_id=r.root_id WHERE r.rep_id=".$id); |
43 | $sql->fetchInto($resinfo, DB_FETCHMODE_ASSOC); |
54 | $sql->fetchInto($resinfo, DB_FETCHMODE_ASSOC); |
Строка 65... | Строка 76... | ||
65 | $result .= "# ".stripslashes($resinfo["repdescribe"])."\n".$repscheme."\n\n"; |
76 | $result .= "# ".stripslashes($resinfo["repdescribe"])."\n".$repscheme."\n\n"; |
66 | }
|
77 | }
|
67 | return $result; |
78 | return $result; |
68 | }
|
79 | }
|
69 | 80 | ||
70 | // For backward compatibility for Modern and Telepathy interfaces. Current getRepList() crushed his.
|
81 | // For backward compatibility for Modern interface. Current getRepList() crushed his.
|
71 | function getRepListLegacy($distro,$version,$dblink) { |
82 | function getRepListLegacy($distro,$version,$dblink) { |
72 | $query =& $dblink->query("SELECT * FROM settings"); |
83 | $query =& $dblink->query("SELECT * FROM settings"); |
73 | $settings = array(); |
84 | $settings = array(); |
74 | while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC)) { |
85 | while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC)) { |
75 | $settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]); |
86 | $settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]); |