mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Use Git repositories to store packages
* Remove package submission page from the web interface. * Replace PKGBUILD and tarball links with links to cgit. * Remove the "URLPath" field from RPC replies. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
943b6bc976
commit
74edb6fea9
12 changed files with 12 additions and 3664 deletions
|
@ -6,9 +6,6 @@ name = AUR
|
|||
user = aur
|
||||
password = aur
|
||||
|
||||
[paths]
|
||||
storage = /srv/aur/unsupported/
|
||||
|
||||
[options]
|
||||
username_min_len = 3
|
||||
username_max_len = 16
|
||||
|
@ -21,7 +18,7 @@ persistent_cookie_timeout = 2592000
|
|||
max_filesize_uncompressed = 8388608
|
||||
disable_http_login = 1
|
||||
aur_location = http://localhost
|
||||
package_url = /packages/
|
||||
cgit_uri = https://git.aur.archlinux.org/
|
||||
max_rpc_results = 5000
|
||||
aur_request_ml = aur-requests@archlinux.org
|
||||
request_idle_time = 1209600
|
||||
|
|
|
@ -1,489 +0,0 @@
|
|||
<?php
|
||||
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
|
||||
|
||||
require_once('Archive/Tar.php');
|
||||
|
||||
include_once("aur.inc.php"); # access AUR common functions
|
||||
include_once("pkgfuncs.inc.php"); # package functions
|
||||
|
||||
set_lang(); # this sets up the visitor's language
|
||||
check_sid(); # see if they're still logged in
|
||||
|
||||
$cwd = getcwd();
|
||||
|
||||
if ($_COOKIE["AURSID"]) {
|
||||
$uid = uid_from_sid($_COOKIE['AURSID']);
|
||||
}
|
||||
else {
|
||||
$uid = NULL;
|
||||
}
|
||||
|
||||
if ($uid):
|
||||
|
||||
# Track upload errors
|
||||
$error = "";
|
||||
|
||||
if (isset($_REQUEST['pkgsubmit'])) {
|
||||
|
||||
# Make sure authenticated user submitted the package themselves
|
||||
if (!check_token()) {
|
||||
$error = __("Invalid token for user action.");
|
||||
}
|
||||
|
||||
# Before processing, make sure we even have a file
|
||||
switch($_FILES['pfile']['error']) {
|
||||
case UPLOAD_ERR_INI_SIZE:
|
||||
$maxsize = ini_get('upload_max_filesize');
|
||||
$error = __("Error - Uploaded file larger than maximum allowed size (%s)", $maxsize);
|
||||
break;
|
||||
case UPLOAD_ERR_PARTIAL:
|
||||
$error = __("Error - File partially uploaded");
|
||||
break;
|
||||
case UPLOAD_ERR_NO_FILE:
|
||||
$error = __("Error - No file uploaded");
|
||||
break;
|
||||
case UPLOAD_ERR_NO_TMP_DIR:
|
||||
$error = __("Error - Could not locate temporary upload folder");
|
||||
break;
|
||||
case UPLOAD_ERR_CANT_WRITE:
|
||||
$error = __("Error - File could not be written");
|
||||
break;
|
||||
}
|
||||
|
||||
# Check whether the file is gzip'ed
|
||||
if (!$error) {
|
||||
$fh = fopen($_FILES['pfile']['tmp_name'], 'rb');
|
||||
fseek($fh, 0, SEEK_SET);
|
||||
list(, $magic) = unpack('v', fread($fh, 2));
|
||||
|
||||
if ($magic != 0x8b1f) {
|
||||
$error = __("Error - unsupported file format (please submit gzip'ed tarballs generated by makepkg(8) only).");
|
||||
}
|
||||
}
|
||||
|
||||
# Check uncompressed file size (ZIP bomb protection)
|
||||
$max_filesize_uncompressed = config_get_int('options', 'max_filesize_uncompressed');
|
||||
if (!$error && $max_filesize_uncompressed) {
|
||||
fseek($fh, -4, SEEK_END);
|
||||
list(, $filesize_uncompressed) = unpack('V', fread($fh, 4));
|
||||
|
||||
if ($filesize_uncompressed > $max_filesize_uncompressed) {
|
||||
$error = __("Error - uncompressed file size too large.");
|
||||
}
|
||||
}
|
||||
|
||||
# Close file handle before extracting stuff
|
||||
if (isset($fh) && is_resource($fh)) {
|
||||
fclose($fh);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$tar = new Archive_Tar($_FILES['pfile']['tmp_name']);
|
||||
|
||||
/* Extract PKGBUILD and .SRCINFO into a string. */
|
||||
$pkgbuild_raw = $srcinfo_raw = '';
|
||||
$dircount = 0;
|
||||
foreach ($tar->listContent() as $tar_file) {
|
||||
if ($tar_file['typeflag'] == 0) {
|
||||
if (strchr($tar_file['filename'], '/') === false) {
|
||||
$error = __("Error - source tarball may not contain files outside a directory.");
|
||||
break;
|
||||
} elseif ($tar_file['mode'] != 0644 && $tar_file['mode'] != 0755) {
|
||||
$error = __("Error - all files must have permissions of 644 or 755.");
|
||||
break;
|
||||
} elseif (substr($tar_file['filename'], -9) == '/PKGBUILD') {
|
||||
$pkgbuild_raw = $tar->extractInString($tar_file['filename']);
|
||||
} elseif (substr($tar_file['filename'], -9) == '/.AURINFO' ||
|
||||
substr($tar_file['filename'], -9) == '/.SRCINFO') {
|
||||
$srcinfo_raw = $tar->extractInString($tar_file['filename']);
|
||||
}
|
||||
} elseif ($tar_file['typeflag'] == 5) {
|
||||
if (substr_count($tar_file['filename'], "/") > 1) {
|
||||
$error = __("Error - source tarball may not contain nested subdirectories.");
|
||||
break;
|
||||
} elseif (++$dircount > 1) {
|
||||
$error = __("Error - source tarball may not contain more than one directory.");
|
||||
break;
|
||||
} elseif ($tar_file['mode'] != 0755) {
|
||||
$error = __("Error - all directories must have permissions of 755.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && $dircount !== 1) {
|
||||
$error = __("Error - source tarball may not contain files outside a directory.");
|
||||
}
|
||||
|
||||
if (empty($pkgbuild_raw) && !$error) {
|
||||
$error = __("Error trying to unpack upload - PKGBUILD does not exist.");
|
||||
}
|
||||
|
||||
if (empty($srcinfo_raw)) {
|
||||
$srcinfo_raw = '';
|
||||
if (!$error) {
|
||||
$error = __("The source package does not contain any meta data. Please use `makepkg --source` from pacman 4.2.0 or newer to create AUR source packages.");
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse .SRCINFO and extract meta data. */
|
||||
$pkgbase_info = array();
|
||||
$pkginfo = array();
|
||||
$section_info = array();
|
||||
foreach (explode("\n", $srcinfo_raw) as $line) {
|
||||
$line = ltrim($line);
|
||||
if (empty($line) || $line[0] == '#') {
|
||||
continue;
|
||||
}
|
||||
list($key, $value) = explode(' = ', $line, 2);
|
||||
$tokens = explode('_', $key, 2);
|
||||
$key = $tokens[0];
|
||||
if (count($tokens) > 1) {
|
||||
$arch = $tokens[1];
|
||||
} else {
|
||||
$arch = NULL;
|
||||
}
|
||||
switch ($key) {
|
||||
case 'pkgbase':
|
||||
case 'pkgname':
|
||||
if (!empty($section_info)) {
|
||||
if (isset($section_info['pkgbase'])) {
|
||||
$pkgbase_info = $section_info;
|
||||
} elseif (isset($section_info['pkgname'])) {
|
||||
$pkginfo[] = array_pkgbuild_merge($pkgbase_info, $section_info);
|
||||
}
|
||||
}
|
||||
$section_info = array(
|
||||
'license' => array(),
|
||||
'groups' => array(),
|
||||
'depends' => array(),
|
||||
'makedepends' => array(),
|
||||
'checkdepends' => array(),
|
||||
'optdepends' => array(),
|
||||
'source' => array(),
|
||||
'conflicts' => array(),
|
||||
'provides' => array(),
|
||||
'replaces' => array()
|
||||
);
|
||||
/* Fall-through case. */
|
||||
case 'epoch':
|
||||
case 'pkgdesc':
|
||||
case 'pkgver':
|
||||
case 'pkgrel':
|
||||
case 'url':
|
||||
$section_info[$key] = $value;
|
||||
break;
|
||||
case 'license':
|
||||
case 'groups':
|
||||
$section_info[$key][] = $value;
|
||||
break;
|
||||
case 'depends':
|
||||
case 'makedepends':
|
||||
case 'checkdepends':
|
||||
case 'optdepends':
|
||||
case 'conflicts':
|
||||
case 'provides':
|
||||
case 'replaces':
|
||||
case 'source':
|
||||
$section_info[$key][$arch][] = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($section_info)) {
|
||||
if (isset($section_info['pkgbase'])) {
|
||||
$pkgbase_info = $section_info;
|
||||
} elseif (isset($section_info['pkgname'])) {
|
||||
$pkginfo[] = array_pkgbuild_merge($pkgbase_info, $section_info);
|
||||
}
|
||||
}
|
||||
|
||||
/* Validate package base name. */
|
||||
if (!$error) {
|
||||
$pkgbase_name = $pkgbase_info['pkgbase'];
|
||||
if (!preg_match("/^[a-z0-9][a-z0-9\.+_-]*$/D", $pkgbase_name)) {
|
||||
$error = __("Invalid name: only lowercase letters are allowed.");
|
||||
}
|
||||
|
||||
/* Check whether the package base already exists. */
|
||||
$base_id = pkgbase_from_name($pkgbase_name);
|
||||
}
|
||||
|
||||
foreach ($pkginfo as $key => $pi) {
|
||||
/* Bail out early if an error has occurred. */
|
||||
if ($error) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Validate package names. */
|
||||
$pkg_name = $pi['pkgname'];
|
||||
if (!preg_match("/^[a-z0-9][a-z0-9\.+_-]*$/D", $pkg_name)) {
|
||||
$error = __("Invalid name: only lowercase letters are allowed.");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Determine the full package versions with epoch. */
|
||||
if (isset($pi['epoch']) && (int)$pi['epoch'] > 0) {
|
||||
$pkginfo[$key]['full-version'] = sprintf('%d:%s-%s', $pi['epoch'], $pi['pkgver'], $pi['pkgrel']);
|
||||
} else {
|
||||
$pkginfo[$key]['full-version'] = sprintf('%s-%s', $pi['pkgver'], $pi['pkgrel']);
|
||||
}
|
||||
|
||||
/* Check for http:// or other protocols in the URL. */
|
||||
$parsed_url = parse_url($pi['url']);
|
||||
if (!$parsed_url['scheme']) {
|
||||
$error = __("Package URL is missing a protocol (ie. http:// ,ftp://)");
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* The DB schema imposes limitations on number of
|
||||
* allowed characters. Print error message when these
|
||||
* limitations are exceeded.
|
||||
*/
|
||||
if (strlen($pi['pkgname']) > 64) {
|
||||
$error = __("Error - Package name cannot be greater than %d characters", 64);
|
||||
break;
|
||||
}
|
||||
if (strlen($pi['url']) > 255) {
|
||||
$error = __("Error - Package URL cannot be greater than %d characters", 255);
|
||||
break;
|
||||
}
|
||||
if (strlen($pi['pkgdesc']) > 255) {
|
||||
$error = __("Error - Package description cannot be greater than %d characters", 255);
|
||||
break;
|
||||
}
|
||||
foreach ($pi['license'] as $lic) {
|
||||
if (strlen($lic > 64)) {
|
||||
$error = __("Error - Package license cannot be greater than %d characters", 64);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (strlen($pkginfo[$key]['full-version']) > 32) {
|
||||
$error = __("Error - Package version cannot be greater than %d characters", 32);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check if package name is blacklisted. */
|
||||
if (!$base_id && pkg_name_is_blacklisted($pi['pkgname']) && !can_submit_blacklisted(account_from_sid($_COOKIE["AURSID"]))) {
|
||||
$error = __( "%s is on the package blacklist, please check if it's available in the official repos.", $pi['pkgname']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($pkgbase_name)) {
|
||||
$incoming_pkgdir = config_get('paths', 'storage') . substr($pkgbase_name, 0, 2) . "/" . $pkgbase_name;
|
||||
}
|
||||
|
||||
/* Upload PKGBUILD and tarball. */
|
||||
if (!$error && !can_submit_pkgbase($pkgbase_name, $_COOKIE["AURSID"])) {
|
||||
$error = __( "You are not allowed to overwrite the %s%s%s package.", "<strong>", $pkgbase_name, "</strong>");
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
foreach ($pkginfo as $pi) {
|
||||
if (!can_submit_pkg($pi['pkgname'], $base_id)) {
|
||||
$error = __( "You are not allowed to overwrite the %s%s%s package.", "<strong>", $pi['pkgname'], "</strong>");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
/*
|
||||
* Blow away the existing directory and its contents.
|
||||
*/
|
||||
if (file_exists($incoming_pkgdir)) {
|
||||
rm_tree($incoming_pkgdir);
|
||||
}
|
||||
|
||||
/*
|
||||
* The mode is masked by the current umask, so not as
|
||||
* scary as it looks.
|
||||
*/
|
||||
if (!mkdir($incoming_pkgdir, 0777, true)) {
|
||||
$error = __( "Could not create directory %s.", $incoming_pkgdir);
|
||||
}
|
||||
|
||||
if (!chdir($incoming_pkgdir)) {
|
||||
$error = __("Could not change directory to %s.", $incoming_pkgdir);
|
||||
}
|
||||
|
||||
file_put_contents('PKGBUILD', $pkgbuild_raw);
|
||||
move_uploaded_file($_FILES['pfile']['tmp_name'], $pkgbase_name . '.tar.gz');
|
||||
}
|
||||
|
||||
/* Update the backend database. */
|
||||
if (!$error) {
|
||||
begin_atomic_commit();
|
||||
|
||||
/*
|
||||
* Check the category to use, "1" meaning "none" (or
|
||||
* "keep category" for existing packages).
|
||||
*/
|
||||
if (isset($_POST['category'])) {
|
||||
$category_id = max(1, intval($_POST['category']));
|
||||
} else {
|
||||
$category_id = 1;
|
||||
}
|
||||
|
||||
if ($base_id) {
|
||||
/*
|
||||
* This is an overwrite of an existing package
|
||||
* base, the database ID needs to be preserved
|
||||
* so that any votes are retained.
|
||||
*/
|
||||
$was_orphan = (pkgbase_maintainer_uid($base_id) === NULL);
|
||||
|
||||
pkgbase_update($base_id, $pkgbase_info['pkgbase'], $uid);
|
||||
|
||||
if ($category_id > 1) {
|
||||
pkgbase_update_category($base_id, $category_id);
|
||||
}
|
||||
|
||||
pkgbase_delete_packages($base_id);
|
||||
} else {
|
||||
/* This is a brand new package. */
|
||||
$was_orphan = true;
|
||||
$base_id = pkgbase_create($pkgbase_name, $category_id, $uid);
|
||||
}
|
||||
|
||||
foreach ($pkginfo as $pi) {
|
||||
$pkgid = pkg_create($base_id, $pi['pkgname'], $pi['full-version'], $pi['pkgdesc'], $pi['url']);
|
||||
|
||||
foreach ($pi['license'] as $lic) {
|
||||
$licid = pkg_create_license($lic);
|
||||
pkg_add_lic($pkgid, $licid);
|
||||
}
|
||||
|
||||
foreach ($pi['groups'] as $grp) {
|
||||
$grpid = pkg_create_group($grp);
|
||||
pkg_add_grp($pkgid, $grpid);
|
||||
}
|
||||
|
||||
foreach (array('depends', 'makedepends', 'checkdepends', 'optdepends') as $deptype) {
|
||||
foreach ($pi[$deptype] as $deparch => $depgrp) {
|
||||
foreach ($depgrp as $dep) {
|
||||
$deppkgname = preg_replace("/(<|=|>).*/", "", $dep);
|
||||
$depcondition = str_replace($deppkgname, "", $dep);
|
||||
pkg_add_dep($pkgid, $deptype, $deppkgname, $depcondition, $deparch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (array('conflicts', 'provides', 'replaces') as $reltype) {
|
||||
foreach ($pi[$reltype] as $relarch => $relgrp) {
|
||||
foreach ($relgrp as $rel) {
|
||||
$relpkgname = preg_replace("/(<|=|>).*/", "", $rel);
|
||||
$relcondition = str_replace($relpkgname, "", $rel);
|
||||
pkg_add_rel($pkgid, $reltype, $relpkgname, $relcondition, $relarch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($pi['source'] as $srcarch => $srcgrp) {
|
||||
foreach ($srcgrp as $src) {
|
||||
pkg_add_src($pkgid, $src, $srcarch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we just created this package, or it was an orphan
|
||||
* and we auto-adopted, add submitting user to the
|
||||
* notification list.
|
||||
*/
|
||||
if ($was_orphan) {
|
||||
pkgbase_notify(array($base_id), true);
|
||||
}
|
||||
|
||||
end_atomic_commit();
|
||||
|
||||
header('Location: ' . get_pkgbase_uri($pkgbase_info['pkgbase']));
|
||||
}
|
||||
|
||||
chdir($cwd);
|
||||
}
|
||||
|
||||
html_header("Submit");
|
||||
|
||||
?>
|
||||
|
||||
<div class="box">
|
||||
<h2><?= __("Submit"); ?></h2>
|
||||
<p><?= __("Upload your source packages here. Create source packages with `makepkg --source`.") ?></p>
|
||||
|
||||
<?php
|
||||
if (empty($_REQUEST['pkgsubmit']) || $error):
|
||||
# User is not uploading, or there were errors uploading - then
|
||||
# give the visitor the default upload form
|
||||
if (ini_get("file_uploads")):
|
||||
|
||||
$pkgbase_categories = pkgbase_categories();
|
||||
?>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<ul class="errorlist"><li><?= $error ?></li></ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<form action="<?= get_uri('/submit/'); ?>" method="post" enctype="multipart/form-data">
|
||||
<fieldset>
|
||||
<div>
|
||||
<input type="hidden" name="pkgsubmit" value="1" />
|
||||
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
|
||||
</div>
|
||||
<p>
|
||||
<label for="id_category"><?= __("Package Category"); ?>:</label>
|
||||
<select id="id_category" name="category">
|
||||
<option value="1"><?= __("Select Category"); ?></option>
|
||||
<?php
|
||||
foreach ($pkgbase_categories as $num => $cat):
|
||||
print '<option value="' . $num . '"';
|
||||
if (isset($_POST['category']) && $_POST['category'] == $cat):
|
||||
print ' selected="selected"';
|
||||
endif;
|
||||
print '>' . $cat . '</option>';
|
||||
endforeach;
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label for="id_file"><?= __("Upload package file"); ?>:</label>
|
||||
<input id="id_file" type="file" name="pfile" size='30' />
|
||||
</p>
|
||||
<p>
|
||||
<label></label>
|
||||
<input class="button" type="submit" value="<?= __("Upload"); ?>" />
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
else:
|
||||
print __("Sorry, uploads are not permitted by this server.");
|
||||
?>
|
||||
|
||||
<br />
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
endif;
|
||||
else:
|
||||
# Visitor is not logged in
|
||||
html_header("Submit");
|
||||
print __("You must create an account before you can upload packages.");
|
||||
?>
|
||||
|
||||
<br />
|
||||
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
html_footer(AUR_VERSION);
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This is only meant for PHP 5 to get rid of certain strict warning
|
||||
* that doesn't get hidden since it's in the shutdown function
|
||||
*/
|
||||
class PEAR5
|
||||
{
|
||||
/**
|
||||
* If you have a class that's mostly/entirely static, and you need static
|
||||
* properties, you can use this method to simulate them. Eg. in your method(s)
|
||||
* do this: $myVar = &PEAR5::getStaticProperty('myclass', 'myVar');
|
||||
* You MUST use a reference, or they will not persist!
|
||||
*
|
||||
* @access public
|
||||
* @param string $class The calling classname, to prevent clashes
|
||||
* @param string $var The variable to retrieve.
|
||||
* @return mixed A reference to the variable. If not set it will be
|
||||
* auto initialised to NULL.
|
||||
*/
|
||||
static function &getStaticProperty($class, $var)
|
||||
{
|
||||
static $properties;
|
||||
if (!isset($properties[$class])) {
|
||||
$properties[$class] = array();
|
||||
}
|
||||
|
||||
if (!array_key_exists($var, $properties[$class])) {
|
||||
$properties[$class][$var] = null;
|
||||
}
|
||||
|
||||
return $properties[$class][$var];
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -227,7 +227,6 @@ class AurJSON {
|
|||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$resultcount++;
|
||||
$pkgbase_name = $row['PackageBase'];
|
||||
$row['URLPath'] = $package_url . substr($pkgbase_name, 0, 2) . "/" . $pkgbase_name . "/" . $pkgbase_name . ".tar.gz";
|
||||
|
||||
/*
|
||||
* Unfortunately, mysql_fetch_assoc() returns
|
||||
|
|
|
@ -914,45 +914,6 @@ function pkgbase_change_category($base_id) {
|
|||
return array(true, __("Package category changed."));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add package base information to the database
|
||||
*
|
||||
* @param string $name Name of the new package base
|
||||
* @param int $category_id Category for the new package base
|
||||
* @param int $uid User ID of the package uploader
|
||||
*
|
||||
* @return int ID of the new package base
|
||||
*/
|
||||
function pkgbase_create($name, $category_id, $uid) {
|
||||
$dbh = DB::connect();
|
||||
$q = sprintf("INSERT INTO PackageBases (Name, CategoryID, " .
|
||||
"SubmittedTS, ModifiedTS, SubmitterUID, MaintainerUID, " .
|
||||
"PackagerUID) VALUES (%s, %d, UNIX_TIMESTAMP(), " .
|
||||
"UNIX_TIMESTAMP(), %d, %d, %d)",
|
||||
$dbh->quote($name), $category_id, $uid, $uid, $uid);
|
||||
$dbh->exec($q);
|
||||
return $dbh->lastInsertId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update package base information for a specific package base
|
||||
*
|
||||
* @param string $name Name of the updated package base
|
||||
* @param int $base_id The package base ID of the affected package
|
||||
* @param int $uid User ID of the package uploader
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function pkgbase_update($base_id, $name, $uid) {
|
||||
$dbh = DB::connect();
|
||||
$q = sprintf("UPDATE PackageBases SET " .
|
||||
"Name = %s, ModifiedTS = UNIX_TIMESTAMP(), " .
|
||||
"MaintainerUID = %d, PackagerUID = %d, OutOfDateTS = NULL " .
|
||||
"WHERE ID = %d",
|
||||
$dbh->quote($name), $uid, $uid, $base_id);
|
||||
$dbh->exec($q);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the category a package base belongs to
|
||||
*
|
||||
|
|
|
@ -183,36 +183,6 @@ function pkg_relations($pkgid) {
|
|||
return $rels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ID of a dependency type given its name
|
||||
*
|
||||
* @param string $name The name of the dependency type
|
||||
*
|
||||
* @return int The ID of the dependency type
|
||||
*/
|
||||
function pkg_dependency_type_id_from_name($name) {
|
||||
$dbh = DB::connect();
|
||||
$q = "SELECT ID FROM DependencyTypes WHERE Name = ";
|
||||
$q.= $dbh->quote($name);
|
||||
$result = $dbh->query($q);
|
||||
return $result->fetch(PDO::FETCH_COLUMN, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ID of a relation type given its name
|
||||
*
|
||||
* @param string $name The name of the relation type
|
||||
*
|
||||
* @return int The ID of the relation type
|
||||
*/
|
||||
function pkg_relation_type_id_from_name($name) {
|
||||
$dbh = DB::connect();
|
||||
$q = "SELECT ID FROM RelationTypes WHERE Name = ";
|
||||
$q.= $dbh->quote($name);
|
||||
$result = $dbh->query($q);
|
||||
return $result->fetch(PDO::FETCH_COLUMN, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTML code to display a package dependency link
|
||||
*
|
||||
|
@ -779,6 +749,7 @@ function sanitize_ids($ids) {
|
|||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* Add package information to the database for a specific package
|
||||
*
|
||||
* @param int $base_id ID of the package base
|
||||
|
|
|
@ -16,7 +16,6 @@ $ROUTES = array(
|
|||
'/passreset' => 'passreset.php',
|
||||
'/rpc' => 'rpc.php',
|
||||
'/rss' => 'rss.php',
|
||||
'/submit' => 'pkgsubmit.php',
|
||||
'/tu' => 'tu.php',
|
||||
'/addvote' => 'addvote.php',
|
||||
);
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
<?php if (has_credential(CRED_PKGREQ_LIST)): ?>
|
||||
<li><a href="<?= get_uri('/requests/') ; ?>"><?= __("Requests"); ?></a></li>
|
||||
<?php endif; ?>
|
||||
<li><a href="<?= get_uri('/submit/'); ?>"><?= __("Submit"); ?></a></li>
|
||||
<?php if (has_credential(CRED_ACCOUNT_SEARCH)): ?>
|
||||
<li><a href="<?= get_uri('/accounts/') ; ?>"><?= __("Accounts"); ?></a></li>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
$cgit_uri = config_get('options', 'cgit_uri');
|
||||
|
||||
$uid = uid_from_sid($SID);
|
||||
|
||||
$pkgid = intval($row['ID']);
|
||||
|
@ -21,9 +24,6 @@ $updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($r
|
|||
$submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["SubmittedTS"]));
|
||||
$out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($row["OutOfDateTS"]));
|
||||
|
||||
$package_url = config_get('options', 'package_url');
|
||||
$urlpath = $package_url . substr($row['BaseName'], 0, 2) . "/" . $row['BaseName'];
|
||||
|
||||
$lics = pkg_licenses($row["ID"]);
|
||||
$grps = pkg_groups($row["ID"]);
|
||||
|
||||
|
@ -79,8 +79,8 @@ $sources = pkg_sources($row["ID"]);
|
|||
<div id="actionlist">
|
||||
<h4><?= __('Package Actions') ?></h4>
|
||||
<ul class="small">
|
||||
<li><a href="<?= $urlpath ?>/PKGBUILD"><?= __('View PKGBUILD') ?></a></li>
|
||||
<li><a href="<?= $urlpath . '/' . $row['BaseName'] ?>.tar.gz"><?= __('Download tarball') ?></a></li>
|
||||
<li><a href="<?= $cgit_uri . $row['BaseName'] . '.git' ?>/tree/PKGBUILD"><?= __('View PKGBUILD') ?></a></li>
|
||||
<li><a href="<?= $cgit_uri . $row['BaseName'] . '.git' ?>/snapshot/master.tar.gz"><?= __('Download snapshot') ?></a></li>
|
||||
<li><a href="https://wiki.archlinux.org/index.php/Special:Search?search=<?= urlencode($row['Name']) ?>"><?= __('Search wiki') ?></a></li>
|
||||
<li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li>
|
||||
<?php if ($uid): ?>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
$cgit_uri = config_get('options', 'cgit_uri');
|
||||
|
||||
$uid = uid_from_sid($SID);
|
||||
|
||||
$base_id = intval($row['ID']);
|
||||
|
@ -19,9 +22,6 @@ $updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($r
|
|||
$submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["SubmittedTS"]));
|
||||
$out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($row["OutOfDateTS"]));
|
||||
|
||||
$package_url = config_get('options', 'package_url');
|
||||
$urlpath = $package_url . substr($row['Name'], 0, 2) . "/" . $row['Name'];
|
||||
|
||||
$pkgs = pkgbase_get_pkgnames($base_id);
|
||||
?>
|
||||
<div id="pkgdetails" class="box">
|
||||
|
@ -30,8 +30,8 @@ $pkgs = pkgbase_get_pkgnames($base_id);
|
|||
<div id="actionlist">
|
||||
<h4><?= __('Package Actions') ?></h4>
|
||||
<ul class="small">
|
||||
<li><a href="<?= $urlpath ?>/PKGBUILD"><?= __('View PKGBUILD') ?></a></li>
|
||||
<li><a href="<?= $urlpath . '/' . $row['Name'] ?>.tar.gz"><?= __('Download tarball') ?></a></li>
|
||||
<li><a href="<?= $cgit_uri . $row['Name'] . '.git' ?>/tree/PKGBUILD"><?= __('View PKGBUILD') ?></a></li>
|
||||
<li><a href="<?= $cgit_uri . $row['Name'] . '.git' ?>/snapshot/master.tar.gz"><?= __('Download snapshot') ?></a></li>
|
||||
<li><a href="https://wiki.archlinux.org/index.php/Special:Search?search=<?= urlencode($row['Name']) ?>"><?= __('Search wiki') ?></a></li>
|
||||
<li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li>
|
||||
<?php if ($uid): ?>
|
||||
|
|
Loading…
Add table
Reference in a new issue