Browse Source

Added documentation

pull/2861/head
Michael Vogel 4 years ago
parent
commit
80efc422bf
4 changed files with 22 additions and 2 deletions
  1. +11
    -1
      include/Photo.php
  2. +1
    -0
      include/dbstructure.php
  3. +1
    -1
      include/socgraph.php
  4. +9
    -0
      include/threads.php

+ 11
- 1
include/Photo.php View File

@ -1065,6 +1065,16 @@ function store_photo($a, $uid, $imagedata = "", $url = "") {
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) {
$sql_extra = permissions_sql($uid);
@ -1073,7 +1083,7 @@ function photo_albums($uid, $update = false) {
if (is_null($albums) OR $update) {
/// @todo This query needs to be renewed. It is really slow
// 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`)
WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra
GROUP BY `album` ORDER BY `created` DESC",


+ 1
- 0
include/dbstructure.php View File

@ -587,6 +587,7 @@ function db_definition($charset) {
),
"indexes" => array(
"PRIMARY" => array("id"),
"cmd_item_contact" => array("UNIQUE", "cmd", "item", "contact"),
)
);
$database["event"] = array(


+ 1
- 1
include/socgraph.php View File

@ -1115,7 +1115,7 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
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);
return $r;
}


+ 9
- 0
include/threads.php View File

@ -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) {
$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));


Loading…
Cancel
Save