]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Settings/UserExport.php
Merge pull request #10094 from urbalazs/license-20210328
[friendica.git] / src / Module / Settings / UserExport.php
index c70662f39a818d2de31539d85dc731ade6c68996..2b668182e42148bf6a060b87dfdc8e3cded6e29d 100644 (file)
@@ -28,6 +28,7 @@ use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
 use Friendica\DI;
 use Friendica\Model\Item;
+use Friendica\Model\Post;
 use Friendica\Module\BaseSettings;
 
 /**
@@ -169,9 +170,9 @@ class UserExport extends BaseSettings
                // write the table header (like Mastodon)
                echo "Account address, Show boosts\n";
                // get all the contacts
-               $contacts = DBA::select('contact', ['addr'], ['uid' => $_SESSION['uid'], 'self' => false, 'rel' => [1,3], 'deleted' => false]);
+               $contacts = DBA::select('contact', ['addr', 'url'], ['uid' => $_SESSION['uid'], 'self' => false, 'rel' => [1,3], 'deleted' => false]);
                while ($contact = DBA::fetch($contacts)) {
-                       echo $contact['addr'] . ", true\n";
+                       echo ($contact['addr'] ?: $contact['url']) . ", true\n";
                }
                DBA::close($contacts);
        }
@@ -241,11 +242,11 @@ class UserExport extends BaseSettings
                self::exportAccount($a);
                echo "\n";
 
-               $total = DBA::count('item', ['uid' => local_user()]);
+               $total = Post::count(['uid' => local_user()]);
                // chunk the output to avoid exhausting memory
 
                for ($x = 0; $x < $total; $x += 500) {
-                       $items = Item::selectToArray(Item::ITEM_FIELDLIST, ['uid' => local_user()], ['limit' => [$x, 500]]);
+                       $items = Post::selectToArray(Item::ITEM_FIELDLIST, ['uid' => local_user()], ['limit' => [$x, 500]]);
                        $output = ['item' => $items];
                        echo json_encode($output, JSON_PARTIAL_OUTPUT_ON_ERROR). "\n";
                }