]> git.mxchange.org Git - friendica.git/commitdiff
Added documentation
authorMichael Vogel <ike@pirati.ca>
Tue, 25 Oct 2016 05:44:57 +0000 (05:44 +0000)
committerMichael Vogel <ike@pirati.ca>
Tue, 25 Oct 2016 05:44:57 +0000 (05:44 +0000)
include/Photo.php
include/dbstructure.php
include/socgraph.php
include/threads.php

index 3ab374bd0b3f0e4655a23ad52fbfe1e07def1f86..e734fed89acc29ded8dd20b5a34f5fdcc7be7e20 100644 (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",
index 3d14615327c2b206aae401cd8aa375da23ae9bdb..3826716c54cc0c669b836a715e44179e15b65502 100644 (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(
index e1b5cdbf9acfaf1d02554566b9e95ea5f4c946a6..349869c40624dc5e81306d1af5318709603c6cb3 100644 (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;
        }
index a487d6e01f859bfb66da61b0f60bb3935314612c..79340ab2cbe359ab985e26f3fbd636f9129d5adf 100644 (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));