mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 00:55:19 +00:00
mastodon compatible followers_export file
This commit is contained in:
parent
a197f406db
commit
22fa06e68f
1 changed files with 40 additions and 0 deletions
40
Code/Module/Mexport.php
Normal file
40
Code/Module/Mexport.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Code\Module;
|
||||
|
||||
use Code\Web\Controller;
|
||||
use Code\Lib\AbConfig;
|
||||
|
||||
class Mexport extends Controller
|
||||
{
|
||||
public function init() {
|
||||
if (! local_channel()) {
|
||||
return;
|
||||
}
|
||||
$table = 'Account address,Show boosts' . "\n";
|
||||
$connections = q("select * from abook where abook_channel = %d",
|
||||
intval(local_channel())
|
||||
);
|
||||
|
||||
if ($connections) {
|
||||
$str = ids_to_querystr($connections, 'abook_chan');
|
||||
$locations = q("select hubloc_hash, hubloc_id_url from hubloc where hubloc_hash in ($str) and hubloc_deleted = 0");
|
||||
if ($locations) {
|
||||
foreach ($locations as $location) {
|
||||
$table .= $location['hubloc_id_url'] . ','
|
||||
. (AbConfig::Get(local_channel(), $location['hubloc_hash'], 'system', 'block_announce')) ? 'false' : 'true'
|
||||
. "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
header('Content-type: text/csv');
|
||||
header('Content-Disposition: attachment; filename="following_accounts.csv"');
|
||||
echo $table;
|
||||
killme();
|
||||
}
|
||||
public function get() {
|
||||
if (!local_channel()) {
|
||||
return login();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue