remove inboxes option
This commit is contained in:
parent
67c387c6a0
commit
4f5badda94
41
README
41
README
|
@ -839,40 +839,8 @@ to update it.
|
||||||
Notice inboxes
|
Notice inboxes
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
Before version 0.6.2, the page showing all notices from people the
|
Notice inboxes are now required. If you don't have inboxes enabled,
|
||||||
user is subscribed to ("so-and-so with friends") was calculated at run
|
StatusNet will no longer run.
|
||||||
time. Starting with 0.6.2, we have a new data structure for holding a
|
|
||||||
user's "notice inbox". (Note: distinct from the "message inbox", which
|
|
||||||
is the "inbox" tab in the UI. The notice inbox appears under the
|
|
||||||
"Personal" tab.)
|
|
||||||
|
|
||||||
Notices are added to the inbox when they're created. This speeds up
|
|
||||||
the query considerably, and also allows us the opportunity, in the
|
|
||||||
future, to add different kind of notices to an inbox -- like @-replies
|
|
||||||
or subscriptions to search terms or hashtags.
|
|
||||||
|
|
||||||
Notice inboxes are enabled by default for new installations. If you
|
|
||||||
are upgrading an existing site, this means that your users will see
|
|
||||||
empty "Personal" pages. The following steps will help you fix the
|
|
||||||
problem.
|
|
||||||
|
|
||||||
0. $config['inboxes']['enabled'] can be set to one of three values. If
|
|
||||||
you set it to 'false', the site will work as before. Support for this
|
|
||||||
will probably be dropped in future versions.
|
|
||||||
1. Setting the flag to 'transitional' means that you're in transition.
|
|
||||||
In this mode, the code will run the "new query" or the "old query"
|
|
||||||
based on whether the user's inbox has been updated.
|
|
||||||
2. After setting the flag to "transitional", you can run the
|
|
||||||
fixup_inboxes.php script to create the inboxes. You may want to set
|
|
||||||
the memory limit high. You can re-run it without ill effect.
|
|
||||||
3. When fixup_inboxes is finished, you can set the enabled flag to
|
|
||||||
'true'.
|
|
||||||
|
|
||||||
NOTE: As of version 0.8.1 notice inboxes are automatically trimmed back
|
|
||||||
to ~1000 notices every once in a while.
|
|
||||||
|
|
||||||
NOTE: we will drop support for non-inboxed sites in the 0.9.x version
|
|
||||||
of StatusNet. It's time to switch now!
|
|
||||||
|
|
||||||
UTF-8 Database
|
UTF-8 Database
|
||||||
--------------
|
--------------
|
||||||
|
@ -1308,9 +1276,8 @@ inboxes
|
||||||
|
|
||||||
For notice inboxes.
|
For notice inboxes.
|
||||||
|
|
||||||
enabled: A three-valued flag for whether to use notice inboxes (see
|
enabled: No longer used. If you set this to something other than true,
|
||||||
upgrading info above for notes about this change). Can be
|
StatusNet will no longer run.
|
||||||
'false', 'true', or '"transitional"'.
|
|
||||||
|
|
||||||
throttle
|
throttle
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -99,15 +99,6 @@ class ApiGroupCreateAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (!common_config('inboxes', 'enabled')) {
|
|
||||||
$this->serverError(
|
|
||||||
_('Inboxes must be enabled for groups to work'),
|
|
||||||
400,
|
|
||||||
$this->format
|
|
||||||
);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
|
|
|
@ -64,11 +64,6 @@ class EditgroupAction extends GroupDesignAction
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
if (!common_config('inboxes','enabled')) {
|
|
||||||
$this->serverError(_('Inboxes must be enabled for groups to work'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!common_logged_in()) {
|
if (!common_logged_in()) {
|
||||||
$this->clientError(_('You must be logged in to create a group.'));
|
$this->clientError(_('You must be logged in to create a group.'));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -68,11 +68,6 @@ class GroupbyidAction extends Action
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
if (!common_config('inboxes','enabled')) {
|
|
||||||
$this->serverError(_('Inboxes must be enabled for groups to work'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = $this->arg('id');
|
$id = $this->arg('id');
|
||||||
|
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
|
|
|
@ -64,11 +64,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
if (!common_config('inboxes', 'enabled')) {
|
|
||||||
$this->serverError(_('Inboxes must be enabled for groups to work'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!common_logged_in()) {
|
if (!common_logged_in()) {
|
||||||
$this->clientError(_('You must be logged in to edit a group.'));
|
$this->clientError(_('You must be logged in to edit a group.'));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -66,11 +66,6 @@ class GrouplogoAction extends GroupDesignAction
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
if (!common_config('inboxes','enabled')) {
|
|
||||||
$this->serverError(_('Inboxes must be enabled for groups to work'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!common_logged_in()) {
|
if (!common_logged_in()) {
|
||||||
$this->clientError(_('You must be logged in to create a group.'));
|
$this->clientError(_('You must be logged in to create a group.'));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -76,11 +76,6 @@ class groupRssAction extends Rss10Action
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
if (!common_config('inboxes','enabled')) {
|
|
||||||
$this->serverError(_('Inboxes must be enabled for groups to work'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$nickname_arg = $this->arg('nickname');
|
$nickname_arg = $this->arg('nickname');
|
||||||
$nickname = common_canonical_nickname($nickname_arg);
|
$nickname = common_canonical_nickname($nickname_arg);
|
||||||
|
|
||||||
|
|
|
@ -56,11 +56,6 @@ class JoingroupAction extends Action
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
if (!common_config('inboxes','enabled')) {
|
|
||||||
$this->serverError(_('Inboxes must be enabled for groups to work'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!common_logged_in()) {
|
if (!common_logged_in()) {
|
||||||
$this->clientError(_('You must be logged in to join a group.'));
|
$this->clientError(_('You must be logged in to join a group.'));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -56,11 +56,6 @@ class LeavegroupAction extends Action
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
if (!common_config('inboxes','enabled')) {
|
|
||||||
$this->serverError(_('Inboxes must be enabled for groups to work.'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!common_logged_in()) {
|
if (!common_logged_in()) {
|
||||||
$this->clientError(_('You must be logged in to leave a group.'));
|
$this->clientError(_('You must be logged in to leave a group.'));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -61,11 +61,6 @@ class NewgroupAction extends Action
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
if (!common_config('inboxes','enabled')) {
|
|
||||||
$this->serverError(_('Inboxes must be enabled for groups to work'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!common_logged_in()) {
|
if (!common_logged_in()) {
|
||||||
$this->clientError(_('You must be logged in to create a group.'));
|
$this->clientError(_('You must be logged in to create a group.'));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -101,11 +101,6 @@ class ShowgroupAction extends GroupDesignAction
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
if (!common_config('inboxes','enabled')) {
|
|
||||||
$this->serverError(_('Inboxes must be enabled for groups to work'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
|
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
|
||||||
|
|
||||||
$nickname_arg = $this->arg('nickname');
|
$nickname_arg = $this->arg('nickname');
|
||||||
|
|
|
@ -111,10 +111,9 @@ class Notice extends Memcached_DataObject
|
||||||
'Fave',
|
'Fave',
|
||||||
'Notice_tag',
|
'Notice_tag',
|
||||||
'Group_inbox',
|
'Group_inbox',
|
||||||
'Queue_item');
|
'Queue_item',
|
||||||
if (common_config('inboxes', 'enabled')) {
|
'Notice_inbox');
|
||||||
$related[] = 'Notice_inbox';
|
|
||||||
}
|
|
||||||
foreach ($related as $cls) {
|
foreach ($related as $cls) {
|
||||||
$inst = new $cls();
|
$inst = new $cls();
|
||||||
$inst->notice_id = $this->id;
|
$inst->notice_id = $this->id;
|
||||||
|
@ -883,66 +882,61 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
function addToInboxes()
|
function addToInboxes()
|
||||||
{
|
{
|
||||||
$enabled = common_config('inboxes', 'enabled');
|
// XXX: loads constants
|
||||||
|
|
||||||
if ($enabled === true || $enabled === 'transitional') {
|
$inbox = new Notice_inbox();
|
||||||
|
|
||||||
// XXX: loads constants
|
$users = $this->getSubscribedUsers();
|
||||||
|
|
||||||
$inbox = new Notice_inbox();
|
// FIXME: kind of ignoring 'transitional'...
|
||||||
|
// we'll probably stop supporting inboxless mode
|
||||||
|
// in 0.9.x
|
||||||
|
|
||||||
$users = $this->getSubscribedUsers();
|
$ni = array();
|
||||||
|
|
||||||
// FIXME: kind of ignoring 'transitional'...
|
foreach ($users as $id) {
|
||||||
// we'll probably stop supporting inboxless mode
|
$ni[$id] = NOTICE_INBOX_SOURCE_SUB;
|
||||||
// in 0.9.x
|
}
|
||||||
|
|
||||||
$ni = array();
|
$groups = $this->saveGroups();
|
||||||
|
|
||||||
|
foreach ($groups as $group) {
|
||||||
|
$users = $group->getUserMembers();
|
||||||
foreach ($users as $id) {
|
foreach ($users as $id) {
|
||||||
$ni[$id] = NOTICE_INBOX_SOURCE_SUB;
|
if (!array_key_exists($id, $ni)) {
|
||||||
}
|
$ni[$id] = NOTICE_INBOX_SOURCE_GROUP;
|
||||||
|
|
||||||
$groups = $this->saveGroups();
|
|
||||||
|
|
||||||
foreach ($groups as $group) {
|
|
||||||
$users = $group->getUserMembers();
|
|
||||||
foreach ($users as $id) {
|
|
||||||
if (!array_key_exists($id, $ni)) {
|
|
||||||
$ni[$id] = NOTICE_INBOX_SOURCE_GROUP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$cnt = 0;
|
$cnt = 0;
|
||||||
|
|
||||||
$qryhdr = 'INSERT INTO notice_inbox (user_id, notice_id, source, created) VALUES ';
|
$qryhdr = 'INSERT INTO notice_inbox (user_id, notice_id, source, created) VALUES ';
|
||||||
$qry = $qryhdr;
|
$qry = $qryhdr;
|
||||||
|
|
||||||
foreach ($ni as $id => $source) {
|
|
||||||
if ($cnt > 0) {
|
|
||||||
$qry .= ', ';
|
|
||||||
}
|
|
||||||
$qry .= '('.$id.', '.$this->id.', '.$source.", '".$this->created. "') ";
|
|
||||||
$cnt++;
|
|
||||||
if (rand() % NOTICE_INBOX_SOFT_LIMIT == 0) {
|
|
||||||
// FIXME: Causes lag in replicated servers
|
|
||||||
// Notice_inbox::gc($id);
|
|
||||||
}
|
|
||||||
if ($cnt >= MAX_BOXCARS) {
|
|
||||||
$inbox = new Notice_inbox();
|
|
||||||
$inbox->query($qry);
|
|
||||||
$qry = $qryhdr;
|
|
||||||
$cnt = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
foreach ($ni as $id => $source) {
|
||||||
if ($cnt > 0) {
|
if ($cnt > 0) {
|
||||||
|
$qry .= ', ';
|
||||||
|
}
|
||||||
|
$qry .= '('.$id.', '.$this->id.', '.$source.", '".$this->created. "') ";
|
||||||
|
$cnt++;
|
||||||
|
if (rand() % NOTICE_INBOX_SOFT_LIMIT == 0) {
|
||||||
|
// FIXME: Causes lag in replicated servers
|
||||||
|
// Notice_inbox::gc($id);
|
||||||
|
}
|
||||||
|
if ($cnt >= MAX_BOXCARS) {
|
||||||
$inbox = new Notice_inbox();
|
$inbox = new Notice_inbox();
|
||||||
$inbox->query($qry);
|
$inbox->query($qry);
|
||||||
|
$qry = $qryhdr;
|
||||||
|
$cnt = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($cnt > 0) {
|
||||||
|
$inbox = new Notice_inbox();
|
||||||
|
$inbox->query($qry);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -977,11 +971,6 @@ class Notice extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
$groups = array();
|
$groups = array();
|
||||||
|
|
||||||
$enabled = common_config('inboxes', 'enabled');
|
|
||||||
if ($enabled !== true && $enabled !== 'transitional') {
|
|
||||||
return $groups;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* extract all !group */
|
/* extract all !group */
|
||||||
$count = preg_match_all('/(?:^|\s)!([A-Za-z0-9]{1,64})/',
|
$count = preg_match_all('/(?:^|\s)!([A-Za-z0-9]{1,64})/',
|
||||||
strtolower($this->content),
|
strtolower($this->content),
|
||||||
|
|
|
@ -227,11 +227,9 @@ class User extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$inboxes = common_config('inboxes', 'enabled');
|
// This flag is ignored but still set to 1
|
||||||
|
|
||||||
if ($inboxes === true || $inboxes == 'transitional') {
|
$user->inboxed = 1;
|
||||||
$user->inboxed = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$user->created = common_sql_now();
|
$user->created = common_sql_now();
|
||||||
$user->uri = common_user_uri($user);
|
$user->uri = common_user_uri($user);
|
||||||
|
@ -433,55 +431,16 @@ class User extends Memcached_DataObject
|
||||||
|
|
||||||
function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
|
function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
|
||||||
{
|
{
|
||||||
$enabled = common_config('inboxes', 'enabled');
|
$ids = Notice_inbox::stream($this->id, $offset, $limit, $since_id, $before_id, $since, false);
|
||||||
|
|
||||||
// Complicated code, depending on whether we support inboxes yet
|
return Notice::getStreamByIds($ids);
|
||||||
// XXX: make this go away when inboxes become mandatory
|
|
||||||
|
|
||||||
if ($enabled === false ||
|
|
||||||
($enabled == 'transitional' && $this->inboxed == 0)) {
|
|
||||||
$qry =
|
|
||||||
'SELECT notice.* ' .
|
|
||||||
'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' .
|
|
||||||
'WHERE subscription.subscriber = %d ' .
|
|
||||||
'AND notice.is_local != ' . Notice::GATEWAY;
|
|
||||||
return Notice::getStream(sprintf($qry, $this->id),
|
|
||||||
'user:notices_with_friends:' . $this->id,
|
|
||||||
$offset, $limit, $since_id, $before_id,
|
|
||||||
$order, $since);
|
|
||||||
} else if ($enabled === true ||
|
|
||||||
($enabled == 'transitional' && $this->inboxed == 1)) {
|
|
||||||
|
|
||||||
$ids = Notice_inbox::stream($this->id, $offset, $limit, $since_id, $before_id, $since, false);
|
|
||||||
|
|
||||||
return Notice::getStreamByIds($ids);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function noticeInbox($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
|
function noticeInbox($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
|
||||||
{
|
{
|
||||||
$enabled = common_config('inboxes', 'enabled');
|
$ids = Notice_inbox::stream($this->id, $offset, $limit, $since_id, $before_id, $since, true);
|
||||||
|
|
||||||
// Complicated code, depending on whether we support inboxes yet
|
return Notice::getStreamByIds($ids);
|
||||||
// XXX: make this go away when inboxes become mandatory
|
|
||||||
|
|
||||||
if ($enabled === false ||
|
|
||||||
($enabled == 'transitional' && $this->inboxed == 0)) {
|
|
||||||
$qry =
|
|
||||||
'SELECT notice.* ' .
|
|
||||||
'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' .
|
|
||||||
'WHERE subscription.subscriber = %d ';
|
|
||||||
return Notice::getStream(sprintf($qry, $this->id),
|
|
||||||
'user:notices_with_friends:' . $this->id,
|
|
||||||
$offset, $limit, $since_id, $before_id,
|
|
||||||
$order, $since);
|
|
||||||
} else if ($enabled === true ||
|
|
||||||
($enabled == 'transitional' && $this->inboxed == 1)) {
|
|
||||||
|
|
||||||
$ids = Notice_inbox::stream($this->id, $offset, $limit, $since_id, $before_id, $since, true);
|
|
||||||
|
|
||||||
return Notice::getStreamByIds($ids);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function blowFavesCache()
|
function blowFavesCache()
|
||||||
|
@ -752,12 +711,9 @@ class User extends Memcached_DataObject
|
||||||
'Remember_me',
|
'Remember_me',
|
||||||
'Foreign_link',
|
'Foreign_link',
|
||||||
'Invitation',
|
'Invitation',
|
||||||
|
'Notice_inbox',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (common_config('inboxes', 'enabled')) {
|
|
||||||
$related[] = 'Notice_inbox';
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($related as $cls) {
|
foreach ($related as $cls) {
|
||||||
$inst = new $cls();
|
$inst = new $cls();
|
||||||
$inst->user_id = $this->id;
|
$inst->user_id = $this->id;
|
||||||
|
|
|
@ -157,7 +157,7 @@ $default =
|
||||||
'ping' =>
|
'ping' =>
|
||||||
array('notify' => array()),
|
array('notify' => array()),
|
||||||
'inboxes' =>
|
'inboxes' =>
|
||||||
array('enabled' => true), # on by default for new sites
|
array('enabled' => true), # ignored after 0.9.x
|
||||||
'newuser' =>
|
'newuser' =>
|
||||||
array('default' => null,
|
array('default' => null,
|
||||||
'welcome' => null),
|
'welcome' => null),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user