Commit Graph

5 Commits

Author SHA1 Message Date
Evan Prodromou
1c1bcd7cc6 Add JSON output for backups
Conflicts:
	lib/useractivitystream.php
2013-05-24 13:51:57 -04:00
Brion Vibber
55b1f3d84c Scalability work on user backup stream generation.
UserActivityStream -- used to create a full activity stream including subscriptions, favorites, notices, etc -- normally buffers everything into memory at once. This is infeasible for accounts with long histories of serious usage; it can take tens of seconds just to pull all records from the database, and working with them all in memory is very likely to hit resource limits.
This commit adds an alternate mode for this class which avoids pulling notices until during the actual output. Instead of pre-sorting and buffering all the notices, empty spaces between the other activities are filled in with notices as we're making output. This means more smaller queries spread out during operations, and less stuff kept in memory.

Callers (backupaccount action, and backupuser.php) which can stream their output pass an $outputMode param of UserActivityStream::OUTPUT_RAW, and during getString() it'll send straight to output as well as slurping the notices in this extra funky fashion.
Other callers will let it default to the OUTPUT_STRING mode, which keeps the previous behavior.

There should be a better way to do this, swapping out the stringer output for raw output more consitently.
2011-02-25 12:15:38 -08:00
Evan Prodromou
b1802b8720 don't redeclare getUser() for backupuser.php 2010-09-15 23:32:27 -04:00
Evan Prodromou
1ceb93cce4 move useractivitystream class to its own module 2010-09-15 15:18:01 -04:00
Evan Prodromou
518db02525 rename script to backupuser.php 2010-09-15 11:21:37 -04:00