[geeklog-cvs] geeklog: Minor optimization to cache the documentation URL
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sat Sep 19 08:17:31 EDT 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/1a45dcdd9ce7
changeset: 7321:1a45dcdd9ce7
user: Dirk Haun <dirk at haun-online.de>
date: Sat Sep 19 09:44:15 2009 +0200
description:
Minor optimization to cache the documentation URL
diffstat:
system/classes/config.class.php | 48 ++++++++++++-----------
1 files changed, 25 insertions(+), 23 deletions(-)
diffs (66 lines):
diff -r cee325fef1c9 -r 1a45dcdd9ce7 system/classes/config.class.php
--- a/system/classes/config.class.php Sat Sep 19 09:26:29 2009 +0200
+++ b/system/classes/config.class.php Sat Sep 19 09:44:15 2009 +0200
@@ -916,37 +916,39 @@
*/
function _get_ConfigHelp($group, $option)
{
- static $coreUrl;
+ static $docUrl;
+
+ if (! isset($docUrl)) {
+ $docUrl = array();
+ }
$retval = '';
- $descUrl = '';
- if ($group == 'Core') {
- if (isset($coreUrl)) {
- $descUrl = $coreUrl;
- } elseif (!empty($GLOBALS['_CONF']['site_url']) &&
- !empty($GLOBALS['_CONF']['path_html'])) {
- $baseUrl = $GLOBALS['_CONF']['site_url'];
- $doclang = COM_getLanguageName();
- $cfg = 'docs/' . $doclang . '/config.html';
- if (file_exists($GLOBALS['_CONF']['path_html'] . $cfg)) {
- $descUrl = $baseUrl . '/' . $cfg;
+ if (! isset($docUrl[$group])) {
+ if ($group == 'Core') {
+ if (!empty($GLOBALS['_CONF']['site_url']) &&
+ !empty($GLOBALS['_CONF']['path_html'])) {
+ $baseUrl = $GLOBALS['_CONF']['site_url'];
+ $doclang = COM_getLanguageName();
+ $cfg = 'docs/' . $doclang . '/config.html';
+ if (file_exists($GLOBALS['_CONF']['path_html'] . $cfg)) {
+ $url = $baseUrl . '/' . $cfg;
+ } else {
+ $url = $baseUrl . '/docs/english/config.html';
+ }
} else {
- $descUrl = $baseUrl . '/docs/english/config.html';
+ $url = 'http://www.geeklog.net/docs/english/config.html';
}
- $coreUrl = $descUrl;
- } else {
- $descUrl = 'http://www.geeklog.net/docs/english/config.html';
+ $docUrl['Core'] = $url;
+ } else { // plugin
+ $docUrl[$group] = PLG_getDocumentationUrl($group, 'config');
}
- } else {
- $descUrl = PLG_getDocumentationUrl($group, 'config');
}
+ $retval = $docUrl[$group];
- if (! empty($descUrl)) {
- if (strpos($descUrl, '#') === false) {
- $retval = $descUrl . '#desc_' . $option;
- } else {
- $retval = $descUrl;
+ if (! empty($retval)) {
+ if (strpos($retval, '#') === false) {
+ $retval .= '#desc_' . $option;
}
}
More information about the geeklog-cvs
mailing list