今天把Typecho
的版本升级到了1.2.1
,然后出现一系列错误:
经过排查,这个错误是由CateFilter
插件导致的,需要修改插件的实现部分,改为下面即可:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
public static function filter($obj, $select){ $path_info = strtolower($_SERVER['REQUEST_URI']); // 使用 $_SERVER['REQUEST_URI'] 获取路径信息 if('/feed' == $path_info || '/feed/' == $path_info) return $select; $CateIds = Typecho_Widget::widget('Widget_Options')->plugin('CateFilter')->CateId; if(!$CateIds) return $select; //没有写入值,则直接返回 $select = $select->select('table.contents.cid', 'table.contents.title', 'table.contents.slug', 'table.contents.created', 'table.contents.authorId','table.contents.modified', 'table.contents.type', 'table.contents.status', 'table.contents.text', 'table.contents.commentsNum', 'table.contents.order','table.contents.template', 'table.contents.password', 'table.contents.allowComment', 'table.contents.allowPing', 'table.contents.allowFeed','table.contents.parent')->join('table.relationships','table.relationships.cid = table.contents.cid','right')->join('table.metas','table.relationships.mid = table.metas.mid','right')->where('table.metas.type=?','category'); $CateIds = explode(',', $CateIds); $CateIds = array_unique($CateIds); //去除重复值 foreach ($CateIds as $k => $v) { $select = $select->where('table.relationships.mid != '.intval($v))->group('cid');//确保每个值都是数字;排除重复文章 } return $select; } |