Be sure to checkout our newest add-on Reading Time Pro!

EE4 compatibility updates:

  • Publisher is EE4 and EE5 compatible, but it does not currently support the Fluid field (it's in the works).
  • Reel is EE4 and EE5 compatible, but it does not currently support the Fluid field.

Ticket: SQL error when updating 2.11.1 to 2.11.2

Status Resolved
Add-on / Version Publisher 2.11.2
Severity
EE Version 5.2.6

Kevin Chatel

Aug 24, 2019

Hi Brian,
I’m getting an SQL error when updating to the latest build. here is the output

Exception Caught
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 3:
DELETE FROM `exp_publisher_templates` WHERE `type` = 'template' AND `type_id` NOT IN ()
ee/legacy/database/drivers/mysqli/mysqli_connection.php:117

Stack Trace: Please include when reporting this error
#0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(112): CI_DB_mysqli_connection->query('DELETE FROM `ex…')
#1 ee/legacy/database/DB_driver.php(270): CI_DB_mysqli_driver->_execute('DELETE FROM `ex…')
#2 ee/legacy/database/DB_driver.php(180): CI_DB_driver->simple_query('DELETE FROM `ex…')
#3 ee/legacy/database/DB_active_rec.php(1748): CI_DB_driver->query('DELETE FROM `ex…')
#4 user/addons/publisher/updates/up_2_11_02.php(20): CI_DB_active_record->delete('`exp_publisher_…')
#5 user/addons/publisher/vendor/litzinger/basee/src/Updater.php(95): Update_2_11_02->doUpdate()
#6 user/addons/publisher/upd.publisher.php(553): Basee\Updater->runUpdates()
#7 ee/EllisLab/ExpressionEngine/Controller/Addons/Addons.php(533): Publisher_upd->update('2.11.1')
#8 [internal function]: EllisLab\ExpressionEngine\Controller\Addons\Addons->update(Array)
#9 ee/EllisLab/ExpressionEngine/Core/Core.php(241): call_user_func_array(Array, Array)
#10 ee/EllisLab/ExpressionEngine/Core/Core.php(110): EllisLab\ExpressionEngine\Core\Core->runController(Array)
#11 ee/EllisLab/ExpressionEngine/Boot/boot.php(151): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))
#12 index.php(152): require_once('...')
#12 index.php(152): require_once('...')

 

#1

BoldMinded (Brian)

Aug 28, 2019

Sorry, I think I missed the email notification on this. I’ll take a look this week and hopefully get a fix to you.

#2

BoldMinded (Brian)

Aug 28, 2019

Actually, change the up_2_11_02.php file to this and it should work:

<?php

use Basee\Update\AbstractUpdate;

class Update_2_11_02 extends AbstractUpdate
{
    public function doUpdate()
    {
        $this->addHooks([
            ['hook' => 'after_template_delete', 'method' => 'after_template_delete'],
            ['hook' => 'after_template_group_delete', 'method' => 'after_template_group_delete'],
        ]);

        // If a template was deleted, Publisher wasn't cleaning up after itself :(
        $templateIds = ee('Model')->get('Template')->all()->pluck('template_id');
        $templateGroupIds = ee('Model')->get('TemplateGroup')->all()->pluck('group_id');

        if (is_array($templateIds) && !empty($templateIds)) {
            ee('db')->where('type', 'template')
                ->where_not_in('type_id', $templateIds)
                ->delete('publisher_templates');
        }

        if (is_array($templateGroupIds) && !empty($templateGroupIds)) {
            ee('db')->where('type', 'group')
                ->where_not_in('type_id', $templateGroupIds)
                ->delete('publisher_templates');
        }
    }
}
#3

BoldMinded (Brian)

Sep 04, 2019

I’m going to resolve this issue b/c the code snippet in the previous comment should fix it and will be included in the next release.

Login to reply

Contact

For add-on support, please use the Support section. General inquries and pre-sale questions can be sent to support@boldminded.com.