Issue Details (XML | Word | Printable)

Key: MDL-12565
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Mathieu Petit-Clair
Reporter: John Beedell
Votes: 1
Watchers: 2
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-13404

Fix tag cron error

Created: 13/Dec/07 08:17 PM   Updated: 22/Feb/08 07:35 PM
Return to search
Component/s: Tags
Affects Version/s: 1.9
Fix Version/s: 1.9

Issue Links:
Dependency
 

Participants: Eloy Lafuente (stronk7), Eric Merrill, John Beedell, Martin Dougiamas and Mathieu Petit-Clair
Security Level: None
Resolved date: 22/Feb/08
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_19_STABLE


 Description  « Hide
This error is generated occasionally when running admin/cron.php

<div class="notifytiny" style="text-align:center">ERROR: relation "core_blog" does not exist<br /><br />
    DELETE FROM core_tag_instance WHERE
                core_tag_instance.id
            IN
                ( SELECT sq1.id
                FROM
                    (SELECT sq2.*
                     FROM core_tag_instance sq2
                     LEFT JOIN core_blog item
                     ON sq2.itemid = item.id
                     WHERE item.id IS NULL
                     AND sq2.itemtype = 'blog')
                sq1
                ) <ul style="text-align: left"><li>line 1393 of lib/dmllib.php: call to debugging()</li><li>line 917 of tag/lib.php: call to delete_records_select()</li><li>line 1132 of tag/lib.php: call to tag_instance_table_cleanup()</li><li>line 339 of admin/cron.php: call to tag_cron()</li></ul></div>

This is an interesting error, as it has taken some time for me to spot it. The call to tag_cron() is within the 'only call occasionally' section of admin/cron.php, so it does not always appear.

The fix is very easy. The table <prefix>blog no longer exists. So changing the appropriate line in this query solves the issue:

LEFT JOIN core_blog item //original line
LEFT JOIN core_tag item //corrected line

In the code it is line 910 of tag/lib.php where the variable $type->itemtype should be replaced with 'tag', as is already done in the case just below on line 930.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Mathieu Petit-Clair committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 25/Jan/08 11:31 AM
MDL-12565 - add AS to prevent problem with pgsql
MODIFY tag/lib.php   Rev. 1.43.2.8    (+1 -1 lines)
Mathieu Petit-Clair committed 1 file to 'Moodle CVS' - 25/Jan/08 11:32 AM
MDL-12565 - add AS to prevent problem with pgsql
MODIFY tag/lib.php   Rev. 1.51    (+1 -1 lines)
Mathieu Petit-Clair committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 25/Jan/08 11:43 AM
MDL-12565 : use the right table
MODIFY tag/lib.php   Rev. 1.43.2.9    (+1 -1 lines)
Mathieu Petit-Clair committed 1 file to 'Moodle CVS' - 25/Jan/08 11:43 AM
MDL-12565 : use the right table
MODIFY tag/lib.php   Rev. 1.52    (+1 -1 lines)
Mathieu Petit-Clair committed 2 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 06/Feb/08 12:34 PM
Fix for MDLSITE-345 and correction to MDL-12565. This doesn't solve it all
though : there will still be "orphans" tags in table tag.
MODIFY tag/lib.php   Rev. 1.43.2.10    (+1 -1 lines)
MODIFY blog/lib.php   Rev. 1.80.2.1    (+2 -2 lines)