|
|
|
@ -83,11 +83,6 @@
|
|
|
|
|
|
|
|
|
|
startup_gettext();
|
|
|
|
|
|
|
|
|
|
if (defined('MEMCACHE_SERVER')) {
|
|
|
|
|
$memcache = new Memcache;
|
|
|
|
|
$memcache->connect(MEMCACHE_SERVER, 11211);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
require_once 'db-prefs.php';
|
|
|
|
|
require_once 'version.php';
|
|
|
|
|
|
|
|
|
@ -3079,8 +3074,6 @@
|
|
|
|
|
|
|
|
|
|
function get_article_tags($link, $id, $owner_uid = 0, $tag_cache = false) {
|
|
|
|
|
|
|
|
|
|
global $memcache;
|
|
|
|
|
|
|
|
|
|
$a_id = db_escape_string($id);
|
|
|
|
|
|
|
|
|
|
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
|
|
|
|
@ -3093,9 +3086,6 @@
|
|
|
|
|
$obj_id = md5("TAGS:$owner_uid:$id");
|
|
|
|
|
$tags = array();
|
|
|
|
|
|
|
|
|
|
if ($memcache && $obj = $memcache->get($obj_id)) {
|
|
|
|
|
$tags = $obj;
|
|
|
|
|
} else {
|
|
|
|
|
/* check cache first */
|
|
|
|
|
|
|
|
|
|
if ($tag_cache === false) {
|
|
|
|
@ -3126,9 +3116,6 @@
|
|
|
|
|
AND owner_uid = $owner_uid");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($memcache) $memcache->add($obj_id, $tags, 0, 3600);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $tags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3590,15 +3577,6 @@
|
|
|
|
|
function load_filters($link, $feed, $owner_uid, $action_id = false) {
|
|
|
|
|
$filters = array();
|
|
|
|
|
|
|
|
|
|
global $memcache;
|
|
|
|
|
|
|
|
|
|
$obj_id = md5("FILTER:$feed:$owner_uid:$action_id");
|
|
|
|
|
|
|
|
|
|
if ($memcache && $obj = $memcache->get($obj_id)) {
|
|
|
|
|
|
|
|
|
|
return $obj;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
if ($action_id) $ftype_query_part = "action_id = '$action_id' AND";
|
|
|
|
|
|
|
|
|
@ -3635,11 +3613,9 @@
|
|
|
|
|
array_push($filters[$line["name"]], $filter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($memcache) $memcache->add($obj_id, $filters, 0, 3600*8);
|
|
|
|
|
|
|
|
|
|
return $filters;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get_score_pic($score) {
|
|
|
|
|
if ($score > 100) {
|
|
|
|
@ -3915,15 +3891,8 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get_article_labels($link, $id) {
|
|
|
|
|
global $memcache;
|
|
|
|
|
|
|
|
|
|
$obj_id = md5("LABELS:$id:" . $_SESSION["uid"]);
|
|
|
|
|
|
|
|
|
|
$rv = array();
|
|
|
|
|
|
|
|
|
|
if ($memcache && $obj = $memcache->get($obj_id)) {
|
|
|
|
|
return $obj;
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
$result = db_query($link, "SELECT label_cache FROM
|
|
|
|
|
ttrss_user_entries WHERE ref_id = '$id' AND owner_uid = " .
|
|
|
|
@ -3954,13 +3923,11 @@
|
|
|
|
|
$line["bg_color"]);
|
|
|
|
|
array_push($rv, $rk);
|
|
|
|
|
}
|
|
|
|
|
if ($memcache) $memcache->add($obj_id, $rv, 0, 3600);
|
|
|
|
|
|
|
|
|
|
if (count($rv) > 0)
|
|
|
|
|
label_update_cache($link, $id, $rv);
|
|
|
|
|
else
|
|
|
|
|
label_update_cache($link, $id, array("no-labels" => 1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $rv;
|
|
|
|
|
}
|
|
|
|
@ -4017,13 +3984,6 @@
|
|
|
|
|
|
|
|
|
|
function label_add_article($link, $id, $label, $owner_uid) {
|
|
|
|
|
|
|
|
|
|
global $memcache;
|
|
|
|
|
|
|
|
|
|
if ($memcache) {
|
|
|
|
|
$obj_id = md5("LABELS:$id:$owner_uid");
|
|
|
|
|
$memcache->delete($obj_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$label_id = label_find_id($link, $label, $owner_uid);
|
|
|
|
|
|
|
|
|
|
if (!$label_id) return;
|
|
|
|
@ -4047,15 +4007,8 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function label_remove($link, $id, $owner_uid) {
|
|
|
|
|
global $memcache;
|
|
|
|
|
|
|
|
|
|
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
|
|
|
|
|
|
|
|
|
|
if ($memcache) {
|
|
|
|
|
$obj_id = md5("LABELS:$id:$owner_uid");
|
|
|
|
|
$memcache->delete($obj_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db_query($link, "BEGIN");
|
|
|
|
|
|
|
|
|
|
$result = db_query($link, "SELECT caption FROM ttrss_labels2
|
|
|
|
@ -4375,26 +4328,17 @@
|
|
|
|
|
|
|
|
|
|
function get_article_enclosures($link, $id) {
|
|
|
|
|
|
|
|
|
|
global $memcache;
|
|
|
|
|
|
|
|
|
|
$query = "SELECT * FROM ttrss_enclosures
|
|
|
|
|
WHERE post_id = '$id' AND content_url != ''";
|
|
|
|
|
|
|
|
|
|
$obj_id = md5("ENCLOSURES:$id");
|
|
|
|
|
|
|
|
|
|
$rv = array();
|
|
|
|
|
|
|
|
|
|
if ($memcache && $obj = $memcache->get($obj_id)) {
|
|
|
|
|
$rv = $obj;
|
|
|
|
|
} else {
|
|
|
|
|
$result = db_query($link, $query);
|
|
|
|
|
|
|
|
|
|
if (db_num_rows($result) > 0) {
|
|
|
|
|
while ($line = db_fetch_assoc($result)) {
|
|
|
|
|
array_push($rv, $line);
|
|
|
|
|
}
|
|
|
|
|
if ($memcache) $memcache->add($obj_id, $rv, 0, 3600);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $rv;
|
|
|
|
|