philip Tue Jun 19 23:22:52 2007 UTC
Modified files: /livedocs build-ops.in build.sh config.php.in configure.in error.php livedoc.php livedoc_funcs.php pregenerate.php search.php style_mapping.php Log: Allow configurable file extensions for cached files (default: .html)
http://cvs.php.net/viewvc.cgi/livedocs/build-ops.in?r1=1.14&r2=1.15&diff_format=u Index: livedocs/build-ops.in diff -u livedocs/build-ops.in:1.14 livedocs/build-ops.in:1.15 --- livedocs/build-ops.in:1.14 Wed Apr 18 08:19:30 2007 +++ livedocs/build-ops.in Tue Jun 19 23:22:52 2007 @@ -8,6 +8,7 @@ OUTPUTDIR='@OUTPUTDIR@' GENDIR='@GENDIR@' XSLTPROC='@XSLTPROC@' +FILECACHE_EXT='@FILECACHE_EXT@' # "en" should be the first! # LANGUAGES="en ar cs de es fi fr he hk hu it ja kr nl pl pt_BR ro ru sk sv tw zh" http://cvs.php.net/viewvc.cgi/livedocs/build.sh?r1=1.32&r2=1.33&diff_format=u Index: livedocs/build.sh diff -u livedocs/build.sh:1.32 livedocs/build.sh:1.33 --- livedocs/build.sh:1.32 Wed Apr 18 08:19:30 2007 +++ livedocs/build.sh Tue Jun 19 23:22:52 2007 @@ -61,7 +61,7 @@ mkdir -p "${OUTPUTDIR}/$i" chmod 0777 "${OUTPUTDIR}/$i" # remove cached manual pages - rm -f "${OUTPUTDIR}/$i/*.html" + rm -f "${OUTPUTDIR}/$i/*${FILECACHE_EXT}" # make search cache database mv "${GENDIR}/livedoc-cache-idx.$i.sqlite" "${OUTPUTDIR}/$i/" chmod 0666 "${OUTPUTDIR}/$i/livedoc-cache-idx.$i.sqlite" http://cvs.php.net/viewvc.cgi/livedocs/config.php.in?r1=1.12&r2=1.13&diff_format=u Index: livedocs/config.php.in diff -u livedocs/config.php.in:1.12 livedocs/config.php.in:1.13 --- livedocs/config.php.in:1.12 Wed Jul 6 16:17:31 2005 +++ livedocs/config.php.in Tue Jun 19 23:22:52 2007 @@ -19,7 +19,7 @@ // | the ./configure call | // +----------------------------------------------------------------------+ // -// $Id: config.php.in,v 1.12 2005/07/06 16:17:31 iliaa Exp $ +// $Id: config.php.in,v 1.13 2007/06/19 23:22:52 philip Exp $ define('FALLBACK_LANG', 'en'); define('PHPDOC', '@PHPDOC@'); @@ -31,6 +31,7 @@ define('LANGUAGES', '@LANGUAGES@'); define('THEME_NAME', '@THEMENAME@'); define('BUILD_TYPE', '@BUILDTYPE@'); +define('FILECACHE_EXT', '@FILECACHE_EXT@'); switch(BUILD_TYPE) { case 'peardoc': http://cvs.php.net/viewvc.cgi/livedocs/configure.in?r1=1.34&r2=1.35&diff_format=u Index: livedocs/configure.in diff -u livedocs/configure.in:1.34 livedocs/configure.in:1.35 --- livedocs/configure.in:1.34 Wed Apr 18 08:19:30 2007 +++ livedocs/configure.in Tue Jun 19 23:22:52 2007 @@ -1,5 +1,5 @@ ## A configure script -## $Id: configure.in,v 1.34 2007/04/18 08:19:30 bjori Exp $ +## $Id: configure.in,v 1.35 2007/06/19 23:22:52 philip Exp $ AC_PREREQ(2.13) AC_INIT(livedoc.php) @@ -68,6 +68,10 @@ [OUTPUTDIR="$withval"], [OUTPUTDIR="/home/httpd/html/phpman/htdocs"]) +AC_ARG_WITH(filecache-ext,[ --with-filecache-ext[=EXT] The file extension used by cache files [default=.html]], + [FILECACHE_EXT="$withval"], + [FILECACHE_EXT=".html"]) + LIVEDOCS=`pwd` AC_ARG_WITH(languages,[ --with-languages[=en ar...] Supported languages [default=en]], @@ -116,6 +120,7 @@ AC_SUBST(PHPDOC) AC_SUBST(LIVEDOCS) AC_SUBST(OUTPUTDIR) +AC_SUBST(FILECACHE_EXT) AC_SUBST(LANGUAGES) AC_SUBST(THEMENAME) AC_SUBST(DEFAULTLANG) http://cvs.php.net/viewvc.cgi/livedocs/error.php?r1=1.15&r2=1.16&diff_format=u Index: livedocs/error.php diff -u livedocs/error.php:1.15 livedocs/error.php:1.16 --- livedocs/error.php:1.15 Sat Sep 11 12:22:45 2004 +++ livedocs/error.php Tue Jun 19 23:22:52 2007 @@ -18,7 +18,7 @@ // | Handles the 404 error and try to redirect to the good place. | // +----------------------------------------------------------------------+ // -// $Id: error.php,v 1.15 2004/09/11 12:22:45 goba Exp $ +// $Id: error.php,v 1.16 2007/06/19 23:22:52 philip Exp $ /* handle IIS style 404 handler */ if (strncmp($_SERVER['SERVER_SOFTWARE'], "Microsoft", 9) == 0 && @@ -37,7 +37,7 @@ // This is the requested page that caused the error $current_page = substr($_SERVER['REDIRECT_URL'], strlen(WEBBASE)); - if (strncmp(substr($current_page, -5), ".html", 5)) { + if (strncmp(substr($current_page, -strlen(FILECACHE_EXT)), FILECACHE_EXT, strlen(FILECACHE_EXT))) { if (preg_match('|([A-Za-z_]{2,5})/(.*)|', $current_page, $m)) { $current_page = $m[2]; } @@ -48,7 +48,7 @@ $db_m = sqlite_array_query($idx, "SELECT path, prio FROM searchi WHERE (skey='" . sqlite_escape_string($lookup_name) . "' OR skey='".sqlite_escape_string(metaphone($lookup_name))."') ORDER BY prio LIMIT 1", SQLITE_NUM); if ($db_m) { if ($db_m[0][1] < 5 || (sqlite_single_query($idx, "SELECT count(*) FROM searchi WHERE skey='" . sqlite_escape_string($lookup_name) . "' AND prio=5") == 1)) { - $current_page = $lang . '/' . $db_m[0][0] . '.html'; + $current_page = $lang . '/' . $db_m[0][0] . FILECACHE_EXT; if (@file_exists(OUTPUTDIR . '/' . $current_page)) { header('Location: ' . WEBBASE . $current_page . '?#' . $db_m[0][0]); exit; @@ -62,7 +62,8 @@ $db_m = sqlite_array_query($idx, "SELECT path FROM searchi WHERE skey='" . sqlite_escape_string($lookup_name) . "' AND prio=5 LIMIT 10", SQLITE_NUM); $rs_size = count($db_m); $fpath = WEBBASE . $lang . '/'; - + $filecache_ext = FILECACHE_EXT; + echo error_page_header(); foreach($db_m as $v) { @@ -73,7 +74,7 @@ } $f_name = str_replace('-', '_', $f_name); echo <<< FUNC_MATCH -<a class="function" href="{$fpath}{$v[0]}.html#{$v[0]}">{$f_name}()</a><br /> +<a class="function" href="{$fpath}{$v[0]}{$filecache_ext}#{$v[0]}">{$f_name}()</a><br /> FUNC_MATCH; } @@ -85,7 +86,7 @@ } $current_page = preg_replace('|^/|', '', $current_page); - $current_page = preg_replace('|\.html$|', '', $current_page); + $current_page = preg_replace('|'.quotemeta(FILECACHE_EXT).'$|', '', $current_page); if (preg_match('|([A-Za-z_]{2,5})/(.*)|', $current_page, $m)) { $current_page = preg_replace(IDREG, '', $m[2]); } else if (preg_match('|(.*)|', $current_page, $m)) { @@ -124,7 +125,7 @@ $languages = explode(' ', LANGUAGES); if (count($languages) == 1) { - $link = FORCE_DYNAMIC ? "index.php?l=$languages[0]&q=manual" : "$languages[0]/manual.html"; + $link = FORCE_DYNAMIC ? "index.php?l=$languages[0]&q=manual" : "$languages[0]/manual". FILECACHE_EXT; die(header('Location: http://' . $_SERVER['HTTP_HOST'] . WEBBASE . $link)); } @@ -133,7 +134,7 @@ echo 'Choose a language:'; echo '<ul>'; foreach ($languages as $language) { - $link = FORCE_DYNAMIC ? "index.php?l=$language&q=manual" : "$language/manual.html"; + $link = FORCE_DYNAMIC ? "index.php?l=$language&q=manual" : "$language/manual". FILECACHE_EXT; echo '<li><a href="' . WEBBASE . $link . '">' . $langs[$language] . '</a></li>'; } echo '</ul>'; http://cvs.php.net/viewvc.cgi/livedocs/livedoc.php?r1=1.114&r2=1.115&diff_format=u Index: livedocs/livedoc.php diff -u livedocs/livedoc.php:1.114 livedocs/livedoc.php:1.115 --- livedocs/livedoc.php:1.114 Wed Sep 14 16:36:22 2005 +++ livedocs/livedoc.php Tue Jun 19 23:22:52 2007 @@ -18,7 +18,7 @@ // | Generate an HTML version of a phpdoc/docbook page on the fly | // +----------------------------------------------------------------------+ // -// $Id: livedoc.php,v 1.114 2005/09/14 16:36:22 iliaa Exp $ +// $Id: livedoc.php,v 1.115 2007/06/19 23:22:52 philip Exp $ define('LIVEDOC_SOURCE', dirname(__FILE__)); include LIVEDOC_SOURCE . '/livedoc_funcs.php'; @@ -158,7 +158,7 @@ } if ($lang_rev < $en_rev) { - $link = FORCE_DYNAMIC ? WEBBASE . "index.php?l=en&q=$current_page" : WEBBASE . "en/$current_page.html"; + $link = FORCE_DYNAMIC ? WEBBASE . "index.php?l=en&q=$current_page" : WEBBASE . "en/$current_page". FILECACHE_EXT; echo '<div class="warning">The translation of this file is outdated. '; echo "<a href ='$link'>Click here to read this file in english.</a></div>"; } @@ -174,7 +174,7 @@ if (!FORCE_DYNAMIC) { $contents = ob_get_contents(); ob_clean(); - $f = fopen($lang . "/" . $current_page . ".html", 'w'); + $f = fopen($lang . "/" . $current_page . FILECACHE_EXT, 'w'); fwrite($f, $contents); fclose($f); echo $contents; http://cvs.php.net/viewvc.cgi/livedocs/livedoc_funcs.php?r1=1.31&r2=1.32&diff_format=u Index: livedocs/livedoc_funcs.php diff -u livedocs/livedoc_funcs.php:1.31 livedocs/livedoc_funcs.php:1.32 --- livedocs/livedoc_funcs.php:1.31 Wed Sep 14 22:02:38 2005 +++ livedocs/livedoc_funcs.php Tue Jun 19 23:22:52 2007 @@ -141,7 +141,7 @@ if (FORCE_DYNAMIC) { $url = htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES)."?l=$lang&q=$firstid$hash"; } else { - $url = WEBBASE . "$lang/$firstid.html$hash"; + $url = WEBBASE . "$lang/$firstid". FILECACHE_EXT . $hash; } $cache[$lang][$ref] = $url; http://cvs.php.net/viewvc.cgi/livedocs/pregenerate.php?r1=1.6&r2=1.7&diff_format=u Index: livedocs/pregenerate.php diff -u livedocs/pregenerate.php:1.6 livedocs/pregenerate.php:1.7 --- livedocs/pregenerate.php:1.6 Fri Jul 30 16:38:08 2004 +++ livedocs/pregenerate.php Tue Jun 19 23:22:52 2007 @@ -8,7 +8,7 @@ //apd_set_pprof_trace(); -/* we are generating static pages, so links should point to .html pages */ +/* we are generating static pages, so links should point to html pages */ define('FORCE_DYNAMIC', 0); define('LIVEDOC_SOURCE', dirname(__FILE__)); @@ -73,7 +73,7 @@ ob_clean(); - $save_file = $lang . "/" . $current_page . ".html"; + $save_file = $lang . "/" . $current_page . FILECACHE_EXT; fwrite(STDERR, "\t$save_file "); fflush(STDERR); $f = fopen($save_file, 'w'); fwrite($f, $contents); http://cvs.php.net/viewvc.cgi/livedocs/search.php?r1=1.10&r2=1.11&diff_format=u Index: livedocs/search.php diff -u livedocs/search.php:1.10 livedocs/search.php:1.11 --- livedocs/search.php:1.10 Thu Jul 14 19:05:38 2005 +++ livedocs/search.php Tue Jun 19 23:22:52 2007 @@ -18,7 +18,7 @@ // | Search page | // +----------------------------------------------------------------------+ // -// $Id: search.php,v 1.10 2005/07/14 19:05:38 iliaa Exp $ +// $Id: search.php,v 1.11 2007/06/19 23:22:52 philip Exp $ define('LIVEDOC_SOURCE', dirname(__FILE__)); include './common.php'; @@ -89,6 +89,7 @@ } $html_path = WEBBASE . $lang . '/'; + $filecache_ext = FILECACHE_EXT; if (isset($qry_cond)) { $data = sqlite_array_query($idx, "SELECT slkey FROM stop_list WHERE slkey IN(" . implode(',', $qry_cond) . ")"); @@ -105,7 +106,7 @@ $res_str = 'No Results Found'; break; case 1: - header("Location: {$html_path}{$data[0][0]}.html#{$data[0][0]}"); + header("Location: {$html_path}{$data[0][0]}". FILECACHE_EXT . "#{$data[0][0]}"); exit; break; default: @@ -115,7 +116,7 @@ $class = !strncmp($v[0], 'function.', strlen('function.')) ? 'function' : 'link'; ++$i; $res_str .= <<< SEARCH_RES -{$i}) <a class='{$class}' href='{$html_path}{$v[0]}.html#{$v[0]}'>{$v[1]}</a> <b>{$m}% match</b><br /><span class="para">{$v[2]}</span><hr align="left" class="search" /> +{$i}) <a class='{$class}' href='{$html_path}{$v[0]}{$filecache_ext}#{$v[0]}'>{$v[1]}</a> <b>{$m}% match</b><br /><span class="para">{$v[2]}</span><hr align="left" class="search" /> SEARCH_RES; } http://cvs.php.net/viewvc.cgi/livedocs/style_mapping.php?r1=1.34&r2=1.35&diff_format=u Index: livedocs/style_mapping.php diff -u livedocs/style_mapping.php:1.34 livedocs/style_mapping.php:1.35 --- livedocs/style_mapping.php:1.34 Tue Jun 19 18:27:40 2007 +++ livedocs/style_mapping.php Tue Jun 19 23:22:52 2007 @@ -18,7 +18,7 @@ // | Helper functions for formatting elements | // +----------------------------------------------------------------------+ // -// $Id: style_mapping.php,v 1.34 2007/06/19 18:27:40 bjori Exp $ +// $Id: style_mapping.php,v 1.35 2007/06/19 23:22:52 philip Exp $ // almost XPATH.. ;-) $map = array( @@ -318,7 +318,7 @@ global $lang; $link = str_replace('_', '-', $matches[1]); - $link = WEBBASE . (FORCE_DYNAMIC ? "?l=$lang&q=function.$link" : "$lang/function.$link.html"); + $link = WEBBASE . (FORCE_DYNAMIC ? "?l=$lang&q=function.$link" : "$lang/function.$link". FILECACHE_EXT); return '<a class="phpfunc" href="' . $link . '">' . $matches[1] . '</a></span>' . $matches[2]; }