cvs: php-master-web /fetch countries.php
| From: | Rasmus Lerdorf | Date: | Tue, 28 Feb 2006 21:05:24 +0000 |
| Subject: | cvs: php-master-web /fetch countries.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-30733@lists.php.net to get a copy of this message | ||
rasmus Tue Feb 28 21:05:24 2006 UTC
Modified files:
/php-master-web/fetch countries.php
Log:
Cache countries array as well
http://cvs.php.net/viewcvs.cgi/php-master-web/fetch/countries.php?r1=1.6&r2=1.7&diff_format=u
Index: php-master-web/fetch/countries.php
diff -u php-master-web/fetch/countries.php:1.6 php-master-web/fetch/countries.php:1.7
--- php-master-web/fetch/countries.php:1.6 Fri Aug 6 08:54:58 2004
+++ php-master-web/fetch/countries.php Tue Feb 28 21:05:24 2006
@@ -9,11 +9,11 @@
if (@mysql_select_db("phpmasterdb")) {
$res = @mysql_query("SELECT * FROM country ORDER BY name");
if ($res) {
- echo "<?php\n\$COUNTRIES = array(\n";
+ echo "<?php\nif(!$APC || ($APC &&
!$COUNTRIES=apc_fetch('countries'))) {\n\$COUNTRIES = array(\n";
while ($row = @mysql_fetch_array($res)) {
echo "'$row[id]' => '", addslashes($row['name']),
"',\n";
}
- echo ");\n";
+ echo ");if($APC) apc_store('countries',$COUNTRIES);\n}\n";
}
}
}