friendica/friendica — pull request #525 by fabrixxm (2012-11-05 09:14:55+00:00)
Title: Move users between servers

This patch allow an user to download an ".account" file, a json with basic account details (data from 'user','contacts','groups' and some other tables).
This file could be uploaded to another server to create a copy of the account on that server and send a message to DFRN contacts to update their links.

- The export personal data (/uexport) page shows two options: "Export account" and "Export all". The last one exports also all user items, but at the moment can't be used to move the account to another server

- The import page is not linked anywhere. It should be linked in "register" page, but it need some more works (an option to allow/disallow import feature, maybe). Can be reached at $baseurl/uimport

- In proc_run() function, $baseurl is added as argument to php command line:
web script build base url from $_SERVER vars, cli script try to get it from db.
But in a multi-domain installation, .htconfig.php is empty and db connection info are loaded from include/$domain/.htconfig.php, and $domain is unknow to cli scripts.
This patch set $a->baseurl from last $argv if is not already set and if last $argv starts with "http". The last $argv is then unset. Script wich are run from cli get $argv and $argc passed by reference.

This could be used in cron to run poller as

*/10 * * * * cd /home/myname/mywebsite; /usr/bin/php include/poller.php "http://mywebsite/"
*/10 * * * * cd /home/myname/mywebsite; /usr/bin/php include/poller.php "http://myotherwebsite/"

To do:

- The old account is not usable, as will not get any notification (could still work someway with polling?)
A "relocate" message could be sent to old account, to disable it?

- The .account json file contains the user private keys. A warning should be added to uexport.
We could encrypt it, maybe with user password, before download?