From 0dd27a86b1bceaa01d406e4b85139acbd8c885ab Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 18 Sep 2015 07:52:15 +0200 Subject: Remove legacy code In 74edb6f (Use Git repositories to store packages, 2014-06-06), package creation was moved to the Python backend. Remove several PHP functions that are no longer needed. Signed-off-by: Lukas Fleischer --- web/lib/pkgfuncs.inc.php | 189 ----------------------------------------------- 1 file changed, 189 deletions(-) diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index b00b22d2..d3cad12f 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -515,23 +515,6 @@ function pkg_name_from_id($pkgids) { } } -/** - * Determine if a package name is on the database blacklist - * - * @param string $name The package name to check - * - * @return bool True if the name is blacklisted, otherwise false - */ -function pkg_name_is_blacklisted($name) { - $dbh = DB::connect(); - $q = "SELECT COUNT(*) FROM PackageBlacklist "; - $q.= "WHERE Name = " . $dbh->quote($name); - $result = $dbh->query($q); - - if (!$result) return false; - return ($result->fetchColumn() > 0); -} - /** * Get the package details * @@ -912,178 +895,6 @@ function sanitize_ids($ids) { return $new_ids; } -/** - * Add package information to the database for a specific package - * - * @param int $base_id ID of the package base - * @param string $pkgname Name of the new package - * @param string $pkgver Version of the new package - * @param string $pkgdesc Description of the new package - * @param string $pkgurl Upstream URL for the new package - * - * @return int ID of the new package - */ -function pkg_create($base_id, $pkgname, $pkgver, $pkgdesc, $pkgurl) { - $dbh = DB::connect(); - $q = sprintf("INSERT INTO Packages (PackageBaseID, Name, Version, " . - "Description, URL) VALUES (%d, %s, %s, %s, %s)", - $base_id, $dbh->quote($pkgname), $dbh->quote($pkgver), - $dbh->quote($pkgdesc), $dbh->quote($pkgurl)); - $dbh->exec($q); - return $dbh->lastInsertId(); -} - -/** - * Add a dependency for a specific package to the database - * - * @param int $pkgid The package ID to add the dependency for - * @param string $type The type of dependency to add - * @param string $depname The name of the dependency to add - * @param string $depcondition The type of dependency for the package - * @param string $deparch The architecture of the dependency to add - * - * @return void - */ -function pkg_add_dep($pkgid, $type, $depname, $depcondition, $deparch) { - $dbh = DB::connect(); - $q = sprintf("INSERT INTO PackageDepends (PackageID, DepTypeID, DepName, DepCondition, DepArch) VALUES (%d, %d, %s, %s, %s)", - $pkgid, - pkg_dependency_type_id_from_name($type), - $dbh->quote($depname), - $dbh->quote($depcondition), - $deparch ? $dbh->quote($deparch) : 'NULL' - ); - $dbh->exec($q); -} - -/** - * Add a relation for a specific package to the database - * - * @param int $pkgid The package ID to add the relation for - * @param string $type The type of relation to add - * @param string $relname The name of the relation to add - * @param string $relcondition The version requirement of the relation - * @param string $relarch The architecture of the relation to add - * - * @return void - */ -function pkg_add_rel($pkgid, $type, $relname, $relcondition, $relarch) { - $dbh = DB::connect(); - $q = sprintf("INSERT INTO PackageRelations (PackageID, RelTypeID, RelName, RelCondition, RelArch) VALUES (%d, %d, %s, %s, %s)", - $pkgid, - pkg_relation_type_id_from_name($type), - $dbh->quote($relname), - $dbh->quote($relcondition), - $relarch ? $dbh->quote($relarch) : 'NULL' - ); - $dbh->exec($q); -} - -/** - * Add a source for a specific package to the database - * - * @param int $pkgid The package ID to add the source for - * @param string $pkgsrc The package source to add to the database - * @param string $srcarch The architecture of the source to add - * - * @return void - */ -function pkg_add_src($pkgid, $pkgsrc, $srcarch) { - $dbh = DB::connect(); - $q = sprintf("INSERT INTO PackageSources (PackageID, Source, SourceArch) VALUES (%d, %s, %s)", - $pkgid, - $dbh->quote($pkgsrc), - $srcarch ? $dbh->quote($srcarch) : 'NULL' - ); - $dbh->exec($q); -} - -/** - * Creates a new group and returns its ID - * - * If the groups already exists, the ID of the already existing group is - * returned. - * - * @param string $name The name of the group to create - * - * @return int The ID of the group - */ -function pkg_create_group($name) { - $dbh = DB::connect(); - $q = sprintf("SELECT ID FROM Groups WHERE Name = %s", $dbh->quote($name)); - $result = $dbh->query($q); - if ($result) { - $grpid = $result->fetch(PDO::FETCH_COLUMN, 0); - if ($grpid > 0) { - return $grpid; - } - } - - $q = sprintf("INSERT INTO Groups (Name) VALUES (%s)", $dbh->quote($name)); - $dbh->exec($q); - return $dbh->lastInsertId(); -} - -/** - * Add a package to a group - * - * @param int $pkgid The package ID of the package to add - * @param int $grpid The group ID of the group to add the package to - * - * @return void - */ -function pkg_add_grp($pkgid, $grpid) { - $dbh = DB::connect(); - $q = sprintf("INSERT INTO PackageGroups (PackageID, GroupID) VALUES (%d, %d)", - $pkgid, - $grpid - ); - $dbh->exec($q); -} - -/** - * Creates a new license and returns its ID - * - * If the license already exists, the ID of the already existing license is - * returned. - * - * @param string $name The name of the license to create - * - * @return int The ID of the license - */ -function pkg_create_license($name) { - $dbh = DB::connect(); - $q = sprintf("SELECT ID FROM Licenses WHERE Name = %s", $dbh->quote($name)); - $result = $dbh->query($q); - if ($result) { - $licid = $result->fetch(PDO::FETCH_COLUMN, 0); - if ($licid > 0) { - return $licid; - } - } - - $q = sprintf("INSERT INTO Licenses (Name) VALUES (%s)", $dbh->quote($name)); - $dbh->exec($q); - return $dbh->lastInsertId(); -} - -/** - * Add a license to a package - * - * @param int $pkgid The package ID of the package - * @param int $grpid The ID of the license to add - * - * @return void - */ -function pkg_add_lic($pkgid, $licid) { - $dbh = DB::connect(); - $q = sprintf("INSERT INTO PackageLicenses (PackageID, LicenseID) VALUES (%d, %d)", - $pkgid, - $licid - ); - $dbh->exec($q); -} - /** * Determine package information for latest package * -- cgit v1.2.3-24-g4f1b