]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Event.php
Merge pull request #10116 from mexon/mat/addon-console-command
[friendica.git] / src / Model / Event.php
index e6c60928320d4db60dde4d6b1ba208c586060902..ab567e03f38e62a04035a55eeb41b70b8589a6d9 100644 (file)
@@ -242,7 +242,7 @@ class Event
                        return;
                }
 
-               DBA::delete('event', ['id' => $event_id], ['cascade' => false]);
+               DBA::delete('event', ['id' => $event_id]);
                Logger::log("Deleted event ".$event_id, Logger::DEBUG);
        }
 
@@ -516,8 +516,8 @@ class Event
                }
 
                // Query for the event by event id
-               $events = DBA::toArray(DBA::p("SELECT `event`.*, `post-view`.`id` AS `itemid` FROM `event`
-                       LEFT JOIN `post-view` ON `post-view`.`event-id` = `event`.`id` AND `post-view`.`uid` = `event`.`uid`
+               $events = DBA::toArray(DBA::p("SELECT `event`.*, `post-user-view`.`id` AS `itemid` FROM `event`
+                       LEFT JOIN `post-user-view` ON `post-user-view`.`event-id` = `event`.`id` AND `post-user-view`.`uid` = `event`.`uid`
                        WHERE `event`.`uid` = %d AND `event`.`id` = %d $sql_extra",
                        $owner_uid, $event_id));
 
@@ -555,8 +555,8 @@ class Event
 
                // Query for the event by date.
                // @todo Slow query (518 seconds to run), to be optimzed
-               $events = DBA::toArray(DBA::p("SELECT `event`.*, `post-view`.`id` AS `itemid` FROM `event`
-                               LEFT JOIN `post-view` ON `post-view`.`event-id` = `event`.`id` AND `post-view`.`uid` = `event`.`uid`
+               $events = DBA::toArray(DBA::p("SELECT `event`.*, `post-user-view`.`id` AS `itemid` FROM `event`
+                               LEFT JOIN `post-user-view` ON `post-user-view`.`event-id` = `event`.`id` AND `post-user-view`.`uid` = `event`.`uid`
                                WHERE `event`.`uid` = ? AND `event`.`ignore` = ?
                                AND ((NOT `adjust` AND (`finish` >= ? OR (`nofinish` AND `start` >= ?)) AND `start` <= ?)
                                OR  (`adjust` AND (`finish` >= ? OR (`nofinish` AND `start` >= ?)) AND `start` <= ?))" . $sql_extra,
@@ -930,7 +930,9 @@ class Event
                $location = self::locationToArray($item['event-location']);
 
                // Construct the profile link (magic-auth).
-               $profile_link = Contact::magicLinkById($item['author-id']);
+               $author = ['uid' => 0, 'id' => $item['author-id'],
+                               'network' => $item['author-network'], 'url' => $item['author-link']];
+               $profile_link = Contact::magicLinkByContact($author);
 
                $tpl = Renderer::getMarkupTemplate('event_stream_item.tpl');
                $return = Renderer::replaceMacros($tpl, [