Clean expired passwords causes error when upgrading from 1.8

Bug #1369370 reported by Ghada El-Zoghbi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Ghada El-Zoghbi
1.10
Fix Released
High
Unassigned
1.9
Fix Released
High
Unassigned
15.04
Fix Released
High
Ghada El-Zoghbi

Bug Description

Mahara: 1.10.0dev
OS: Linux
DB: Postgres
Browser: any

The change put in to fix the cleaning of expired passwords has introduced a bug that causes a duplicate error when trying to upgrade from 1.8 to 1.10.

[WAR] b8 (lib/errors.php:739) Failed to get a recordset: postgres7 error: [-5: ERROR: duplicate key value violates unique constraint "cron_cal_uk", referer: http://d.mahara/admin/upgrade.php
[Mon Sep 15 11:44:24 2014] [error] [client 192.168.124.138] [WAR] b8 (lib/errors.php:739) DETAIL: Key (callfunction)=(auth_clean_expired_password_requests) already exists.] in adodb_throw(INSERT INTO "cron" ("callfunction", "minute", "hour", "day", "month", "dayofweek") VALUES (?, ?, ?, ?, ?, ?), Array), referer: http://d.mahara/admin/upgrade.php
[Mon Sep 15 11:44:24 2014] [error] [client 192.168.124.138] [WAR] b8 (lib/errors.php:739) Command was: INSERT INTO "cron" ("callfunction", "minute", "hour", "day", "month", "dayofweek") VALUES (?, ?, ?, ?, ?, ?) and values was (auth_clean_expired_password_requests,5,0,*,*,*), referer: http://d.mahara/admin/upgrade.php
[Mon Sep 15 11:44:24 2014] [error] [client 192.168.124.138] Call stack (most recent first):, referer: http://d.mahara/admin/upgrade.php
[Mon Sep 15 11:44:24 2014] [error] [client 192.168.124.138] * log_message("Failed to get a recordset: postgres7 error: [-5: E...", 8, true, true) at /var/www/maharacode/mahara/htdocs/lib/errors.php:95, referer: http://d.mahara/admin/upgrade.php
[Mon Sep 15 11:44:24 2014] [error] [client 192.168.124.138] * log_warn("Failed to get a recordset: postgres7 error: [-5: E...") at /var/www/maharacode/mahara/htdocs/lib/errors.php:739, referer: http://d.mahara/admin/upgrade.php
[Mon Sep 15 11:44:24 2014] [error] [client 192.168.124.138] * SQLException->__construct("Failed to get a recordset: postgres7 error: [-5: E...") at /var/www/maharacode/mahara/htdocs/lib/dml.php:1046, referer: http://d.mahara/admin/upgrade.php
[Mon Sep 15 11:44:24 2014] [error] [client 192.168.124.138] * insert_record("cron", object(stdClass), false, false) at /var/www/maharacode/mahara/htdocs/lib/dml.php:1133, referer: http://d.mahara/admin/upgrade.php
[Mon Sep 15 11:44:24 2014] [error] [client 192.168.124.138] * ensure_record_exists("cron", object(stdClass), object(stdClass)) at /var/www/maharacode/mahara/htdocs/lib/db/upgrade.php:3418, referer: http://d.mahara/admin/upgrade.php
[Mon Sep 15 11:44:24 2014] [error] [client 192.168.124.138] * xmldb_core_upgrade("2013101417") at /var/www/maharacode/mahara/htdocs/lib/upgrade.php:325, referer: http://d.mahara/admin/upgrade.php
[Mon Sep 15 11:44:24 2014] [error] [client 192.168.124.138] * upgrade_core(object(stdClass)) at /var/www/maharacode/mahara/htdocs/admin/upgrade.json.php:86, referer: http://d.mahara/admin/upgrade.php
[Mon Sep 15 11:44:24 2014] [error] [client 192.168.124.138] , referer: http://d.mahara/admin/upgrade.php

The reason is because the check if the record exists needs to pass a $where array that doesn't include the items to be updated.
i.e. $where = array('callfunction' => 'auth_clean_expired_password_requests');

Tags: regression
Revision history for this message
Ghada El-Zoghbi (ghada-z) wrote :

Related to this bug:

https://bugs.launchpad.net/mahara/+bug/1296472

Probably need to perform same fix in 1.8 and 1.9.

Changed in mahara:
assignee: nobody → Ghada El-Zoghbi (ghada-z)
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/3696

Changed in mahara:
status: New → In Progress
Aaron Wells (u-aaronw)
Changed in mahara:
milestone: none → 1.10.0
importance: Undecided → High
tags: added: regression
Aaron Wells (u-aaronw)
Changed in mahara:
milestone: 1.10.0 → 1.10.1
Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "1.9_STABLE" branch: https://reviews.mahara.org/4021

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "1.10_STABLE" branch: https://reviews.mahara.org/4022

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/3696
Committed: http://gitorious.org/mahara/mahara/commit/8f371b7d4823767410f96e87ccf329f596d80600
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 8f371b7d4823767410f96e87ccf329f596d80600
Author: Ghada El-Zoghbi <email address hidden>
Date: Mon Sep 15 12:07:27 2014 +1000

Clean expired passwords causes error when upgrading (bug 1369370)

When upgrading, should only check if the cron job 'auth_clean_expired_password_requests' already exists
in the table - without all the other fields that need to be updated.
Otherwise, it will check on all the fields (i.e. minute, hour, etc). If the admin updated them,
the check won't match and a duplicate error results.

Change-Id: I2d30ac97e9a82aaf0d538a834396fdc2d2757480
Signed-off-by: Ghada El-Zoghbi <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/4021
Committed: http://gitorious.org/mahara/mahara/commit/b8abf3358cc21f877f3037097978104a15d06fa2
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.9_STABLE

commit b8abf3358cc21f877f3037097978104a15d06fa2
Author: Robert Lyon <email address hidden>
Date: Mon Nov 24 13:38:38 2014 +1300

Clean expired passwords causes error when upgrading (bug 1369370)

When upgrading, should only check if the cron job
'auth_clean_expired_password_requests' already exists
in the table - without all the other fields that need to be updated.
Otherwise, it will check on all the fields (i.e. minute, hour, etc).
If the admin updated them,
the check won't match and a duplicate error results.

Change-Id: I2d30ac97e9a82aaf0d538a834396fdc2d2757480
Signed-off-by: Ghada El-Zoghbi <email address hidden>
Signed-off-by: Robert Lyon <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/4022
Committed: http://gitorious.org/mahara/mahara/commit/3ebfd80e6509453a82d5f53f7ddbe7bd4d709de0
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.10_STABLE

commit 3ebfd80e6509453a82d5f53f7ddbe7bd4d709de0
Author: Robert Lyon <email address hidden>
Date: Mon Nov 24 13:41:17 2014 +1300

Clean expired passwords causes error when upgrading (bug 1369370)

When upgrading, should only check if the cron job
'auth_clean_expired_password_requests' already exists
in the table - without all the other fields that need to be updated.
Otherwise, it will check on all the fields (i.e. minute, hour, etc).
If the admin updated them,
the check won't match and a duplicate error results.

Change-Id: I2d30ac97e9a82aaf0d538a834396fdc2d2757480
Signed-off-by: Ghada El-Zoghbi <email address hidden>
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9)
no longer affects: mahara/1.8
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.