diff options
author | pjmattal <pjmattal> | 2004-12-15 01:33:12 +0000 |
---|---|---|
committer | pjmattal <pjmattal> | 2004-12-15 01:33:12 +0000 |
commit | 252afad9fc0c46089b327a1315580a342cbc87c0 (patch) | |
tree | 6584678cf105deb47d6c85e7a8c00b54b61e3690 /web | |
parent | 7549ca2d967e5146892b86b3334278c2591d3379 (diff) | |
download | aurweb-252afad9fc0c46089b327a1315580a342cbc87c0.tar.xz |
tweaks to package functions and schema
Diffstat (limited to 'web')
-rw-r--r-- | web/html/pkgsubmit.php | 4 | ||||
-rw-r--r-- | web/lib/aur.inc | 13 | ||||
-rw-r--r-- | web/lib/pkgfuncs.inc | 47 |
3 files changed, 49 insertions, 15 deletions
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index 8373513..1bbcbe3 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -12,8 +12,8 @@ $DBUG = 1; # this is the directory that new packages will be uploaded to # -$UPLOAD_DIR = "/tmp/aur/temp/"; -$INCOMING_DIR = "/tmp/aur/incoming/"; +$UPLOAD_DIR = "/aur/temp/"; +$INCOMING_DIR = "/aur/incoming/"; if ($_COOKIE["AURSID"]) { diff --git a/web/lib/aur.inc b/web/lib/aur.inc index e696d5b..267b650 100644 --- a/web/lib/aur.inc +++ b/web/lib/aur.inc @@ -444,19 +444,6 @@ function dbug($msg) { return; } -# check to see if the package name exists -# -function package_exists($name="") { - if (!$name) {return 0;} - $dbh = db_connect(); - $q = "SELECT COUNT(*) FROM Packages "; - $q.= "WHERE Name = '".mysql_escape_string($name)."'"; - $result = db_query($q, $dbh); - if (!$result) {return 0;} - $row = mysql_fetch_row($result); - return $row[0]; -} - # check to see if the user can overwrite an existing package # function can_overwrite_pkg($name="", $sid="") { diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index bfdaa58..6ea3831 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -83,6 +83,20 @@ function pkgLocations() { return $locs; } +# check to see if the package name exists +# +function package_exists($name="") { + if (!$name) {return NULL;} + $dbh = db_connect(); + $q = "SELECT ID FROM Packages "; + $q.= "WHERE Name = '".mysql_escape_string($name)."' "; + $q.= "AND DummyPkg = 0"; + $result = db_query($q, $dbh); + if (!$result) {return NULL;} + $row = mysql_fetch_row($result); + return $row[0]; +} + # grab package dependencies # function package_dependencies($pkgid=0) { @@ -102,6 +116,39 @@ function package_dependencies($pkgid=0) { return $deps; } +# create a dummy package and return it's Packages.ID if it already exists, +# return the existing ID +# +function create_dummy($pname="", $sid="") { + if ($pname && $sid) { + $uid = uid_from_sid($sid); + if (!$uid) {return NULL}; + $dbh = db_connect(); + $q = "SELECT ID FROM Packages WHERE Name = '"; + $q.= mysql_escape_string($pname)."'"; + $result = db_query($q, $dbh); + if (!$result) { + # Insert the dummy + # + $q = "INSERT INTO Packages (Name, CategoryID, Description, "; + $q.= "URL, LocationID, SubmittedTS, SubmitterUID) VALUES ('"; + $q.= mysql_escape_string($pname)."', 0, "; + $q.= "'A dummy package', '/#', 0, UNIX_TIMESTAMP(), "; + $q.= $uid.")"; + $result = db_query($q, $dbh); + if (!$result) { + return NULL; + } + return mysql_insert_id($result); + } else { + $data = mysql_fetch_row($result); + return $data['ID']; + } + } + return NULL; + +} + # grab package sources # function package_sources($pkgid=0) { |