Aiwa Posted November 28, 2023 Posted November 28, 2023 (edited) Clarifying what some tasks do, the desire to rename the task file / class is really needed. That said, when updating an existing installation of the application, the originally named task still exists in the applications task folder. It is also present when viewing all tasks, because it's sticking around in the core_tasks table. Running this query on upgrade appears to fail. Am I missing something? Double check the query syntax for me. \IPS\Db::i()->delete( 'core_tasks', array ('key=? AND app=?','steamCleanup','steam') ) Edited November 28, 2023 by Aiwa
teraßyte Posted November 28, 2023 Posted November 28, 2023 Have you double-checked the old task isn't present anymore in the tasks.json file? I had the same issue once, and the problem was that the code kept re-adding it because it was still in the file.
Aiwa Posted November 28, 2023 Author Posted November 28, 2023 😞 it’s not in the tasks.json. Do I need to escape quotes so it treats the values as strings? I’ll have to try that as soon as I get back to my machine this evening.
Solution Ryan Ashbrook Posted November 28, 2023 Solution Posted November 28, 2023 I believe key is a reserved keyword in MySQL. Try this. \IPS\Db::i()->delete( 'core_tasks', array ('`key`=? AND app=?','steamCleanup','steam') ) teraßyte and Aiwa 2
teraßyte Posted November 28, 2023 Posted November 28, 2023 Ah, yes. I encountered that same issue recently on a client's site using my Moods application. Adding backticks solved it. I didn't think of that because without backticks the query threw a specific error about having a wrong LIMIT value, and you didn't mention anything like that. 😅 Ryan Ashbrook 1
Aiwa Posted November 29, 2023 Author Posted November 29, 2023 Thanks @Ryan Ashbrook ! That did it. I completely glossed over the fact that it was a keyword. I write enough SQL queries at work I don't know how I missed that. That said, I use a SQL syntax editor that catches that for me when I forget. 'name' is probably another one someone is likely to hit. 😄 @teraßyte, an error was being thrown, but it was the last 10ish characters of the query with a generic syntax error message.
Recommended Posts