iliaa Mon Jun 20 21:53:00 2005 EDT
Modified files:
/livedocs livedoc.php mk_notes.php mkindex.php search.php
Log:
Cleanup.
http://cvs.php.net/diff.php/livedocs/livedoc.php?r1=1.110&r2=1.111&ty=u
Index: livedocs/livedoc.php
diff -u livedocs/livedoc.php:1.110 livedocs/livedoc.php:1.111
--- livedocs/livedoc.php:1.110 Thu Sep 2 15:03:14 2004
+++ livedocs/livedoc.php Mon Jun 20 21:52:58 2005
@@ -18,7 +18,7 @@
// | Generate an HTML version of a phpdoc/docbook page on the fly |
// +----------------------------------------------------------------------+
//
-// $Id: livedoc.php,v 1.110 2004/09/02 19:03:14 goba Exp $
+// $Id: livedoc.php,v 1.111 2005/06/21 01:52:58 iliaa Exp $
define('LIVEDOC_SOURCE', dirname(__FILE__));
include LIVEDOC_SOURCE . '/livedoc_funcs.php';
@@ -123,7 +123,7 @@
if ($special_content) {
echo call_user_func($current_alias);
} else {
- echo $page->transform($map, $current_page);
+ echo $page->transform($map);
if ($NOTESDB) {
echo format_user_notes($current_page);
}
http://cvs.php.net/diff.php/livedocs/mk_notes.php?r1=1.6&r2=1.7&ty=u
Index: livedocs/mk_notes.php
diff -u livedocs/mk_notes.php:1.6 livedocs/mk_notes.php:1.7
--- livedocs/mk_notes.php:1.6 Wed Feb 9 14:37:02 2005
+++ livedocs/mk_notes.php Mon Jun 20 21:52:59 2005
@@ -19,7 +19,7 @@
// | livedocs. |
// +----------------------------------------------------------------------+
//
-// $Id: mk_notes.php,v 1.6 2005/02/09 19:37:02 iliaa Exp $
+// $Id: mk_notes.php,v 1.7 2005/06/21 01:52:59 iliaa Exp $
$create = <<<SQL
BEGIN;
@@ -45,10 +45,10 @@
}
$DB = sqlite_open($dbname);
-sqlite_query($DB, 'PRAGMA default_synchronous=OFF');
-sqlite_query($DB, 'PRAGMA count_changes=OFF');
-sqlite_query($DB, 'PRAGMA cache_size=100000');
-sqlite_query($DB, $create);
+sqlite_exec($DB, 'PRAGMA default_synchronous=OFF');
+sqlite_exec($DB, 'PRAGMA count_changes=OFF');
+sqlite_exec($DB, 'PRAGMA cache_size=100000');
+sqlite_exec($DB, $create);
$n_notes = 0;
$buffer = '';
@@ -75,7 +75,7 @@
printf("\r%d notes %d bytes", $n_notes, $n_data);
- sqlite_query($DB, "INSERT INTO notes values ($id, '$sect',
$rate, $ts, '$user', '$note');");
+ sqlite_exec($DB, "INSERT INTO notes values ($id, '$sect',
$rate, $ts, '$user', '$note');");
} while (true);
@@ -95,20 +95,20 @@
$buffer .= "INSERT INTO notes values (".$line[0].",
'".$line[1]."', ".$line[2].", ".$line[3].",
'".sqlite_escape_string($line[4])."',
'".sqlite_escape_string(base64_decode($line[5]))."');";
} else {
- sqlite_query($DB, $buffer);
+ sqlite_exec($DB, $buffer);
$buffer = '';
}
}
if ($buffer) {
- sqlite_query($DB, $buffer);
+ sqlite_exec($DB, $buffer);
}
$n_data = ftell($fp);
}
printf("\rDone: %d notes %d bytes\n", $n_notes, $n_data);
-sqlite_query($DB, 'COMMIT');
+sqlite_exec($DB, 'COMMIT');
fclose($fp);
unlink($name);
http://cvs.php.net/diff.php/livedocs/mkindex.php?r1=1.43&r2=1.44&ty=u
Index: livedocs/mkindex.php
diff -u livedocs/mkindex.php:1.43 livedocs/mkindex.php:1.44
--- livedocs/mkindex.php:1.43 Mon Jun 20 20:44:07 2005
+++ livedocs/mkindex.php Mon Jun 20 21:52:59 2005
@@ -19,7 +19,7 @@
// | construct an index |
// +----------------------------------------------------------------------+
//
-// $Id: mkindex.php,v 1.43 2005/06/21 00:44:07 iliaa Exp $
+// $Id: mkindex.php,v 1.44 2005/06/21 01:52:59 iliaa Exp $
/* just to be on the safe side */
@@ -170,7 +170,7 @@
$data .= "INSERT INTO funcs VALUES('$func', '$vers');";
}
if ($data) {
- sqlite_query($idx, $data);
+ sqlite_exec($idx, $data);
}
}
@@ -191,7 +191,7 @@
echo " Reparsing file ID $fileid\n";
} else {
$mtime = filemtime($filename);
- sqlite_query($idx, "INSERT INTO files VALUES (NULL, '$rel',
$mtime, $dirid)");
+ sqlite_exec($idx, "INSERT INTO files VALUES (NULL, '$rel',
$mtime, $dirid)");
$fileid = sqlite_last_insert_rowid($idx);
echo " Parsing file ID $fileid\n";
}
@@ -217,7 +217,7 @@
function scan_entities($dirname) {
global $idx, $LANG;
- sqlite_query($idx, 'delete from ents');
+ sqlite_exec($idx, 'delete from ents');
$ents = glob($dirname . '/*.ent');
@@ -248,7 +248,7 @@
$id =
sqlite_escape_string($matches[1][$i]);
$value =
sqlite_escape_string($matches[2][$i]);
$strsql = "INSERT INTO ents VALUES
('$id', '$value', 0)";
- @sqlite_query($idx, $strsql);
+ @sqlite_exec($idx, $strsql);
// echo $strsql . "\n"; // for debuging
$replacements[$matches[1][$i]] =
$matches[2][$i];
@@ -281,7 +281,7 @@
$value = substr($value, $langlen);
}
echo " ---> $value\n";
- @sqlite_query($idx, "INSERT INTO ents VALUES ('$id',
'$value', 1)");
+ @sqlite_exec($idx, "INSERT INTO ents VALUES ('$id',
'$value', 1)");
}
}
return $replacements;
@@ -306,7 +306,7 @@
if ($q && $r = sqlite_fetch_array($q, SQLITE_NUM)) {
$dirid = $r[0];
} else {
- sqlite_query($idx, "INSERT INTO dirs VALUES(NULL, '$rel')");
+ sqlite_exec($idx, "INSERT INTO dirs VALUES(NULL, '$rel')");
$dirid = sqlite_last_insert_rowid($idx);
}
@@ -342,9 +342,9 @@
}
/* optimization trick */
-sqlite_query($idx, 'PRAGMA default_synchronous=OFF');
-sqlite_query($idx, 'PRAGMA count_changes=OFF');
-sqlite_query($idx, 'PRAGMA cache_size=100000');
+sqlite_exec($idx, 'PRAGMA default_synchronous=OFF');
+sqlite_exec($idx, 'PRAGMA count_changes=OFF');
+sqlite_exec($idx, 'PRAGMA cache_size=100000');
$create = <<<SQL
CREATE TABLE dirs (
@@ -412,8 +412,8 @@
CREATE INDEX stop_list_idx ON stop_list(slkey);
SQL;
-sqlite_query($idx, $create);
-sqlite_query($idx, 'BEGIN TRANSACTION');
+sqlite_exec($idx, $create);
+sqlite_exec($idx, 'BEGIN TRANSACTION');
$replacements = scan_entities($DOCS . DIRECTORY_SEPARATOR . $entities_dir);
@@ -428,8 +428,8 @@
build_func_list();
}
$toc = file_get_contents($TMPDIR. '/toc-insert.sql');
-sqlite_query($idx, $toc);
-sqlite_query($idx, 'COMMIT');
+sqlite_exec($idx, $toc);
+sqlite_exec($idx, 'COMMIT');
$qry_str = '';
@@ -463,7 +463,7 @@
$qry_str .= "INSERT INTO searchi VALUES('" .
sqlite_escape_string(metaphone($f_name)) . "', '" . $path . "', 3);";
}
}
-sqlite_query($idx, 'BEGIN TRANSACTION; '.$qry_str.' COMMIT');
+sqlite_exec($idx, 'BEGIN TRANSACTION; '.$qry_str.' COMMIT');
unset($qry_str);
sqlite_close($idx);
@@ -529,7 +529,7 @@
// $parse_dirs is defined in mk_XXX.php
$path = $DOCS . DIRECTORY_SEPARATOR . $LANG . DIRECTORY_SEPARATOR;
-sqlite_query($idx, 'BEGIN TRANSACTION');
+sqlite_exec($idx, 'BEGIN TRANSACTION');
$r = sqlite_unbuffered_query("SELECT id, docbook_id FROM toc", $idx);
while (($row = sqlite_fetch_array($r, SQLITE_NUM))) {
$toca[$row[1]] = $row[0];
@@ -547,14 +547,14 @@
}
if($qry) {
- sqlite_query($idx, $qry);
+ sqlite_exec($idx, $qry);
}
-sqlite_query($idx, 'COMMIT');
+sqlite_exec($idx, 'COMMIT');
/* stop list, list of words we do not want indexed */
$file = file(dirname(__FILE__) . "/stop_list");
-sqlite_query($idx, 'BEGIN TRANSACTION');
+sqlite_exec($idx, 'BEGIN TRANSACTION');
$qry1 = $qry2 = '';
foreach ($file as $w) {
$w = sqlite_escape_string(rtrim($w));
@@ -562,14 +562,14 @@
$qry1 .= "DELETE FROM full_search WHERE skey='{$w}';";
$qry2 .= "INSERT INTO stop_list VALUES('{$w}');";
}
-sqlite_query($idx, $qry1);
-sqlite_query($idx, $qry2);
-sqlite_query($idx, 'COMMIT');
+sqlite_exec($idx, $qry1);
+sqlite_exec($idx, $qry2);
+sqlite_exec($idx, 'COMMIT');
/* duplicate word removal for indexes that comprise from multiple files */
$r = sqlite_unbuffered_query($idx, "SELECT skey, toc_id, count(*) AS cnt FROM
full_search GROUP BY toc_id, skey ORDER BY cnt DESC");
$qry = '';
-sqlite_query($idx, 'BEGIN TRANSACTION');
+sqlite_exec($idx, 'BEGIN TRANSACTION');
while (($row = sqlite_fetch_array($r, SQLITE_NUM))) {
if ($row[2] == 1) {
break;
@@ -580,16 +580,16 @@
}
if($qry) {
- sqlite_query($idx, $qry);
+ sqlite_exec($idx, $qry);
}
-sqlite_query($idx, 'COMMIT');
+sqlite_exec($idx, 'COMMIT');
-sqlite_query($idx, 'VACUUM full_search');
+sqlite_exec($idx, 'VACUUM full_search');
/* build search cache database */
$idc = sqlite_open("livedoc-cache-idx.{$LANG}.sqlite", 666);
-sqlite_query($idc, 'PRAGMA default_synchronous=OFF');
+sqlite_exec($idc, 'PRAGMA default_synchronous=OFF');
$tbl_data = <<<SQL_CACHE
CREATE TABLE cache_data (
@@ -610,7 +610,7 @@
SQL_CACHE;
-sqlite_query($idc, $tbl_data);
+sqlite_exec($idc, $tbl_data);
sqlite_close($idc);
exit;
http://cvs.php.net/diff.php/livedocs/search.php?r1=1.8&r2=1.9&ty=u
Index: livedocs/search.php
diff -u livedocs/search.php:1.8 livedocs/search.php:1.9
--- livedocs/search.php:1.8 Mon May 24 17:06:14 2004
+++ livedocs/search.php Mon Jun 20 21:52:59 2005
@@ -18,7 +18,7 @@
// | Search page |
// +----------------------------------------------------------------------+
//
-// $Id: search.php,v 1.8 2004/05/24 21:06:14 iliaa Exp $
+// $Id: search.php,v 1.9 2005/06/21 01:52:59 iliaa Exp $
define('LIVEDOC_SOURCE', dirname(__FILE__));
include './common.php';
@@ -30,24 +30,24 @@
function search($qry, $strict, $lang, $idx, &$ttl) {
$key = str_replace("'", '', implode('', $qry));
- sqlite_query($idx, 'BEGIN TRANSACTION');
- sqlite_query($idx, "ATTACH '" . OUTPUTDIR .
"/{$lang}/livedoc-cache-idx.{$lang}.sqlite' AS sc");
+ sqlite_exec($idx, 'BEGIN TRANSACTION');
+ sqlite_exec($idx, "ATTACH '" . OUTPUTDIR .
"/{$lang}/livedoc-cache-idx.{$lang}.sqlite' AS sc");
if (($data = sqlite_array_query($idx, "SELECT id, ttl FROM search_cache
WHERE qry='{$key}'"))) {
$ttl = $data[0][1];
$id = $data[0][0];
} else {
- sqlite_query($idx, "INSERT INTO search_cache (ttl, qry)
VALUES(0, '{$key}')");
+ sqlite_exec($idx, "INSERT INTO search_cache (ttl, qry)
VALUES(0, '{$key}')");
$id = sqlite_last_insert_rowid($idx);
- sqlite_query($idx, "INSERT INTO cache_data (toc_id, qry_id,
pos) SELECT fs.toc_id, '{$id}', count(fs.toc_id) AS cnt FROM
+ sqlite_exec($idx, "INSERT INTO cache_data (toc_id, qry_id, pos)
SELECT fs.toc_id, '{$id}', count(fs.toc_id) AS cnt FROM
full_search fs WHERE fs.skey IN(" .
implode(',', $qry) . ") GROUP BY fs.toc_id ORDER BY cnt DESC LIMIT 300");
if (($ttl = sqlite_single_query($idx, "SELECT count(*) FROM
cache_data WHERE qry_id={$id}"))) {
- sqlite_query($idx, "UPDATE search_cache SET ttl={$ttl}
WHERE id={$id}");
+ sqlite_exec($idx, "UPDATE search_cache SET ttl={$ttl}
WHERE id={$id}");
}
}
- sqlite_query($idx, 'COMMIT');
+ sqlite_exec($idx, 'COMMIT');
if (!$ttl) {
return 0;