Added documentation
This commit is contained in:
parent
3463a442ba
commit
80efc422bf
|
@ -1065,6 +1065,16 @@ function store_photo($a, $uid, $imagedata = "", $url = "") {
|
||||||
return($image);
|
return($image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fetch the photo albums that are available for a viewer
|
||||||
|
*
|
||||||
|
* The query in this function is cost intensive, so it is cached.
|
||||||
|
*
|
||||||
|
* @param int $uid User id of the photos
|
||||||
|
* @param bool $update Update the cache
|
||||||
|
*
|
||||||
|
* @return array Returns array of the photo albums
|
||||||
|
*/
|
||||||
function photo_albums($uid, $update = false) {
|
function photo_albums($uid, $update = false) {
|
||||||
$sql_extra = permissions_sql($uid);
|
$sql_extra = permissions_sql($uid);
|
||||||
|
|
||||||
|
@ -1073,7 +1083,7 @@ function photo_albums($uid, $update = false) {
|
||||||
if (is_null($albums) OR $update) {
|
if (is_null($albums) OR $update) {
|
||||||
/// @todo This query needs to be renewed. It is really slow
|
/// @todo This query needs to be renewed. It is really slow
|
||||||
// At this time we just store the data in the cache
|
// At this time we just store the data in the cache
|
||||||
$albums = qu("SELECT count(distinct `resource-id`) AS `total`, `album`
|
$albums = qu("SELECT COUNT(DISTINCT `resource-id`) AS `total`, `album`
|
||||||
FROM `photo` USE INDEX (`uid_album_created`)
|
FROM `photo` USE INDEX (`uid_album_created`)
|
||||||
WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra
|
WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra
|
||||||
GROUP BY `album` ORDER BY `created` DESC",
|
GROUP BY `album` ORDER BY `created` DESC",
|
||||||
|
|
|
@ -587,6 +587,7 @@ function db_definition($charset) {
|
||||||
),
|
),
|
||||||
"indexes" => array(
|
"indexes" => array(
|
||||||
"PRIMARY" => array("id"),
|
"PRIMARY" => array("id"),
|
||||||
|
"cmd_item_contact" => array("UNIQUE", "cmd", "item", "contact"),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$database["event"] = array(
|
$database["event"] = array(
|
||||||
|
|
|
@ -1115,7 +1115,7 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
|
||||||
intval($limit)
|
intval($limit)
|
||||||
);
|
);
|
||||||
|
|
||||||
if(count($r) && count($r) >= ($limit -1)) {
|
if (count($r) && count($r) >= ($limit -1)) {
|
||||||
Cache::set("suggestion_query:".$uid.":".$start.":".$limit, $r, CACHE_FIVE_MINUTES);
|
Cache::set("suggestion_query:".$uid.":".$start.":".$limit, $r, CACHE_FIVE_MINUTES);
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,15 @@ function add_thread($itemid, $onlyshadow = false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add a shadow entry for a given item id
|
||||||
|
*
|
||||||
|
* We store every public item entry additionally with the user id "0".
|
||||||
|
* This is used for the community page and for the search.
|
||||||
|
* It is planned that in the future we will store public item entries only once.
|
||||||
|
*
|
||||||
|
* @param integer $itemid Item ID that should be added
|
||||||
|
*/
|
||||||
function add_shadow_thread($itemid) {
|
function add_shadow_thread($itemid) {
|
||||||
$items = q("SELECT `uid`, `wall`, `private`, `moderated`, `visible`, `contact-id`, `deleted`, `network`
|
$items = q("SELECT `uid`, `wall`, `private`, `moderated`, `visible`, `contact-id`, `deleted`, `network`
|
||||||
FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
|
FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user