cache tag map data
git-svn-id: file:///home/shish/svn/shimmie2/trunk@453 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
0b555d0926
commit
5444810cae
@ -88,22 +88,22 @@ class TagList extends Extension {
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$tags_min = $config->get_int('tags_min');
|
$tags_min = $config->get_int('tags_min');
|
||||||
$result = $database->Execute(
|
$tag_data = $database->cache_execute(300, "
|
||||||
"SELECT tag,count FROM tags WHERE count > ? ORDER BY tag",
|
SELECT
|
||||||
array($tags_min));
|
tag,
|
||||||
|
FLOOR(LOG(LOG(count - ? + 1)+1)*1.5*100)/100 AS scaled
|
||||||
|
FROM tags
|
||||||
|
WHERE count > ?
|
||||||
|
ORDER BY tag
|
||||||
|
", array($tags_min, $tags_min))->GetArray();
|
||||||
|
|
||||||
$html = "";
|
$html = "";
|
||||||
while(!$result->EOF) {
|
foreach($tag_data as $row) {
|
||||||
$row = $result->fields;
|
|
||||||
$h_tag = html_escape($row['tag']);
|
$h_tag = html_escape($row['tag']);
|
||||||
$count = $row['count'];
|
$size = $row['scaled'];
|
||||||
if($count > 1) {
|
|
||||||
$size = floor(log(log($row['count'] - $tags_min + 1)+1)*1.5*100)/100;
|
|
||||||
$link = $this->tag_link($row['tag']);
|
$link = $this->tag_link($row['tag']);
|
||||||
$html .= " <a style='font-size: ${size}em' href='$link'>$h_tag</a> \n";
|
$html .= " <a style='font-size: ${size}em' href='$link'>$h_tag</a> \n";
|
||||||
}
|
}
|
||||||
$result->MoveNext();
|
|
||||||
}
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,14 +112,13 @@ class TagList extends Extension {
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$tags_min = $config->get_int('tags_min');
|
$tags_min = $config->get_int('tags_min');
|
||||||
$result = $database->Execute(
|
$tag_data = $database->cache_execute(300,
|
||||||
"SELECT tag,count FROM tags WHERE count > ? ORDER BY tag",
|
"SELECT tag,count FROM tags WHERE count > ? ORDER BY tag",
|
||||||
array($tags_min));
|
array($tags_min))->GetArray();
|
||||||
|
|
||||||
$html = "";
|
$html = "";
|
||||||
$lastLetter = 0;
|
$lastLetter = 0;
|
||||||
while(!$result->EOF) {
|
foreach($tag_data as $row) {
|
||||||
$row = $result->fields;
|
|
||||||
$h_tag = html_escape($row['tag']);
|
$h_tag = html_escape($row['tag']);
|
||||||
$count = $row['count'];
|
$count = $row['count'];
|
||||||
if($lastLetter != strtolower(substr($h_tag, 0, 1))) {
|
if($lastLetter != strtolower(substr($h_tag, 0, 1))) {
|
||||||
@ -128,7 +127,6 @@ class TagList extends Extension {
|
|||||||
}
|
}
|
||||||
$link = $this->tag_link($row['tag']);
|
$link = $this->tag_link($row['tag']);
|
||||||
$html .= "<a href='$link'>$h_tag ($count)</a>\n";
|
$html .= "<a href='$link'>$h_tag ($count)</a>\n";
|
||||||
$result->MoveNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
@ -139,24 +137,22 @@ class TagList extends Extension {
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$tags_min = $config->get_int('tags_min');
|
$tags_min = $config->get_int('tags_min');
|
||||||
$result = $database->Execute(
|
$tag_data = $database->cache_execute(300,
|
||||||
"SELECT tag,count FROM tags WHERE count > ? ORDER BY count DESC, tag ASC",
|
"SELECT tag,count,FLOOR(LOG(count)) AS scaled FROM tags WHERE count > ? ORDER BY count DESC, tag ASC",
|
||||||
array($tags_min)
|
array($tags_min))->GetArray();
|
||||||
);
|
|
||||||
|
|
||||||
$html = "Results grouped by log<sub>e</sub>(n)";
|
$html = "Results grouped by log<sub>e</sub>(n)";
|
||||||
$lastLog = 0;
|
$lastLog = 0;
|
||||||
while(!$result->EOF) {
|
foreach($tag_data as $row) {
|
||||||
$row = $result->fields;
|
|
||||||
$h_tag = html_escape($row['tag']);
|
$h_tag = html_escape($row['tag']);
|
||||||
$count = $row['count'];
|
$count = $row['count'];
|
||||||
if($lastLog != floor(log($count))) {
|
$scaled = $row['scaled'];
|
||||||
$lastLog = floor(log($count));
|
if($lastLog != $scaled) {
|
||||||
|
$lastLog = $scaled;
|
||||||
$html .= "<p>$lastLog<br>";
|
$html .= "<p>$lastLog<br>";
|
||||||
}
|
}
|
||||||
$link = $this->tag_link($row['tag']);
|
$link = $this->tag_link($row['tag']);
|
||||||
$html .= "<a href='$link'>$h_tag ($count)</a>\n";
|
$html .= "<a href='$link'>$h_tag ($count)</a>\n";
|
||||||
$result->MoveNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user