On Thu, Aug 11, 2011 at 8:38 AM, Lukas Fleischer <archlinux@cryptocrack.de> wrote:
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@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 :)
Ack. I was working in pkgfuncs where you do not. It seems to be a coding style per file around here... $ git grep 'True' | cat web/html/packages.php: $output = pkg_flag($atype, $ids, True); web/html/packages.php: $output = pkg_adopt($atype, $ids, True); web/html/packages.php: $output = pkg_vote($atype, $ids, True); web/html/pkgsubmit.php: pkg_notify(account_from_sid($_COOKIE["AURSID"], $dbh), array($packageID), True, $dbh); web/lib/pkgfuncs.inc.php: * @param boolean $action True flags out-of-date, false un-flags. Flags by web/lib/pkgfuncs.inc.php:function pkg_flag ($atype, $ids, $action=True, $dbh=NULL) { web/lib/pkgfuncs.inc.php:function pkg_adopt ($atype, $ids, $action=True, $dbh=NULL) { web/lib/pkgfuncs.inc.php:function pkg_vote ($atype, $ids, $action=True, $dbh=NULL) { web/lib/pkgfuncs.inc.php:function pkg_notify ($atype, $ids, $action=True, $dbh=NULL) { web/lib/pkgfuncs.inc.php: $first = True; -Dan