mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Rename package_exists() to pkgid_from_name()
Describe what this function actually does: Return the ID of a package with a given name and return NULL if such a package doesn't exist. The function name is chosen in a fashion similar to other functions from "pkgfuncs.inc.php" (pkgname_from_id(), pkgnotify_from_sid(), ...). Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
6ae2bc514f
commit
0ac8970b62
3 changed files with 4 additions and 4 deletions
|
@ -34,7 +34,7 @@ foreach ($buckets as $bucket) {
|
|||
continue;
|
||||
}
|
||||
$fullpath = INCOMING_DIR . $bucket . "/" . $pkgname;
|
||||
if (!package_exists($pkgname) && is_dir($fullpath)) {
|
||||
if (!pkgid_from_name($pkgname) && is_dir($fullpath)) {
|
||||
echo 'Removing ' . $fullpath . "\n";
|
||||
rm_tree($fullpath);
|
||||
$count++;
|
||||
|
|
|
@ -261,7 +261,7 @@ if ($uid):
|
|||
|
||||
if (!$error) {
|
||||
# First, see if this package already exists, and if it can be overwritten
|
||||
$pkg_exists = package_exists($pkg_name);
|
||||
$pkg_id = pkgid_from_name($pkg_name);
|
||||
if (can_submit_pkg($pkg_name, $_COOKIE["AURSID"])) {
|
||||
if (file_exists($incoming_pkgdir)) {
|
||||
# Blow away the existing file/dir and contents
|
||||
|
@ -278,7 +278,7 @@ if ($uid):
|
|||
|
||||
if (!$error) {
|
||||
# Check if package name is blacklisted.
|
||||
if (!$pkg_exists && pkgname_is_blacklisted($pkg_name)) {
|
||||
if (!$pkg_id && pkgname_is_blacklisted($pkg_name)) {
|
||||
if (!canSubmitBlacklisted(account_from_sid($_COOKIE["AURSID"]))) {
|
||||
$error = __( "%s is on the package blacklist, please check if it's available in the official repos.", $pkg_name);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ function pkgCategories() {
|
|||
|
||||
# check to see if the package name exists
|
||||
#
|
||||
function package_exists($name="") {
|
||||
function pkgid_from_name($name="") {
|
||||
if (!$name) {return NULL;}
|
||||
$dbh = db_connect();
|
||||
$q = "SELECT ID FROM Packages ";
|
||||
|
|
Loading…
Add table
Reference in a new issue