[Phpfreechat-svn] SF.net SVN: phpfreechat: [1182] trunk/src/pfccontainer.class.php
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2007-09-06 17:51:17
|
Revision: 1182 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1182&view=rev Author: kerphi Date: 2007-09-06 10:51:11 -0700 (Thu, 06 Sep 2007) Log Message: ----------- Optimization when reading new messages: do not use readdir() anymore, just trust content of messages file index Modified Paths: -------------- trunk/src/pfccontainer.class.php Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2007-09-06 17:09:01 UTC (rev 1181) +++ trunk/src/pfccontainer.class.php 2007-09-06 17:51:11 UTC (rev 1182) @@ -413,24 +413,10 @@ $c =& pfcGlobalConfig::Instance(); if ($chan == NULL) $chan = 'SERVER'; - // read new messages id - $new_msgid_list = array(); - $new_from_id = $from_id; - $msgid_list = $this->getMeta("channelid-to-msg", $this->encode($chan)); - for($i = 0; $i<count($msgid_list["value"]); $i++) - { - $msgidtmp = $msgid_list["value"][$i]; - - if ($msgidtmp > $from_id) - { - if ($msgidtmp > $new_from_id) $new_from_id = $msgidtmp; - $new_msgid_list[] = $msgidtmp; - } - } - - // read messages content and parse content + // read new messages content + parse content + $new_from_id = $this->getLastId($chan); $datalist = array(); - foreach ( $new_msgid_list as $mid ) + for ( $mid = $from_id; $mid <= $new_from_id; $mid++ ) { $line = $this->getMeta("channelid-to-msg", $this->encode($chan), $mid, true); $line = $line["value"][0]; @@ -446,11 +432,9 @@ $data["param"] = pfc_make_hyperlink($formated_line[4]); $datalist[$data["id"]] = $data; } - } - ksort($datalist); - + } return array("data" => $datalist, - "new_from_id" => $new_from_id ); + "new_from_id" => $new_from_id+1 ); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |