]> git.mxchange.org Git - friendica.git/commitdiff
Update function names and calls
authorAdam Magness <adam.magness@gmail.com>
Mon, 5 Feb 2018 12:47:06 +0000 (07:47 -0500)
committerAdam Magness <adam.magness@gmail.com>
Mon, 5 Feb 2018 17:47:04 +0000 (12:47 -0500)
update function names and calls from other files

mod/photos.php
mod/starred.php
mod/videos.php
src/Model/Item.php
src/Protocol/DFRN.php
src/Protocol/Diaspora.php
src/Protocol/OStatus.php

index 6742497ac320c3c9249f5aca4b84b43f8014ff9f..e1116c346b53f3fc3aa1663d6519cd4b9ad536e6 100644 (file)
@@ -297,7 +297,7 @@ function photos_post(App $a)
                                                intval($page_owner_uid)
                                        );
                                        Term::insertFromTagFieldByItemUri($rr['parent-uri'], $page_owner_uid);
-                                       delete_thread_uri($rr['parent-uri'], $page_owner_uid);
+                                       Item::deleteThreadFromUri($rr['parent-uri'], $page_owner_uid);
 
                                        $drop_id = intval($rr['id']);
 
@@ -371,7 +371,7 @@ function photos_post(App $a)
                                        intval($page_owner_uid)
                                );
                                Term::insertFromTagFieldByItemUri($i[0]['uri'], $page_owner_uid);
-                               delete_thread_uri($i[0]['uri'], $page_owner_uid);
+                               Item::deleteThreadFromUri($i[0]['uri'], $page_owner_uid);
 
                                $url = System::baseUrl();
                                $drop_id = intval($i[0]['id']);
@@ -656,7 +656,7 @@ function photos_post(App $a)
                                intval($page_owner_uid)
                        );
                        Term::insertFromTagFieldByItemId($item_id);
-                       update_thread($item_id);
+                       Item::updateThread($item_id);
 
                        $best = 0;
                        foreach ($p as $scales) {
@@ -1432,7 +1432,7 @@ function photos_content(App $a)
                                        intval($link_item['parent']),
                                        intval(local_user())
                                );
-                               update_thread($link_item['parent']);
+                               Item::updateThread($link_item['parent']);
                        }
 
                        if ($link_item['coord']) {
index 5cd9c0fe18768a2a9b9a701e0bf180c6ec1d0652..364d5c59571285ea760824deb1d5b2ff09b7fb6a 100644 (file)
@@ -1,8 +1,11 @@
 <?php
-
+/**
+ * @file mod/starred.php
+ */
 use Friendica\App;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
+use Friendica\Model\Item;
 
 function starred_init(App $a) {
 
@@ -38,7 +41,7 @@ function starred_init(App $a) {
                intval($message_id)
        );
 
-       update_thread($message_id);
+       Item::updateThread($message_id);
 
        // See if we've been passed a return path to redirect to
        $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
index 7db81f6d205ffb9db399615a0db4976780c8c7f8..0f029f0472f0bf9249dc71f92e1458751aa6b0ab 100644 (file)
@@ -12,6 +12,7 @@ use Friendica\Core\Worker;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
+use Friendica\Model\Item;
 use Friendica\Model\Profile;
 use Friendica\Model\Term;
 use Friendica\Protocol\DFRN;
@@ -177,7 +178,7 @@ function videos_post(App $a) {
                                        intval(local_user())
                                );
                                Term::insertFromTagFieldByItemUri($i[0]['uri'], local_user());
-                               delete_thread_uri($i[0]['uri'], local_user());
+                               Item::deleteThreadFromUri($i[0]['uri'], local_user());
 
                                $url = System::baseUrl();
                                $drop_id = intval($i[0]['id']);
index 8f630d9bd26a1400889fb10399d72728fbd4d323..1e1603ef6adaf00f85f01bf24a1b8c2c8e8f65c2 100644 (file)
@@ -71,7 +71,7 @@ class Item extends BaseObject
 
                        Term::insertFromTagFieldByItemId($item['id']);
                        Term::insertFromFileFieldByItemId($item['id']);
-                       update_thread($item['id']);
+                       self::updateThread($item['id']);
 
                        Worker::add(PRIORITY_HIGH, "Notifier", 'edit_post', $item['id']);
                }
@@ -153,7 +153,7 @@ class Item extends BaseObject
 
                Term::insertFromTagFieldByItemId($item['id']);
                Term::insertFromFileFieldByItemId($item['id']);
-               delete_thread($item['id'], $item['parent-uri']);
+               self::deleteThread($item['id'], $item['parent-uri']);
 
                // If it's the parent of a comment thread, kill all the kids
                if ($item['id'] == $item['parent']) {
@@ -779,9 +779,9 @@ class Item extends BaseObject
                }
 
                if ($arr['parent-uri'] === $arr['uri']) {
-                       add_thread($current_post);
+                       self::addThread($current_post);
                } else {
-                       update_thread($parent_id);
+                       self::updateThread($parent_id);
                }
 
                dba::commit();
@@ -1289,7 +1289,7 @@ class Item extends BaseObject
                        dbesc($u[0]['deny_gid']),
                        intval($item_id)
                );
-               update_thread($item_id);
+               self::updateThread($item_id);
 
                Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], 'Notifier', 'tgroup', $item_id);
 
@@ -1873,7 +1873,7 @@ EOT;
                return true;
        }
 
