]> git.mxchange.org Git - friendica.git/commitdiff
Set intro.blocked to deprecated
authorPhilipp <admin@philipp.info>
Tue, 19 Oct 2021 19:30:09 +0000 (21:30 +0200)
committerPhilipp <admin@philipp.info>
Thu, 21 Oct 2021 19:56:46 +0000 (21:56 +0200)
database.sql
doc/database/db_intro.md
src/Contact/Introduction/Depository/Introduction.php
src/Contact/Introduction/Entity/Introduction.php
src/Contact/Introduction/Factory/Introduction.php
static/dbstructure.config.php
update.php

index 466a8d9b777e653a9b8a52a4cdcf44a708884539..43986e850e1b5eaee0ac018533b91f4d746c3da4 100644 (file)
@@ -719,7 +719,7 @@ CREATE TABLE IF NOT EXISTS `intro` (
        `note` text COMMENT '',
        `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
        `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
-       `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
+       `blocked` boolean NOT NULL DEFAULT '0' COMMENT 'deprecated',
        `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
         PRIMARY KEY(`id`),
         INDEX `contact-id` (`contact-id`),
index da0cbe26ab033a1ac5ec40a50d7398ce8f9ede36..0f2e36c70533dbf75bd6f88c26452673ec7287bd 100644 (file)
@@ -18,7 +18,7 @@ Fields
 | note        |                   | text               | YES  |     | NULL                |                |
 | hash        |                   | varchar(255)       | NO   |     |                     |                |
 | datetime    |                   | datetime           | NO   |     | 0001-01-01 00:00:00 |                |
-| blocked     |                   | boolean            | NO   |     | 1                   |                |
+| blocked     | deprecated        | boolean            | NO   |     | 0                   |                |
 | ignore      |                   | boolean            | NO   |     | 0                   |                |
 
 Indexes
index 280ae26d6e23789b10dee34ae0571bd0e73a69e1..3a4498cf3a7e04ac623d6cf4842075e79a6bc56b 100644 (file)
@@ -75,7 +75,6 @@ class Introduction extends BaseDepository
                        'duplex'      => $introduction->duplex ? 1 : 0,
                        'note'        => $introduction->note,
                        'hash'        => $introduction->hash,
-                       'blocked'     => $introduction->blocked ? 1 : 0,
                        'ignore'      => $introduction->ignore ? 1 : 0,
                        'datetime'    => $introduction->datetime->format(DateTimeFormat::MYSQL),
                ];
@@ -143,7 +142,7 @@ class Introduction extends BaseDepository
        public function countActiveForUser($uid, array $params = []): int
        {
                try {
-                       return $this->count(['blocked' => false, 'ignore' => false, 'uid' => $uid], $params);
+                       return $this->count(['ignore' => false, 'uid' => $uid], $params);
                } catch (\Exception $e) {
                        throw new IntroductionPersistenceException(sprintf('Cannot count Introductions for used %d', $uid), $e);
                }
index 44eddc2149bb1c88c72f5243178a585e8c47c59e..119fd1e06c670355ae11b0457742e6cd70636e43 100644 (file)
@@ -33,7 +33,6 @@ use Friendica\BaseEntity;
  * @property-read string $note
  * @property-read string $hash
  * @property-read \DateTime $datetime
- * @property-read bool $blocked
  * @property-read bool $ignore
  * @property-read int|null $id
  */
@@ -58,8 +57,6 @@ class Introduction extends BaseEntity
        /** @var \DateTime */
        protected $datetime;
        /** @var bool */
-       protected $blocked;
-       /** @var bool */
        protected $ignore;
        /** @var int|null */
        protected $id;
@@ -74,11 +71,10 @@ class Introduction extends BaseEntity
         * @param string    $note
         * @param string    $hash
         * @param \DateTime $datetime
-        * @param bool      $blocked
         * @param bool      $ignore
         * @param int|null  $id
         */
-       public function __construct(int $uid, int $sid, ?int $fid, ?int $cid, bool $knowyou, bool $duplex, string $note, string $hash, \DateTime $datetime, bool $blocked, bool $ignore, ?int $id)
+       public function __construct(int $uid, int $sid, ?int $fid, ?int $cid, bool $knowyou, bool $duplex, string $note, string $hash, \DateTime $datetime, bool $ignore, ?int $id)
        {
                $this->uid     = $uid;
                $this->sid     = $sid;
@@ -88,7 +84,6 @@ class Introduction extends BaseEntity
                $this->duplex  = $duplex;
                $this->note    = $note;
                $this->hash    = $hash;
-               $this->blocked = $blocked;
                $this->ignore  = $ignore;
                $this->id      = $id;
        }
index 8fec61bb9f54113f0c966073b2ce4117149fcaa7..35275de7f16cb1651a943b64a4d078ab2a34eb5e 100644 (file)
@@ -44,7 +44,6 @@ class Introduction extends BaseFactory implements ICanCreateFromTableRow
                        $row['note'] ?? '',
                        $row['hash'] ?? '',
                        new \DateTime($row['datetime'] ?? 'now', new \DateTimeZone('UTC')),
-                       !empty($row['blocked']),
                        !empty($row['ignore']),
                        $row['id'] ?? null
                );
@@ -69,7 +68,6 @@ class Introduction extends BaseFactory implements ICanCreateFromTableRow
                        'note'        => $note,
                        'hash'        => Strings::getRandomHex(),
                        'datetime'    => DateTimeFormat::utcNow(),
-                       'blocked'     => false,
                        'ignore'      => false,
                ]);
        }
index 4ed1e04a9bd3848fc472ed95f0c8d66c2e769837..c00cb0defbeacbb32818089870c6561842a6d4d9 100644 (file)
@@ -782,7 +782,7 @@ return [
                        "note" => ["type" => "text", "comment" => ""],
                        "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
                        "datetime" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
-                       "blocked" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
+                       "blocked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "deprecated"],
                        "ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
                ],
                "indexes" => [
index 25e64d659a2f0504fa8639f2d18209232e716689..85f407d36ce223e1a2d222f967bbf7a1918638ed 100644 (file)
@@ -1039,7 +1039,7 @@ function update_1440()
        return Update::SUCCESS;
 }
 
-function update__1441()
+function update_1441()
 {
        $languages = DI::l10n()->getAvailableLanguages();
 
@@ -1053,3 +1053,11 @@ function update__1441()
 
        return Update::SUCCESS;
 }
+
+function update_1442()
+{
+       // transform blocked intros into ignored intros
+       DBA::update('intro', ['ignore' => 1, 'blocked' => 0], ['blocked' => 1]);
+
+       return Update::SUCCESS;
+}