Problem/Motivation
LinkCleanUp::doCleanupQueues() queries the {queue} table when a linkcheckerlink entity is deleted.
Core does not create this table until the first queue item is added. On a new site where nothing has been queued yet, deleting a link therefore causes:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'queue' doesn't exist
This can happen during normal content editing when a link is removed or content is deleted.
The existing kernel test hides the problem by creating the queue table manually in setUp().
Steps to reproduce
- Install Link checker and configure a field for link extraction.
- Do not run cron.
- Create content containing a link.
- Edit the content and remove the link, or delete the content.
- Check the logs for the missing
queuetable exception.
Proposed resolution
Before querying {queue}, check whether the table exists. If it does not, there cannot be any queue items to clean up.
Apply the same guard to linkchecker_post_update_remove_orphaned_queue_data().
Update the kernel test so it covers deleting links when the queue table has not yet been created.
Issue fork linkchecker-3624900
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
joelpittetThe guard works better here so we don't try to loop over the results of a non-existing table.