[aur-dev] [PATCH 3/3] Make package creation and update atomic
Lukas Fleischer
archlinux at cryptocrack.de
Thu Aug 11 09:38:46 EDT 2011
On Wed, Aug 10, 2011 at 06:20:07PM -0500, Dan McGee wrote:
> Add BEGIN and COMMIT statements where it makes sense to do so. This
> allows the entire package creation or update process to be atomic and
> not be seen until it is complete.
>
> Signed-off-by: Dan McGee <dan at archlinux.org>
> ---
> web/html/pkgsubmit.php | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
> index 6d1b11f..2aa5df2 100644
> --- a/web/html/pkgsubmit.php
> +++ b/web/html/pkgsubmit.php
> @@ -299,6 +299,7 @@ if ($uid):
> if (!$error) {
>
> $dbh = db_connect();
> + db_query("BEGIN", $dbh);
>
> $q = "SELECT * FROM Packages WHERE Name = '" . mysql_real_escape_string($new_pkgbuild['pkgname']) . "'";
> $result = db_query($q, $dbh);
> @@ -391,9 +392,12 @@ if ($uid):
> # If we just created this package, or it was an orphan and we
> # auto-adopted, add submitting user to the notification list.
> if (!$pdata || $pdata["MaintainerUID"] === NULL) {
> - pkg_notify(account_from_sid($_COOKIE["AURSID"]), array($packageID));
> + pkg_notify(account_from_sid($_COOKIE["AURSID"], $dbh), array($packageID), True, $dbh);
Changed "True" to "true". Sorry for being pedantic but we always use
lowercase here :)
> }
>
> + # Entire package creation process is atomic
> + db_query("COMMIT", $dbh);
> +
> header('Location: packages.php?ID=' . $packageID);
> }
>
> --
> 1.7.6
More information about the aur-dev
mailing list