← Back to team overview

mahara-contributors team mailing list archive

[Bug 1399311] Re: SQL syntax error in cron_event_log_expire on key word SECONDS

 

Hi David,

You are correct. It should be keyword SECOND not keyword SECONDS.
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html
#function_date-add

Looks like this slipped through code review when masquerade logging was
added, in Mahara 1.7. I'll upload a patch.

Cheers,
Aaron

** Also affects: mahara/15.04
   Importance: Undecided
       Status: New

** Also affects: mahara/1.10
   Importance: Undecided
       Status: New

** Also affects: mahara/1.9
   Importance: Undecided
       Status: New

** Also affects: mahara/1.8
   Importance: Undecided
       Status: New

** Changed in: mahara/1.10
       Status: New => Confirmed

** Changed in: mahara/1.8
       Status: New => Confirmed

** Changed in: mahara/1.9
       Status: New => Confirmed

** Changed in: mahara/15.04
       Status: New => Confirmed

** Changed in: mahara/15.04
   Importance: Undecided => Medium

** Changed in: mahara/1.9
   Importance: Undecided => Medium

** Changed in: mahara/1.8
   Importance: Undecided => Medium

** Changed in: mahara/1.10
   Importance: Undecided => Medium

** Changed in: mahara/15.04
    Milestone: None => 15.04.0

** Changed in: mahara/1.9
    Milestone: None => 1.9.5

** Changed in: mahara/1.8
    Milestone: None => 1.8.7

** Changed in: mahara/1.10
    Milestone: None => 1.10.2

** Changed in: mahara/1.10
     Assignee: (unassigned) => Aaron Wells (u-aaronw)

** Changed in: mahara/1.8
     Assignee: (unassigned) => Aaron Wells (u-aaronw)

** Changed in: mahara/1.9
     Assignee: (unassigned) => Aaron Wells (u-aaronw)

** Changed in: mahara/15.04
     Assignee: (unassigned) => Aaron Wells (u-aaronw)

** Tags added: cron

** Tags added: mysql

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1399311

Title:
  SQL syntax error in cron_event_log_expire on key word SECONDS

Status in Mahara ePortfolio:
  Confirmed
Status in Mahara 1.10 series:
  Confirmed
Status in Mahara 1.8 series:
  Confirmed
Status in Mahara 1.9 series:
  Confirmed
Status in Mahara 15.04 series:
  Confirmed

Bug description:
  Mahara v1.10.0, Linux, MySQL.

  We run Mahara on MySQL, and we get this error with our Cron :

  {code}
  [INF] b8 (lib/cron.php:137) Running core cron cron_event_log_expire
  [WAR] b8 (lib/errors.php:745) Failed to get a recordset: mysqli error: [1064: You have an error in your SQL syntax; check the manual that corresponds to 
  your MySQL server version for the right syntax to use near 'SECONDS' at line 1] in EXECUTE("DELETE FROM "mhr_event_log" WHERE time < CURRENT_DATE - INTERVAL 31536000 SECONDS")
  [WAR] b8 (lib/errors.php:745) Command was: DELETE FROM "mhr_event_log" WHERE time < CURRENT_DATE - INTERVAL 31536000 SECONDS
  Call stack (most recent first):
    * log_message("Failed to get a recordset: mysqli error: [1064: Yo...", 8, true, true) at /app/apache2/htdocs/portfolio/lib/errors.php:95
    * log_warn("Failed to get a recordset: mysqli error: [1064: Yo...") at /app/apache2/htdocs/portfolio/lib/errors.php:745
    * SQLException->__construct("Failed to get a recordset: mysqli error: [1064: Yo...") at /app/apache2/htdocs/portfolio/lib/dml.php:959
    * delete_records_sql("DELETE FROM "mhr_event_log" WHERE time < CURRENT_D...", null) at /app/apache2/htdocs/portfolio/lib/dml.php:936
    * delete_records_select("event_log", "time < CURRENT_DATE - INTERVAL 31536000 SECONDS") at /app/apache2/htdocs/portfolio/lib/mahara.php:3746
    * cron_event_log_expire() at /app/apache2/htdocs/portfolio/lib/cron.php:142

  
  In the cron_event_log_expire() method of /lib/mahara.php, the key word "SECONDS" is used; it should be "SECOND", shouldn't it?

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1399311/+subscriptions


References