打开debug模式后的网页报错:

SQLSTATE[HY000]: General error: 1 near "SHOW": syntax error
Typecho_Db_Query_Exception: SQLSTATE[HY000]: General error: 1 near "SHOW": syntax error in /app/var/Typecho/Db/Adapter/Pdo.php:105
Stack trace:
#0 /app/var/Typecho/Db.php(368): Typecho_Db_Adapter_Pdo->query('SHOW COLUMNS FR...', Object(PDO), 1, 'SELECT', NULL)
#1 /app/var/Typecho/Db.php(398): Typecho_Db->query('SHOW COLUMNS FR...', 1)
#2 /data/plugins/VOID/Plugin.php(23): Typecho_Db->fetchAll('SHOW COLUMNS FR...')
#3 /data/plugins/VOID/Plugin.php(68): VOID_Plugin::hasColumn('typecho_content...', 'wordCount')
#4 /app/var/Widget/Plugins/Edit.php(102): VOID_Plugin::activate()
#5 /app/var/Widget/Plugins/Edit.php(308): Widget_Plugins_Edit->activate('VOID')
#6 /app/var/Widget/Do.php(82): Widget_Plugins_Edit->action()
#7 /app/var/Typecho/Widget.php(221): Widget_Do->execute()
#8 /app/var/Typecho/Router.php(135): Typecho_Widget::widget('Widget_Do', NULL, Array)
#9 /app/index.php(23): Typecho_Router::dispatch()
#10 {main}

看了下插件代码,bug是由传入PDO的SHOW TABLE导致的,因为这个语法是Mysql的不兼容Sqlite,修复方法也很简单,把Plugin.php里的Mysql语句改成Sqlite就行了,具体如下:

<?php
/*
private static function hasColumn($table, $field) {
    $db = Typecho_Db::get();
    $sql = "SHOW COLUMNS FROM `".$table."` LIKE '%".$field."%'";
    return count($db->fetchAll($sql)) != 0;
}

private static function hasTable($table) {
    $db = Typecho_Db::get();
    $sql = "SHOW TABLES LIKE '%".$table."%'";
    return count($db->fetchAll($sql)) != 0;
}
*/

private static function hasColumn($table, $field) {
    $db = Typecho_Db::get();
    $sql = "SELECT ".$field." FROM ".$table;
    try {
        $db->fetchAll($sql);
    } catch(\Typecho_Db_Query_Exception $e) {
        return false;
    }
    return true;
}

private static function hasTable($table) {
    $db = Typecho_Db::get();
    $sql = "SELECT * FROM sqlite_master WHERE type='table' AND name='".$table."'";
    return count($db->fetchAll($sql)) != 0;
}

ExSearch

值得一提的是VOID作者的另一个插件Exsearch在Sqlite3下同样也会报错,解决方法大同小异,打开debug模式看哪儿语法不匹配改就完事,如果懒得改可以直接用我改好的