mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
Added a bit of logging to the searches to get a better idea of what's
asked for, Daniel
This commit is contained in:
@ -60,6 +60,12 @@ TABLES={
|
|||||||
KEY name (name),
|
KEY name (name),
|
||||||
KEY symbol (symbol),
|
KEY symbol (symbol),
|
||||||
UNIQUE KEY ID (name, symbol))""",
|
UNIQUE KEY ID (name, symbol))""",
|
||||||
|
"Queries" : """CREATE TABLE Queries (
|
||||||
|
ID int(11) NOT NULL auto_increment,
|
||||||
|
Value varchar(50) NOT NULL,
|
||||||
|
Count int(11) NOT NULL,
|
||||||
|
UNIQUE KEY id (ID,Value(35)),
|
||||||
|
INDEX (ID))""",
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -118,6 +124,7 @@ def checkTables(db):
|
|||||||
# make sure apache can access the tables read-only
|
# make sure apache can access the tables read-only
|
||||||
try:
|
try:
|
||||||
ret = c.execute("GRANT SELECT ON xmlsoft.* TO nobody@localhost")
|
ret = c.execute("GRANT SELECT ON xmlsoft.* TO nobody@localhost")
|
||||||
|
ret = c.execute("GRANT INSERT,SELECT,UPDATE ON xmlsoft.Queries TO nobody@localhost")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return 0
|
return 0
|
||||||
|
@ -92,7 +92,7 @@ A:link, A:visited, A:active { text-decoration: underline }
|
|||||||
// We handle only the first argument so far
|
// We handle only the first argument so far
|
||||||
$query = ltrim ($query);
|
$query = ltrim ($query);
|
||||||
if (! $query) {
|
if (! $query) {
|
||||||
echo "<h1 align='center'>Search the documentation on XMLSoft.org</h1>";
|
echo "<h1 align='center'>Search the X documentation on XMLSoft.org</h1>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<p> The search service indexes only the XML API at the moment. To use it
|
<p> The search service indexes only the XML API at the moment. To use it
|
||||||
@ -104,6 +104,23 @@ simply provide a set of keywords:
|
|||||||
<input name=submit type=submit value="Search ...">
|
<input name=submit type=submit value="Search ...">
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
|
function logQueryWord($word) {
|
||||||
|
$result = mysql_query ("SELECT ID,Count FROM Queries WHERE Value='$word'");
|
||||||
|
if ($result) {
|
||||||
|
$i = mysql_num_rows($result);
|
||||||
|
if ($i == 0) {
|
||||||
|
mysql_free_result($result);
|
||||||
|
mysql_query ("INSERT INTO Queries (Value,Count) VALUES ('$word',1)");
|
||||||
|
} else {
|
||||||
|
$id = mysql_result($result, 0, 0);
|
||||||
|
$count = mysql_result($result, 0, 1);
|
||||||
|
$count ++;
|
||||||
|
mysql_query ("UPDATE Queries SET Count=$count WHERE ID=$id");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mysql_query ("INSERT INTO Queries (Value,Count) VALUES ('$word',1)");
|
||||||
|
}
|
||||||
|
}
|
||||||
function queryWord($word) {
|
function queryWord($word) {
|
||||||
$result = NULL;
|
$result = NULL;
|
||||||
$j = 0;
|
$j = 0;
|
||||||
@ -114,6 +131,7 @@ simply provide a set of keywords:
|
|||||||
if ($j == 0)
|
if ($j == 0)
|
||||||
mysql_free_result($result);
|
mysql_free_result($result);
|
||||||
}
|
}
|
||||||
|
logQueryWord($word);
|
||||||
}
|
}
|
||||||
return array($result, $j);
|
return array($result, $j);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user