-       function add_thread($itemid, $onlyshadow = false) {
+       private static function addThread($itemid, $onlyshadow = false) {
                $items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`,
                                `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`,
                                `deleted`, `origin`, `forum_mode`, `mention`, `network`, `author-id`, `owner-id`
@@ -1892,17 +1892,17 @@ EOT;
                }
        }
 
-       function update_thread_uri($itemuri, $uid) {
+       public static function updateThreadFromUri($itemuri, $uid) {
                $messages = q("SELECT `id` FROM `item` WHERE uri ='%s' AND uid=%d", dbesc($itemuri), intval($uid));
        
                if (DBM::is_result($messages)) {
                        foreach ($messages as $message) {
-                               update_thread($message["id"]);
+                               self::updateThread($message["id"]);
                        }
                }
        }
 
-       function update_thread($itemid, $setmention = false) {
+       public static function updateThread($itemid, $setmention = false) {
                $items = q("SELECT `uid`, `guid`, `title`, `body`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`,
                                `deleted`, `origin`, `forum_mode`, `network`, `rendered-html`, `rendered-hash` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
        
@@ -1948,17 +1948,17 @@ EOT;
                logger("Updating public shadow for post ".$items[0]["id"]." - guid ".$item["guid"]." Result: ".print_r($result, true), LOGGER_DEBUG);
        }
        
-       function delete_thread_uri($itemuri, $uid) {
+       public static function deleteThreadFromUri($itemuri, $uid) {
                $messages = q("SELECT `id` FROM `item` WHERE uri ='%s' AND uid=%d", dbesc($itemuri), intval($uid));
        
                if (DBM::is_result($messages)) {
                        foreach ($messages as $message) {
-                               delete_thread($message["id"], $itemuri);
+                               self::deleteThread($message["id"], $itemuri);
                        }
                }
        }
        
-       function delete_thread($itemid, $itemuri = "") {
+       public static function deleteThread($itemid, $itemuri = "") {
                $item = q("SELECT `uid` FROM `thread` WHERE `iid` = %d", intval($itemid));
        
                if (!DBM::is_result($item)) {
@@ -1969,7 +1969,7 @@ EOT;
                // Using dba::delete at this time could delete the associated item entries
                $result = dba::e("DELETE FROM `thread` WHERE `iid` = ?", $itemid);
        
-               logger("delete_thread: Deleted thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG);
+               logger("deleteThread: Deleted thread for item ".$itemid." - ".print_r($result, true), LOGGER_DEBUG);
        
                if ($itemuri != "") {
                        $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND NOT `deleted` AND NOT (`uid` IN (%d, 0))",
@@ -1978,7 +1978,7 @@ EOT;
                                );
                        if (!DBM::is_result($r)) {
                                dba::delete('item', ['uri' => $itemuri, 'uid' => 0]);
-                               logger("delete_thread: Deleted shadow for item ".$itemuri, LOGGER_DEBUG);
+                               logger("deleteThread: Deleted shadow for item ".$itemuri, LOGGER_DEBUG);
                        }
                }
        }
index a9c5f04d3e120e6c4f66e56e2a5d80199fa41db4..d4ad345626f301cd18a4d772b13e0fbb0d709c9f 100644 (file)
@@ -2092,7 +2092,7 @@ class DFRN
                        dba::update('item', $fields, $condition);
 
                        Term::insertFromTagFieldByItemUri($item["uri"], $importer["importer_uid"]);
-                       update_thread_uri($item["uri"], $importer["importer_uid"]);
+                       Item::updateThreadFromUri($item["uri"], $importer["importer_uid"]);
 
                        $changed = true;
 
@@ -2841,7 +2841,7 @@ class DFRN
                                );
                                Term::insertFromTagFieldByItemUri($uri, $importer["uid"]);
                                Term::insertFromFileFieldByItemUri($uri, $importer["uid"]);
-                               update_thread_uri($uri, $importer["uid"]);
+                               Item::updateThreadFromUri($uri, $importer["uid"]);
                        } else {
                                $r = q(
                                        "UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s',
@@ -2854,7 +2854,7 @@ class DFRN
                                );
                                Term::insertFromTagFieldByItemUri($uri, $importer["uid"]);
                                Term::insertFromFileFieldByItemUri($uri, $importer["uid"]);
-                               update_thread_uri($uri, $importer["importer_uid"]);
+                               Item::updateThreadFromUri($uri, $importer["importer_uid"]);
 
                                // if this is a relayed delete, propagate it to other recipients
 
index bd66f487ac597f2f4d4083f7f1463cf0c8b43b8d..2b5905c956cb703420f34e3a7f6a92f4697dea31 100644 (file)
@@ -2857,7 +2857,7 @@ class Diaspora
 
                        // Delete the thread - if it is a starting post and not a comment
                        if ($target_type != 'Comment') {
-                               delete_thread($item["id"], $item["parent-uri"]);
+                               Item::deleteThread($item["id"], $item["parent-uri"]);
                        }
 
                        logger("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], LOGGER_DEBUG);
index e4894cf5476f1c5ec50b8a730b0ce5f84f1b9f76..d6d6bd152d2d4a884f696108998e02291ed9d11d 100644 (file)
@@ -562,7 +562,7 @@ class OStatus
                        ['id' => $deleted["id"]]
                );
 
-               delete_thread($deleted["id"], $deleted["parent-uri"]);
+               Item::deleteThread($deleted["id"], $deleted["parent-uri"]);
 
                logger('Deleted item with uri '.$item['uri'].' for user '.$item['uid']);
        }