diff --git a/conf/config.proto b/conf/config.proto new file mode 100644 index 00000000..280c1e8d --- /dev/null +++ b/conf/config.proto @@ -0,0 +1,29 @@ +[database] +dsn_prefix = mysql +host = localhost +socket = /var/run/mysqld/mysqld.sock +name = AUR +user = aur +password = aur + +[paths] +storage = /srv/aur/unsupported/ + +[options] +username_min_len = 3 +username_max_len = 16 +passwd_min_len = 4 +default_lang = en +sql_debug = 0 +max_sessions_per_user = 8 +login_timeout = 7200 +persistent_cookie_timeout = 2592000 +max_filesize_uncompressed = 8388608 +disable_http_login = 1 +aur_location = http://localhost +package_url = /packages/ +use_virtual_urls = 1 +max_rpc_results = 5000 +aur_request_ml = aur-requests@archlinux.org +request_idle_time = 1209600 +auto_orphan_age = 15552000 diff --git a/scripts/aurblup/aurblup-wrapper b/scripts/aurblup/aurblup-wrapper index b056030d..c7b20afe 100755 --- a/scripts/aurblup/aurblup-wrapper +++ b/scripts/aurblup/aurblup-wrapper @@ -8,10 +8,14 @@ if (empty($dir)) { } set_include_path(get_include_path() . PATH_SEPARATOR . "$dir/lib"); -include("config.inc.php"); +include("confparser.inc.php"); + +$user = config_get('database', 'user'); +$password = config_get('database', 'password'); +$name = config_get('database', 'name'); exec($dir . "/../scripts/aurblup/aurblup " . "-S /var/run/mysqld/mysqld.sock " . - "-u " . escapeshellarg(AUR_db_user) . " " . - "-p " . escapeshellarg(AUR_db_pass) . " " . - "-D " . escapeshellarg(AUR_db_name)); + "-u " . escapeshellarg($user) . " " . + "-p " . escapeshellarg($password) . " " . + "-D " . escapeshellarg($name)); diff --git a/scripts/cleanup b/scripts/cleanup index 1fe63a27..0ccbe7df 100755 --- a/scripts/cleanup +++ b/scripts/cleanup @@ -16,24 +16,25 @@ if (empty($dir)) { } set_include_path(get_include_path() . PATH_SEPARATOR . "$dir/lib"); -include("config.inc.php"); +include("confparser.inc.php"); include("aur.inc.php"); include("pkgfuncs.inc.php"); $count = 0; -$buckets = scandir(INCOMING_DIR); +$incoming_dir = config_get('paths', 'storage'); +$buckets = scandir($incoming_dir); foreach ($buckets as $bucket) { - $bucketpath = INCOMING_DIR . $bucket; + $bucketpath = $incoming_dir . $bucket; if ($bucket == '.' || $bucket == '..' || !is_dir($bucketpath)) { continue; } - $files = scandir(INCOMING_DIR . $bucket); + $files = scandir($incoming_dir . $bucket); foreach ($files as $pkgname) { if ($pkgname == '.' || $pkgname == '..') { continue; } - $fullpath = INCOMING_DIR . $bucket . "/" . $pkgname; + $fullpath = $incoming_dir . $bucket . "/" . $pkgname; if (!pkg_from_name($pkgname) && is_dir($fullpath)) { echo 'Removing ' . $fullpath . "\n"; rm_tree($fullpath); diff --git a/upgrading/3.5.0.txt b/upgrading/3.5.0.txt index 1990c47a..e8af4af8 100644 --- a/upgrading/3.5.0.txt +++ b/upgrading/3.5.0.txt @@ -17,3 +17,7 @@ ALTER TABLE PackageVotes ADD COLUMN VoteTS BIGINT NULL DEFAULT NULL; ---- INSERT INTO PackageCategories (Category) VALUES ('wayland'); ---- + +4. The configuration file format has been changed. Make sure you convert +web/lib/config.inc.php to the new format (see conf/config.proto for an example +configuration) and put the resulting file in conf/config. diff --git a/web/html/login.php b/web/html/login.php index e458fec0..dba3af53 100644 --- a/web/html/login.php +++ b/web/html/login.php @@ -5,7 +5,8 @@ include_once("aur.inc.php"); set_lang(); check_sid(); -if (!$DISABLE_HTTP_LOGIN || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'])) { +$disable_http_login = config_get_bool('options', 'disable_http_login'); +if (!$disable_http_login || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'])) { $login = try_login(); $login_error = $login['error']; } @@ -19,7 +20,7 @@ html_header('AUR ' . __("Login")); ' . username_from_sid($_COOKIE["AURSID"]) . ''); ?> []

- +
@@ -28,7 +29,7 @@ html_header('AUR ' . __("Login"));

- +

@@ -47,7 +48,7 @@ html_header('AUR ' . __("Login"));

', ''); ?> + '', ''); ?>

diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index 8cecd673..be9220ec 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -1,7 +1,6 @@ $MAX_FILESIZE_UNCOMPRESSED) { + if ($filesize_uncompressed > $max_filesize_uncompressed) { $error = __("Error - uncompressed file size too large."); } } @@ -273,7 +273,7 @@ if ($uid): } if (isset($pkgbase_name)) { - $incoming_pkgdir = INCOMING_DIR . substr($pkgbase_name, 0, 2) . "/" . $pkgbase_name; + $incoming_pkgdir = config_get('paths', 'storage') . substr($pkgbase_name, 0, 2) . "/" . $pkgbase_name; } /* Upload PKGBUILD and tarball. */ diff --git a/web/lib/DB.class.php b/web/lib/DB.class.php index 09759892..b538e0d3 100644 --- a/web/lib/DB.class.php +++ b/web/lib/DB.class.php @@ -1,5 +1,7 @@ exec("SET NAMES 'utf8' COLLATE 'utf8_general_ci';"); } catch (PDOException $e) { die('Error - Could not connect to AUR database'); diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index 2272010d..1d38fe11 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -89,7 +89,7 @@ function display_account_form($A,$U="",$T="",$S="", */ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="", $P="",$C="",$R="",$L="",$I="",$K="",$J="",$UID=0) { - global $SUPPORTED_LANGS, $AUR_LOCATION; + global $SUPPORTED_LANGS; $error = ''; @@ -118,9 +118,11 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="", } if (!$error && !valid_username($U)) { + $length_min = config_get_int('options', 'username_min_len'); + $length_max = config_get_int('options', 'username_max_len'); + $error = __("The username is invalid.") . "