]> git.mxchange.org Git - friendica.git/blobdiff - include/post_update.php
Merge pull request #4283 from MrPetovan/bug/2487-fix-autolink-regex
[friendica.git] / include / post_update.php
index 210ab79fecbdf346cf1e223c579ebf7e17b50d04..44e0a717c2765aee0e8f2c1038aa52c41a5703b4 100644 (file)
@@ -4,6 +4,9 @@
  */
 
 use Friendica\Core\Config;
+use Friendica\Database\DBM;
+use Friendica\Model\Contact;
+use Friendica\Model\GContact;
 
 /**
  * @brief Calls the post update functions
@@ -61,18 +64,18 @@ function post_update_1192() {
                return false;
        }
 
-       $item_arr = array();
+       $item_arr = [];
        foreach ($r AS $item) {
                $index = $item["author-link"]."-".$item["uid"];
-               $item_arr[$index] = array("author-link" => $item["author-link"],
+               $item_arr[$index] = ["author-link" => $item["author-link"],
                                                "uid" => $item["uid"],
-                                               "network" => $item["network"]);
+                                               "network" => $item["network"]];
        }
 
        // Set the "gcontact-id" in the item table and add a new gcontact entry if needed
        foreach ($item_arr AS $item) {
-               $gcontact_id = get_gcontact_id(array("url" => $item['author-link'], "network" => $item['network'],
-                                               "photo" => $item['author-avatar'], "name" => $item['author-name']));
+               $gcontact_id = GContact::getId(["url" => $item['author-link'], "network" => $item['network'],
+                                               "photo" => $item['author-avatar'], "name" => $item['author-name']]);
                q("UPDATE `item` SET `gcontact-id` = %d WHERE `uid` = %d AND `author-link` = '%s' AND `gcontact-id` = 0",
                        intval($gcontact_id), intval($item["uid"]), dbesc($item["author-link"]));
        }
@@ -141,7 +144,7 @@ function post_update_1194() {
 
        logger("Progress: Start: ".$start_id." position: ".$pos_id." end: ".$end_id, LOGGER_DEBUG);
 
-       $r = q("UPDATE `item` ".$query2." SET `item`.`global` = 1 ".$query3,
+       q("UPDATE `item` ".$query2." SET `item`.`global` = 1 ".$query3,
                intval($start_id), intval($pos_id),
                dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS));
 
@@ -187,7 +190,7 @@ function post_update_1198() {
                                (`thread`.`uid` IN (SELECT `uid` from `user`) OR `thread`.`uid` = 0)");
 
                logger("Updated threads", LOGGER_DEBUG);
-               if (dbm::is_result($r)) {
+               if (DBM::is_result($r)) {
                        Config::set("system", "post_update_version", 1198);
                        logger("Done", LOGGER_DEBUG);
                        return true;
@@ -197,18 +200,18 @@ function post_update_1198() {
 
        logger("Query done", LOGGER_DEBUG);
 
-       $item_arr = array();
+       $item_arr = [];
        foreach ($r AS $item) {
                $index = $item["author-link"]."-".$item["owner-link"]."-".$item["uid"];
-               $item_arr[$index] = array("author-link" => $item["author-link"],
+               $item_arr[$index] = ["author-link" => $item["author-link"],
                                                "owner-link" => $item["owner-link"],
-                                               "uid" => $item["uid"]);
+                                               "uid" => $item["uid"]];
        }
 
        // Set the "gcontact-id" in the item table and add a new gcontact entry if needed
        foreach ($item_arr AS $item) {
-               $author_id = get_contact($item["author-link"], 0);
-               $owner_id = get_contact($item["owner-link"], 0);
+               $author_id = Contact::getIdForURL($item["author-link"], 0);
+               $owner_id = Contact::getIdForURL($item["owner-link"], 0);
 
                if ($author_id == 0)
                        $author_id = -1;
@@ -245,7 +248,7 @@ function post_update_1206() {
                FROM `user`
                INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`");
 
-       if (!dbm::is_result($r)) {
+       if (!DBM::is_result($r)) {
                return false;
        }
        foreach ($r AS $user) {