Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-27261

Recent Files repository fails with MSSQL SQL error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a bug
    • Icon: Major Major
    • None
    • 2.0.2
    • Repositories
    • Windows Server 2008 R2 SP1 with SQL 2008 R2, PHP 5.3.5

      Choosing Recent Files repository in the filepicker always returns a Database Error window.
      An SQL error message is logged in the PHP-errors log file, see attached example of the error.

      Changed LIB.PHP in the Recent repository:

      Use this SQL query:
      $sql = 'SELECT * FROM

      {files} files1
      JOIN (SELECT MAX(id) AS maxid
      FROM {files}

      WHERE userid = ? AND filename != ? AND ((filearea = ? AND itemid = ?) OR filearea != ?)
      GROUP BY contenthash, filename) files2 ON files1.id = files2.maxid
      ORDER BY files1.timemodified DESC';

      Is joining the table onto itself and was returning the same fieldnames more than once, removed dups and renamed the key.

      Now works as expected.

            dongsheng Dongsheng Cai
            mark.emery Mark Emery
            Andrew Davis Andrew Davis
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.