plugin-autocloser icon indicating copy to clipboard operation
plugin-autocloser copied to clipboard

DB Error #1062 in System Logs osTicket (v1.17.3)

Open leon1298 opened this issue 2 years ago • 1 comments

When the plugin is active, it generates a "Duplicate entry" error in the osTicket system logs every time it runs (every cron which i have setup to run every 2 min).

The error message is as follows:

DB Error #1062 [INSERT INTO ost_config SET key = 'last-run', value = 1684269962, updated = NOW()] Duplicate entry 'last-run' for key 'ost_config.namespace'

---- Backtrace ----
#0 (root)/include/mysqli.php(211): osTicket->logDBError()
#1 (root)/include/class.orm.php(3482): db_query()
#2 (root)/include/class.orm.php(658): MySqlExecutor->execute()
#3 (root)/include/class.config.php(181): VerySimpleModel->save()
#4 (root)/include/class.config.php(114): ConfigItem->save()
#5 (root)/include/class.config.php(124): Config->create()
#6 (root)/include/class.config.php(89): Config->update()
#7 (root)/include/plugins/plugin-autocloser-master/class.CloserPlugin.php(188): Config->set()
#8 (root)/include/plugins/plugin-autocloser-master/class.CloserPlugin.php(79): CloserPlugin->is_time_to_run()
#9 (root)/include/plugins/plugin-autocloser-master/class.CloserPlugin.php(68): CloserPlugin->logans_run_mode()
#10 (root)/include/class.signal.php(98): CloserPlugin->{closure}()
#11 (root)/include/class.cron.php(122): Signal::send()
#12 (root)/include/api.cron.php(15): Cron::run()
#13 (root)/include/api.cron.php(45): CronApiController->run()
#14 (root)/api/cron.php(23): LocalCronApiController::call()
#15 {main}

I've tried modifying the plugin code to update the last-run key instead of inserting a new entry, but the error still persists.

The issue seems to be related to the last-run key in the ost_config table. Clearing the entry in the database temporarily resolves the issue, but the error reappears after the plugin runs again.

Any guidance on modifying the plugin code or other suggestions would be greatly appreciated.

image

leon1298 avatar May 17 '23 14:05 leon1298

Hi, refer to https://github.com/clonemeagain/plugin-autocloser/issues/44#issuecomment-1293274853

Worked for me.

franz-dev avatar Jul 11 '23 12:07 franz-dev