]> git.mxchange.org Git - friendica.git/commitdiff
Now storing the "manually approve" data / fix update routine
authorMichael <heluecht@pirati.ca>
Mon, 14 Jan 2019 06:36:08 +0000 (06:36 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 14 Jan 2019 06:36:08 +0000 (06:36 +0000)
config/dbstructure.config.php
database.sql
src/Database/DBA.php
src/Model/APContact.php

index 61f0780dc4419ad79d4a5422088af56535965c13..e90a35f38a7f29176c0e0747e75dff7b044a1425 100644 (file)
@@ -34,7 +34,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1292);
+       define('DB_UPDATE_VERSION', 1293);
 }
 
 return [
@@ -65,6 +65,7 @@ return [
                        "inbox" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
                        "outbox" => ["type" => "varchar(255)", "comment" => ""],
                        "sharedinbox" => ["type" => "varchar(255)", "comment" => ""],
+                       "manually-approve" => ["type" => "boolean", "comment" => ""],
                        "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
                        "name" => ["type" => "varchar(255)", "comment" => ""],
                        "about" => ["type" => "text", "comment" => ""],
index 9bbc056d62efb63b98be9b6650aad7d6e1735540..5a3f84d179edac27620d6452834b73cfb42696f1 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
--- Friendica 2018.12-dev (The Tazmans Flax-lily)
--- DB_UPDATE_VERSION 1290
+-- Friendica 2019.01-rc (The Tazmans Flax-lily)
+-- DB_UPDATE_VERSION 1293
 -- ------------------------------------------
 
 
@@ -31,6 +31,7 @@ CREATE TABLE IF NOT EXISTS `apcontact` (
        `inbox` varchar(255) NOT NULL COMMENT '',
        `outbox` varchar(255) COMMENT '',
        `sharedinbox` varchar(255) COMMENT '',
+       `manually-approve` boolean COMMENT '',
        `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
        `name` varchar(255) COMMENT '',
        `about` text COMMENT '',
@@ -578,6 +579,7 @@ CREATE TABLE IF NOT EXISTS `item` (
         INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
         INDEX `authorid_created` (`author-id`,`created`),
         INDEX `ownerid` (`owner-id`),
+        INDEX `contact-id` (`contact-id`),
         INDEX `uid_uri` (`uid`,`uri`(190)),
         INDEX `resource-id` (`resource-id`),
         INDEX `deleted_changed` (`deleted`,`changed`),
@@ -813,7 +815,9 @@ CREATE TABLE IF NOT EXISTS `participation` (
        `server` varchar(60) NOT NULL COMMENT '',
        `cid` int unsigned NOT NULL COMMENT '',
        `fid` int unsigned NOT NULL COMMENT '',
-        PRIMARY KEY(`iid`,`server`)
+        PRIMARY KEY(`iid`,`server`),
+        INDEX `cid` (`cid`),
+        INDEX `fid` (`fid`)
 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Storage for participation messages from Diaspora';
 
 --
@@ -967,7 +971,8 @@ CREATE TABLE IF NOT EXISTS `profile` (
        `publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
        `net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
         PRIMARY KEY(`id`),
-        INDEX `uid_is-default` (`uid`,`is-default`)
+        INDEX `uid_is-default` (`uid`,`is-default`),
+        FULLTEXT INDEX `pub_keywords` (`pub_keywords`)
 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
 
 --
index 15a6e4dbab747efda36af5902cf4227d095c52c1..6064e587a6dd2605ee42a156e4846ea9ef4566a5 100644 (file)
@@ -1239,7 +1239,7 @@ class DBA
 
                foreach ($old_fields AS $fieldname => $content) {
                        if (isset($fields[$fieldname])) {
-                               if ($fields[$fieldname] == $content) {
+                               if (($fields[$fieldname] == $content) && !is_null($content)) {
                                        unset($fields[$fieldname]);
                                } else {
                                        $do_update = true;
index 3a9f42fdd791cef939faef865bb82ef3aa7a3b42..71f3cfae47bac438192582cc77ef8605d84c35b7 100644 (file)
@@ -157,7 +157,7 @@ class APContact extends BaseObject
 
                $apcontact['pubkey'] = trim(JsonLD::fetchElement($compacted, 'w3id:publicKey', 'w3id:publicKeyPem'));
 
-               $manually_approve = JsonLD::fetchElement($compacted, 'as:manuallyApprovesFollowers');
+               $apcontact['manually-approve'] = (int)JsonLD::fetchElement($compacted, 'as:manuallyApprovesFollowers');
 
                // To-Do
 
@@ -204,8 +204,8 @@ class APContact extends BaseObject
                                        $contact_fields['prv'] = false;
                                } else {
                                        // Otherwise set the corresponding forum type
-                                       $contact_fields['forum'] = !$manually_approve;
-                                       $contact_fields['prv'] = $manually_approve;
+                                       $contact_fields['forum'] = !$apcontact['manually-approve'];
+                                       $contact_fields['prv'] = $apcontact['manually-approve'];
                                }
                        }
                }