com web/php: Search index is now served as an empty array "[]" if generated json search index files can't be found.: search-index.php
| From: | Paul Dragoonis | Date: | Sat, 01 Jan 2011 20:49:54 +0000 |
| Subject: | com web/php: Search index is now served as an empty array "[]" if generated json search index files can't be found.: search-index.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-23677@lists.php.net to get a copy of this message | ||
Commit: 497f21b6fb243f5708b52655f1d2ae85d4f28cc4
Author: Stewart Lord <stewartlord@php.net> Sat, 1 Jan 2011 20:49:54 +0000
Parents: 5df2d2bb65d84fe78bb773624c21c2f90d326e37
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=497f21b6fb243f5708b52655f1d2ae85d4f28cc4
Log:
Search index is now served as an empty array "[]" if generated json search
index files can't be found.
Changed paths:
M search-index.php
Diff:
diff --git a/search-index.php b/search-index.php
index ab53c64..da0cefe 100644
--- a/search-index.php
+++ b/search-index.php
@@ -18,5 +18,11 @@ header("Content-Type: application/javascript");
ob_start("ob_gzhandler");
echo "$varname = ";
-readfile(dirname(__FILE__) . "/manual/$langcode/$filename.json");
+$file = dirname(__FILE__) . "/manual/$langcode/$filename.json";
+if (is_readable($file)) {
+ readfile($file);
+} else {
+ echo "[]";
+}
+