svn: /phd/trunk/phpdotnet/phd/Package/PHP/ Web.php
| From: | Hannes Magnusson | Date: | Fri, 31 Dec 2010 12:21:56 +0000 |
| Subject: | svn: /phd/trunk/phpdotnet/phd/Package/PHP/ Web.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-7593@lists.php.net to get a copy of this message | ||
bjori Fri, 31 Dec 2010 12:21:56 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=306917
Log:
Write the json index files used by phpweb
Changed paths:
U phd/trunk/phpdotnet/phd/Package/PHP/Web.php
Modified: phd/trunk/phpdotnet/phd/Package/PHP/Web.php
===================================================================
--- phd/trunk/phpdotnet/phd/Package/PHP/Web.php 2010-12-31 12:08:06 UTC (rev 306916)
+++ phd/trunk/phpdotnet/phd/Package/PHP/Web.php 2010-12-31 12:21:56 UTC (rev 306917)
@@ -56,6 +56,10 @@
public function update($event, $val = null) {
switch($event) {
+ case Render::FINALIZE:
+ $this->writeJsonIndex();
+ break;
+
case Render::CHUNK:
$this->flags = $val;
break;
@@ -190,6 +194,19 @@
return "<?php manual_footer(); ?>";
}
+ protected function writeJsonIndex() {
+ v("Writing search indexes..", VERBOSE_FORMAT_RENDERING);
+ $ids = array();
+ $desc = array();
+ foreach($this->indexes as $id => $index) {
+ $ids[] = array($index["sdesc"], $index["filename"],
$index["element"]);
+ $desc[$id] = $index["ldesc"];
+ }
+ file_put_contents($this->getOutputDir() . "search-index.json",
json_encode($ids));
+ file_put_contents($this->getOutputDir() . "search-description.json",
json_encode($desc));
+ v("Index written", VERBOSE_FORMAT_RENDERING);
+ }
+
}
/*