Custom landing page search broken in MySQL

Bug #1797299 reported by Rebecca Blundell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Cecilia Vela Gurovic

Bug Description

The search box that allows you to choose the page to make a custom landing page doesn't work in MySQL. Note that it works fine in Postgresql.

Steps to reproduce:
Use MySQL as a db.
Have at least a site admin and one other user.
Log in as the site admin.
Create a site page called "Custom landing page".
Go to Configure site -> Site options -> Site settings and change the radio button for Custom landing page to yes.
Type 'Cu' or 'Custom landing page' into the Landing page text field.

Expected outcome:
The page you created called "Custom landing page" appears in the box.
You can save it.
If you log out and log in as the admin or the other user, you will see that page.

Actual outcome:
Nothing appears in the search box.
If you save the text 'Custom landing page', it is not linked to the page and nobody sees it when they log in.
If you hit the back button in the browser after attempting to save the landing page, you get a long SQL error:

WAR] 4f (lib/dml.php:517) 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 'ILIKE '%c%' OR g.name ILIKE '%c%' OR i.name ILIKE '%c%')
            UNION
    ' at line 13] in EXECUTE("SELECT COUNT(*) FROM (SELECT v.id, v.title, v.owner, v.group, v.institution, 'view' AS urltype
            FROM "view" v
            JOIN "view_access" va ON va.view = v.id
            LEFT JOIN "group" g ON g.id = v.group
            LEFT JOIN "institution" i ON i.name = v.institution
            WHERE va.accesstype IN ('public', 'loggedin')
            AND v.type != 'profile'
            AND (
                (v.owner IS NULL AND v.template != 2)
                  OR
                (v.owner IN ('1'))
            )
            AND (v.title ILIKE '%c%' OR g.name ILIKE '%c%' OR i.name ILIKE '%c%')
            UNION
            SELECT ii.id, ii.title, NULL AS owner, g.id AS group, g.institution, 'forum' AS urltype
            FROM "interaction_instance" ii
            JOIN "group" g ON g.id = ii.group
            WHERE g.public = 1
            AND ii.deleted = 0
            AND (ii.title ILIKE '%c%')
            ) AS foo OFFSET 0 LIMIT 10")Command was: SELECT COUNT(*) FROM (SELECT v.id, v.title, v.owner, v.group, v.institution, 'view' AS urltype
            FROM "view" v
            JOIN "view_access" va ON va.view = v.id
            LEFT JOIN "group" g ON g.id = v.group
            LEFT JOIN "institution" i ON i.name = v.institution
            WHERE va.accesstype IN ('public', 'loggedin')
            AND v.type != 'profile'
            AND (
                (v.owner IS NULL AND v.template != 2)
                  OR
                (v.owner IN ('1'))
            )
            AND (v.title ILIKE ? OR g.name ILIKE ? OR i.name ILIKE ?)
            UNION
            SELECT ii.id, ii.title, NULL AS owner, g.id AS group, g.institution, 'forum' AS urltype
            FROM "interaction_instance" ii
            JOIN "group" g ON g.id = ii.group
            WHERE g.public = 1
            AND ii.deleted = 0
            AND (ii.title ILIKE ?)
            ) AS foo OFFSET ? LIMIT ? and values was (0:%c%,1:%c%,2:%c%,3:%c%,4:0,5:10)

Changed in mahara:
status: New → Confirmed
importance: Undecided → High
milestone: none → 18.10rc2
summary: - 18.10 RC2: Custom landing page search broken in MySQL
+ Custom landing page search broken in MySQL
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/9216

Changed in mahara:
assignee: nobody → Cecilia Vela Gurovic (ceciliavg)
status: Confirmed → In Progress
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/9216
Committed: https://git.mahara.org/mahara/mahara/commit/42847407ab90981baca99dbe5279a0b9f1eababf
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 42847407ab90981baca99dbe5279a0b9f1eababf
Author: Cecilia Vela Gurovic <email address hidden>
Date: Fri Oct 12 08:48:42 2018 +1300

Bug 1797299: replace ILIKE in sql query for db_ilike()

And fix for a couple of errors in query

behatnotneeded

Change-Id: I1ba8dd4e517fa738161d636b05e886d4f09757e6

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "18.10_STABLE" branch: https://reviews.mahara.org/9224

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

Reviewed: https://reviews.mahara.org/9224
Committed: https://git.mahara.org/mahara/mahara/commit/73fe99d7aaa3c528d0fbc1c7bebd5e9ed74d839d
Submitter: Robert Lyon (<email address hidden>)
Branch: 18.10_STABLE

commit 73fe99d7aaa3c528d0fbc1c7bebd5e9ed74d839d
Author: Cecilia Vela Gurovic <email address hidden>
Date: Fri Oct 12 08:48:42 2018 +1300

Bug 1797299: replace ILIKE in sql query for db_ilike()

And fix for a couple of errors in query

behatnotneeded

Change-Id: I1ba8dd4e517fa738161d636b05e886d4f09757e6
(cherry picked from commit 42847407ab90981baca99dbe5279a0b9f1eababf)

Robert Lyon (robertl-9)
Changed in mahara:
milestone: 18.10rc2 → 18.10.0
status: In Progress → Fix Committed
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.