forked from GNUsocial/gnu-social
Add JSON output for backups
Conflicts: lib/useractivitystream.php
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
|
||||
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
|
||||
|
||||
$shortoptions = 'i:n:f:';
|
||||
$longoptions = array('id=', 'nickname=', 'file=');
|
||||
$shortoptions = 'i:n:f:j';
|
||||
$longoptions = array('id=', 'nickname=', 'file=', 'json');
|
||||
|
||||
$helptext = <<<END_OF_EXPORTACTIVITYSTREAM_HELP
|
||||
exportactivitystream.php [options]
|
||||
@@ -28,7 +28,7 @@ Export a StatusNet user history to a file
|
||||
|
||||
-i --id ID of user to export
|
||||
-n --nickname nickname of the user to export
|
||||
-f --file file to export to (default STDOUT)
|
||||
-j --json Output JSON (default Atom)
|
||||
|
||||
END_OF_EXPORTACTIVITYSTREAM_HELP;
|
||||
|
||||
@@ -37,7 +37,11 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
|
||||
try {
|
||||
$user = getUser();
|
||||
$actstr = new UserActivityStream($user, true, UserActivityStream::OUTPUT_RAW);
|
||||
print $actstr->getString();
|
||||
if (have_option('j', 'json')) {
|
||||
$actstr->writeJSON(STDOUT);
|
||||
} else {
|
||||
print $actstr->getString();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage()."\n";
|
||||
exit(1);
|
||||
|
Reference in New Issue
Block a user