osTicket / osTicket-plugins

Core plugins for osTicket (v1.8+)
GNU General Public License v2.0
148 stars 162 forks source link

Migrating attachments to FS failing with exception: "Unknown column 'A2.status'" #92

Open shoan opened 8 years ago

shoan commented 8 years ago

I am attempting to migrate all attachments from the database to the filesystem, in the hope to speed up the system. I followed this guide, but ended up with the following exception. It appears that the query being built is incorrect. The ost_ticket table does not contain a column named 'status'. Instead it has 'status_id'.

root@intranet:/var/www/wfm# sudo -u www-data php _setup/cli/manage.php file migrate --backend D --to F --status=closed --min-size=8000 --limit=1
PHP Fatal error:  Uncaught exception 'Exception' with message 'Unable to prepare query: Unknown column 'A2.status' in 'where clause' SELECT `ost_file`.* FROM `ost_file` LEFT JOIN `ost_ticket_attachment` A1 ON (`ost_file`.`id` = A1.`file_id`) JOIN `ost_ticket` A2 ON (A1.`ticket_id` = A2.`ticket_id`) WHERE `ost_file`.`bk` = ? AND A2.`status` = ? AND `ost_file`.`size` >= ? LIMIT 1' in /var/www/wfm/include/class.orm.php:1028
Stack trace:
#0 /var/www/wfm/include/class.orm.php(1022): MysqlExecutor->execute()
#1 /var/www/wfm/include/class.orm.php(1090): MysqlExecutor->_prepare()
#2 /var/www/wfm/include/class.orm.php(458): MysqlExecutor->getArray()
#3 /var/www/wfm/include/class.orm.php(488): ModelInstanceIterator->fillTo(0)
#4 /var/www/wfm/_setup/cli/modules/file.php(161): ModelInstanceIterator->valid()
#5 /var/www/wfm/_setup/cli/modules/class.module.php(239): FileManager->run(Array, Array)
#6 /var/www/wfmport in /var/www/wfm/include/class.orm.php on line 1028
greezybacon commented 8 years ago

What version of osTicket are you using with the plugin?

shoan commented 8 years ago

Sorry for the delay. I am using v1.9.7 (4be5782)