最近的apache日志中总是出现很多500错误,大部分是HEAD方式请求文章的最终页面,用telnet一试,代码输出如下:
HEAD /index.php/hotspot/39-joomla-inspect/320-joomla-source-research.html HTTP/1.1
HOST:www.maycode.com
HTTP/1.1 500 Internal Server Error
Date: Sat, 26 Jan 2008 15:32:46 GMT
Server: Apache/2.2.6 (Unix) PHP/5.2.5
X-Powered-By: PHP/5.2.5
Set-Cookie: 2a7dc0628b73c1cc08bebba5022556b5=ub7n10kh4h0t5qke9m8l4vgpq6; path=/
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Status: 500 View not found [name, type, prefix]: article,html,yvcommentView
Expires: Mon, 1 Jan 2001 00:00:00 GMT
Last-Modified: Sat, 26 Jan 2008 15:32:53 GMT
Cache-Control: post-check=0, pre-check=0
Pragma: no-cache
Connection: close
Content-Type: text/html; charset=utf-8
原来我采用的yvcomment评论插件在head请求方式存在错误,只好看看yvcomment的源代码。看了以后觉得yvcomment的插件部分实现的很巧妙,但是同时也存在问题。
巧妙的是通过以下几行代码,就直接在插件中调用的组件的界面,输出了评论列表和评论输入框:
$controller = new yvcommentController($config);
//$id = $controller->getArticleID();
//$strOut .= ', ArticleID=' . $id;
// Perform the Request task
$controller->execute($task);
$strOut .= $controller->getOutput();
但是问题出在为了实现这个问题,修改了viewname和task,而最终又没有恢复,这样的话,如果在这个插件之后被调用的文章中页面的插件肯定会取道错误的参数。同时,yvcomment.php 中前边的
if (!$yvComment) {
$path = JPATH_SITE . DS . 'components' . DS . 'com_yvcomment' . DS . 'helpers.php';
.........
}
部分应该没有有效的封装在类中,直接被调用,就是这些地方导致了在HEAD方式请求会出错。
最后没有修改代码,因为这部分代码实在不忍心看下去了。
呵呵,不该骂厨子!还是有空自己改一个吧。