]> git.mxchange.org Git - friendica.git/commitdiff
Missing stuff in "develop"? (#5516)
authorMichael Vogel <icarus@dabo.de>
Sat, 28 Jul 2018 17:11:46 +0000 (19:11 +0200)
committerHypolite Petovan <mrpetovan@eml.cc>
Sat, 28 Jul 2018 17:11:46 +0000 (13:11 -0400)
* "post-type" replaces "bookmark" and "type"

* Removed some more type

* Added index to permission set

* The permission set is now stored

* The permission set is now removed upon expiry

* Post update now stores the permission set

* New file

* Permissions are now sorted

* The permission set is now used for item permissions

* Check for allow_cid, ... is superfluous. Checking for "private" is enough

* We query the permissionset

* Permissions are displayed correctly

* Changed index

* We don't store the permissions in the item table anymore

* Permission fields are now deprecated

* Reversed ...

* Postupdate now handles "postopts" as well

* Set deprecated fields to "null" if empty

* Postupdates are enabled again

* "post-type" replaces "bookmark" and "type"

* The permission set is now stored

* The permission set is now removed upon expiry

* Postupdate now handles "postopts" as well

src/Database/PostUpdate.php
src/Model/Item.php
src/Model/PermissionSet.php
src/Worker/Expire.php
update.php

index 1d85e5fadc80f91266651d53d44abca6aba514f0..fc0703fd950a40b23f8d7d94e20fd44ee7c907cf 100644 (file)
@@ -262,8 +262,7 @@ class PostUpdate
                                $item['owner-id'] = Contact::getIdForURL($item["owner-link"], 0, false, $default);
                        }
 
-                       if (!is_null($item['allow_cid']) && !is_null($item['allow_gid'])
-                               && !is_null($item['deny_cid']) && !is_null($item['deny_gid'])) {
+                       if (empty($item['psid'])) {
                                $item['psid'] = PermissionSet::fetchIDForPost($item);
                        } else {
                                $item['allow_cid'] = null;
index 77d63ca50552f23f699c15f7edd2b4019837bff6..bc883aa3cc5a78cd661a7a63b83adfd747125dc8 100644 (file)
@@ -16,6 +16,7 @@ use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
 use Friendica\Model\Contact;
+use Friendica\Model\PermissionSet;
 use Friendica\Object\Image;
 use Friendica\Protocol\Diaspora;
 use Friendica\Protocol\OStatus;
index f83f9ccb555cbabafd0c8bb65292d4d02860e582..cbbde2ae0a19f25375bef07c07d0c06885aac25e 100644 (file)
@@ -22,11 +22,6 @@ class PermissionSet extends BaseObject
         */
        public static function fetchIDForPost(&$postarray)
        {
-               if (is_null($postarray['allow_cid']) || is_null($postarray['allow_gid'])
-                       || is_null($postarray['deny_cid']) || is_null($postarray['deny_gid'])) {
-                       return null;
-               }
-
                $condition = ['uid' => $postarray['uid'],
                        'allow_cid' => self::sortPermissions(defaults($postarray, 'allow_cid', '')),
                        'allow_gid' => self::sortPermissions(defaults($postarray, 'allow_gid', '')),
index efb2cb03db8a152da4794bb76f830e7fc1af7ac0..e7aa572ddf98384168c3a7924bba99ce94e0a2e2 100644 (file)
@@ -43,6 +43,11 @@ class Expire
                                if (!empty($row['psid']) && !DBA::exists('item', ['psid' => $row['psid']])) {
                                        DBA::delete('permissionset', ['id' => $row['psid']]);
                                }
+                               // When the permission set will be used in photo and events as well.
+                               // this query here needs to be extended.
+                               if (!empty($row['psid']) && !dba::exists('item', ['psid' => $row['psid']])) {
+                                       dba::delete('permissionset', ['id' => $row['psid']]);
+                               }
                        }
                        DBA::close($rows);
 
index 812f81faf2f69fb711735991947cb838f19d5223..257623ac749a36c2ed51e50439a1bfa3a198dc8d 100644 (file)
@@ -258,3 +258,15 @@ function update_1278() {
 
        return UPDATE_SUCCESS;
 }
+
+function update_1278() {
+       Config::set('system', 'maintenance', 1);
+       Config::set('system', 'maintenance_reason', L10n::t('%s: Updating post-type.', DBM::date().' '.date('e')));
+
+       Item::update(['post-type' => Item::PT_PAGE], ['bookmark' => true]);
+       Item::update(['post-type' => Item::PT_PERSONAL_NOTE], ['type' => 'note']);
+
+       Config::set('system', 'maintenance', 0);
+
+       return UPDATE_SUCCESS;
+}