]>
git.wh0rd.org - tt-rss.git/blob - stats.php
2 require_once "sessions.php";
4 require_once "sanity_check.php";
5 require_once "version.php";
6 require_once "config.php";
7 require_once "db-prefs.php";
8 require_once "functions.php";
10 $link = db_connect(DB_HOST
, DB_USER
, DB_PASS
, DB_NAME
);
12 login_sequence($link);
14 if ($_SESSION["access_level"] < 10) {
15 header("Location: login.php"); die;
21 <title
>Tiny Tiny Statistics
</title
>
26 <h1
>Tiny Tiny Statistics
</h1
>
31 $result = db_query($link, "SELECT count(id) AS cid,
32 SUM(LENGTH(content)) AS size
35 $total_articles = db_fetch_result($result, 0, "cid");
36 $articles_size = round(db_fetch_result($result, 0, "size") / 1024);
38 print "<p>Total articles stored: $total_articles (${articles_size}K)</p>";
40 /* $result = db_query($link, "SELECT COUNT(int_id) as cid,owner_uid,login
41 FROM ttrss_user_entries
42 LEFT JOIN ttrss_users ON (owner_uid = ttrss_users.id)
43 GROUP BY owner_uid,login ORDER BY cid DESC"); */
45 $result = db_query($link, "SELECT count(ttrss_entries.id) AS cid,
46 login FROM ttrss_entries
47 LEFT JOIN ttrss_user_entries ON (ref_id = ttrss_entries.id)
48 LEFT JOIN ttrss_users ON (ttrss_users.id = owner_uid) GROUP BY login");
50 print "<h2>Per-user storage</h2>";
52 print "<table width='100%'>";
59 while ($line = db_fetch_assoc($result)) {
61 print "<td>" . $line["cid"] . "</td><td>" . $line["login"] . "</td>";
67 print "<h2>User subscriptions</h2>";
69 $result = db_query($link, "SELECT title,feed_url,site_url,login,
70 (SELECT count(int_id) FROM ttrss_user_entries
71 WHERE feed_id = ttrss_feeds.id) AS num_articles,
72 (SELECT count(int_id) FROM ttrss_user_entries
73 WHERE feed_id = ttrss_feeds.id AND unread = true) AS num_articles_unread
74 FROM ttrss_feeds,ttrss_users
75 WHERE owner_uid = ttrss_users.id ORDER BY login");
77 print "<table width='100%'>";
82 <td>Stored Articles</td>
83 <td>Unread Articles</td>
88 while ($line = db_fetch_assoc($result)) {
90 print "<td><a href=\"".$line["site_url"]."\">".$line["title"]."</a></td>";
91 print "<td><a href=\"".$line["feed_url"]."\">".$line["feed_url"]."</a></td>";
92 print "<td>" . $line["login"] . "</td>";
93 print "<td>" . $line["num_articles"] . "</td>";
94 print "<td>" . $line["num_articles_unread"] . "</td>";
97 if ($cur_login != $line["login"] && $cur_login != "") {
98 print "<tr><td> </td></tr>";
99 $cur_login = $line["login"];