Commit Graph

1215 Commits

Author SHA1 Message Date
Evan Prodromou b79d4ed6a1 add PoCo preferredUsername for nickname in Profile::asActivityNoun() 2010-02-22 07:43:12 -05:00
Evan Prodromou fae5a15a88 add strongly-suggested link to Profile::asActivityNoun() 2010-02-22 07:40:20 -05:00
Zach Copley 35be39e30e Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing 2010-02-22 01:23:24 -08:00
Zach Copley 47300a2ae9 Upgrade profile-based activity noun to have more complete set of
profile fields
2010-02-22 01:21:34 -08:00
Evan Prodromou 891e002883 don't calculate replies for remote notices 2010-02-21 23:56:48 -05:00
Evan Prodromou a745d38d6d slight rearrangement of getting profile URIs 2010-02-21 22:52:27 -05:00
Evan Prodromou ab3db8c899 Combine code that finds mentions into one place and add hook points
Combined the code that finds mentions of other profiles into one place.

common_find_mentions() finds mentions and calls hooks to allow
supplemental syntax for mentions (like OStatus).

common_linkify_mentions() links mentions.

common_linkify_mention() links a mention.

Notice::saveReplies() now uses common_find_mentions() instead of
trying to parse everything again.
2010-02-21 16:20:30 -05:00
Brion Vibber 85528ccb1f Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x 2010-02-21 11:12:56 -08:00
Evan Prodromou e9d22138ef permalink on a note represented by rel=alternate 2010-02-21 09:23:51 -05:00
Evan Prodromou 9498a16480 Notice::saveNew() accepts url and rendered options 2010-02-21 09:17:00 -05:00
Brion Vibber 9c2fe8492f OStatus: send favorite/unfavorite notifications to remote authors 2010-02-20 15:56:36 -08:00
Evan Prodromou 36d21fa716 Add events for favor and disfavor
Added events to core code for when someone favors or disfavors a
notice.
2010-02-20 12:03:32 -05:00
Evan Prodromou 52e8aa798a Refactor subs_* functions for remote use
The subs_* functions in subs.php have made a lot of assumptions
about users versus profiles. I've refactored the functions to
be methods of the Subscription class instead, and to use Profile
objects throughout.

Some of the checks for blocks or existing subscriptions depended
on users or profiles, so I've moved those methods around a bit.

I've left stubs for the subs_* functions until we get time to replace
them.
2010-02-19 08:16:45 -05:00
Evan Prodromou 3d665f82d1 add type='text/html' to alternate link in Notice Atom 2010-02-18 22:13:47 -05:00
Evan Prodromou c2ba764535 always distribute to inbox of author immediately 2010-02-18 07:11:20 -05:00
Brion Vibber 5a6cbb248f Merge branch 'testing' into 0.9.x 2010-02-17 10:14:08 -08:00
Zach Copley 198c046c89 - Set the root of a new local conversation to a new conversation.id
- Output conversation URIs from conversation.uri
2010-02-17 01:12:13 -08:00
Zach Copley ed46a38ecf - conversation.uri needs to be nullable
- factory method for creating new local conversations
2010-02-17 01:11:14 -08:00
Zach Copley a2f8c5da17 New Conversation DO to handle remote notices as conversation roots 2010-02-16 23:30:08 -08:00
Zach Copley 2cb243808c More sensical profile::getUri() 2010-02-16 20:13:39 -08:00
Zach Copley c892726c80 Take remote profiles into account when looking up canonical profile URIs 2010-02-16 16:22:58 -08:00
Zach Copley eea52c708b Add rel="avatar" to img links in <activity:actor> stanzas 2010-02-16 11:32:10 -08:00
Evan Prodromou 3d170bfa30 Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing 2010-02-16 12:46:02 -05:00
Evan Prodromou 71ecd68901 add a FIXME to Profile 2010-02-16 12:45:00 -05:00
Brion Vibber d5cbfe8071 Merge branch 'testing' into 0.9.x
Conflicts:
	lib/iomaster.php
2010-02-16 09:25:09 -08:00
Brion Vibber 81b6b58e33 Merge branch 'master' into testing
Conflicts:
	lib/stompqueuemanager.php
2010-02-16 09:22:02 -08:00
Brion Vibber c74aea589d Stomp queue restructuring for mass scalability:
- Multiplexing queues into groups and for multiple sites.
- Sharing vs breakout configurable per site and per queue via $config['queue']['breakout']
- Detect how many times a message is redelivered, discard if it's killed too many daemons
 - count configurable with $config['queue']['max_retries']
 - can dump the items to files in $config['queue']['dead_letter_dir']

Queue daemon memory & resource leak fixes:
- avoid unnecessary reconnections to memcached server (switch persistent connections back in on second initialization, assuming it's child process)
- monkey-patch for leaky .ini loads in DB_DataObject::databaseStructure() - was leaking 200k per active switch
- applied leak fixes to Status_network as well, using intermediate base Safe_DataObject for both it and Memcache_DataObject

Misc queue fixes:
- correct handling of child processes exiting due to signal termination instead of regular exit
- shutdown instead of infinite respawn loop if we're already past the soft memory limit at startup
- Added --all option for xmppdaemon... still opens one xmpp connection per site that has xmpp active

Cache updates:
- add Cache::increment() method with native support for memcached atomic increment
2010-02-16 09:16:51 -08:00
Evan Prodromou 269b4711eb Merge branch 'ssleverything' into testing 2010-02-13 12:39:15 -05:00
Brion Vibber f8a459a88a Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-02-12 15:32:12 -08:00
Brion Vibber d6f1df8b76 fix for Atom notice output: correct check against conversation & current id 2010-02-12 15:30:23 -08:00
Zach Copley 506c2d7491 Initial upgraded Atom output for group timelines 2010-02-12 12:24:29 -08:00
Brion Vibber 122c8677b7 Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x 2010-02-12 11:18:35 -08:00
Brion Vibber fd3c9334bf PHP 5.3 compatibility hack for DB_DataObject
statusnet.links.ini file could not be read anymore due to the entry for nonce containing a comma in its key value.
PHP's parse_ini_file() function no longer allows commas in keys, and rejects the *ENTIRE FILE* if it's present, breaking various automatic joins.
2010-02-12 11:15:12 -08:00
Brion Vibber b39047d95b OStatus: prep work for sending notifications on sub/unsub/join/leave/favorite/unfavorite via Salmon; needs to be completed and hooked up once feed gen is fixed. 2010-02-12 18:54:48 +00:00
Zach Copley 525358fa10 Fix retarded spelling mistake 2010-02-11 17:08:50 -08:00
Zach Copley 3beddffc39 ostatus:attention links in Notice Atom output 2010-02-11 16:29:27 -08:00
Evan Prodromou 31461e120f let files go to SSL dir too 2010-02-11 17:06:57 -05:00
Evan Prodromou 3018683718 let backgrounds be put under SSL 2010-02-11 17:03:31 -05:00
Zach Copley e2c0f59414 Some upgrades to Atom output for OStatus 2010-02-11 13:56:05 -08:00
Evan Prodromou d6869cde7b let avatars be served over SSL 2010-02-11 16:51:15 -05:00
Brion Vibber 8449256817 OStatus partial support for group subscriptions:
* detection of group feeds is currently a nasty hack based on presence of '/groups/' in URL -- should use some property on the feed?
* listing for the remote group is kinda cruddy; needs to be named more cleanly
* still need to establish per-author profiles (easier once we have the updated Atom code in)
* group delivery probably not right yet
* saving of group messages still triggering some weird behavior

Added support for since_id and max_id on group timeline feeds as a free extra. Enjoy!
2010-02-09 18:32:52 -08:00
Brion Vibber b2e8d8407c Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-02-08 15:48:52 -08:00
Brion Vibber 384387c9b0 OStatus cleanup...
* Treat linkless feed posts as status updates; drop the "New post:" prefix and quotes on them.
* Use stable user IDs for atom/rss2 feed links instead of unstable nicknames
* Pull Atom feed preferentially when subscribing -- can now put the remote user's profile page straight into the feed subscription form and get to the right place.
* Clean up naming for push endpoints
2010-02-08 14:58:12 -08:00
Evan Prodromou 5fdcd88176 Moderator can make users admins of a group 2010-02-06 11:36:59 +01:00
Brion Vibber 875e1a70ce Don't spew warnings on usage of MEMCACHE_COMPRESSED constant when memcache PHP extension is not present.
Switched to a locally-defined Cache::COMPRESSED, translating that to MEMCACHE_COMPRESSED in the plugin.
2010-02-05 09:47:56 -08:00
Zach Copley 23802e58d6 Merge branch 'temp' 2010-02-05 03:19:12 +00:00
Zach Copley 208eec6511 OAuth app name should not be null 2010-02-05 03:18:45 +00:00
Zach Copley e495ac356c Allow developers to delete OAuth applications 2010-02-05 03:18:43 +00:00
Zach Copley dc183f23cf OAuth app names should be unique. 2010-02-05 03:18:43 +00:00
Zach Copley 03fefb86bd Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-02-05 02:10:35 +00:00
Zach Copley 4180ab74d9 OAuth app name should not be null 2010-02-05 02:09:58 +00:00
Zach Copley 8d320d7cc2 Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing 2010-02-05 02:08:37 +00:00
Zach Copley 82f1119073 OAuth app name should not be null 2010-02-05 01:24:21 +00:00
Brion Vibber 941d0433cf Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x 2010-02-04 15:20:17 -08:00
Brion Vibber 509c8fc515 Merge branch 'master' into testing - drop debug statements 2010-02-04 15:19:09 -08:00
Brion Vibber 4502bea9a8 drop debug messages from inbox deletion fix 2010-02-04 15:16:27 -08:00
Brion Vibber bb16898b1c Inbox::streamNotices() with deletion compensation: inbox paging should more or less work with deleted items now.
No change in efficiency for the common case where nothing's deleted: does the same bulk fetch of just the notices we think we'll need as before, then if we turned up short keeps checking one by one until we've filled up to our $limit.

This can leave us with overlap between pages, but we already have that when new messages come in between clicks; seems to be the lesser of evils versus not getting a 'before' button.
More permanent fix for that will be to switch timeline paging in the UI to use notice IDs.
2010-02-04 15:15:42 -08:00
Brion Vibber 9554b4ccbf Inbox::streamNotices() with deletion compensation: inbox paging should more or less work with deleted items now.
No change in efficiency for the common case where nothing's deleted: does the same bulk fetch of just the notices we think we'll need as before, then if we turned up short keeps checking one by one until we've filled up to our $limit.

This can leave us with overlap between pages, but we already have that when new messages come in between clicks; seems to be the lesser of evils versus not getting a 'before' button.
More permanent fix for that will be to switch timeline paging in the UI to use notice IDs.
2010-02-04 15:09:04 -08:00
Brion Vibber c59eee72a8 Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x 2010-02-04 12:23:56 -08:00
Brion Vibber a020e23086 Merge branch 'master' of gitorious.org:statusnet/mainline into testing 2010-02-04 11:56:07 -08:00
Evan Prodromou dbeb388ade clear cache for Profile::hasRepeated() at Notice::insert() time 2010-02-03 12:31:25 -05:00
Evan Prodromou 20953ea3de Merge branch 'master' of git@gitorious.org:statusnet/mainline 2010-02-03 11:53:54 -05:00
Evan Prodromou 6215b9788c add nickname as unique key for user_group table 2010-02-03 11:53:31 -05:00
Brion Vibber f4c81fa1e1 Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-02-02 09:57:50 -08:00
Brion Vibber 51c3606715 Fix regression breaking file attachments. This is what I get for rushing fixes and not properly testing them. :P 2010-02-02 09:32:28 -08:00
Brion Vibber 027c7e61fd Fix regression breaking file attachments. This is what I get for rushing fixes and not properly testing them. :P 2010-02-02 09:30:15 -08:00
Zach Copley f0875ceea1 Allow developers to delete OAuth applications 2010-02-02 08:50:18 +00:00
Zach Copley df2a081265 OAuth app names should be unique. 2010-02-02 08:50:01 +00:00
Zach Copley 38bebb4c0d Allow developers to delete OAuth applications 2010-02-02 06:26:03 +00:00
Zach Copley 59d16cf16a OAuth app names should be unique. 2010-02-01 20:58:30 +00:00
Brion Vibber c14ac57b19 Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-02-01 10:30:45 -08:00
Brion Vibber 6159edcebb Improve name validation checks on local File references 2010-02-01 08:49:59 -08:00
Brion Vibber 84ab0156b4 Improve name validation checks on local File references 2010-02-01 08:48:31 -08:00
Evan Prodromou f9cb1c3265 restructuring of User::registerNew() lost password munging 2010-02-01 00:47:50 -05:00
Evan Prodromou fb36094eb1 buggy fetch for site owner 2010-01-31 22:55:07 -05:00
Evan Prodromou 779204b194 Merge branch 'testing' into 0.9.x
Conflicts:
	actions/apioauthauthorize.php
2010-01-31 15:27:58 -05:00
Evan Prodromou fec8066bf7 error clearing tags for profiles from memcached 2010-01-30 14:37:39 -05:00
Evan Prodromou 8cb8b357a4 add hooks for user registration 2010-01-29 17:54:54 -05:00
Evan Prodromou 70a4f8c0e2 method to get the site owner 2010-01-29 15:15:23 -05:00
Evan Prodromou d437b76ed1 define a constant for the 'owner' role of a site 2010-01-29 15:15:04 -05:00
Evan Prodromou f6eecf02fc add simple cache getter/setter static functions to Memcached_DataObject 2010-01-29 15:01:21 -05:00
Brion Vibber 864ce8e276 Fixes for status_network db object .ini and tag setter script 2010-01-28 20:09:17 -08:00
Evan Prodromou d13d73c563 Last-chance distribution if enqueueing fails 2010-01-28 16:53:37 -08:00
Evan Prodromou 513f8be07a hide most DB_DataObject errors 2010-01-28 16:26:55 -05:00
Evan Prodromou d5f86f7a8a Merge branch 'master' of git@gitorious.org:statusnet/mainline 2010-01-28 13:54:19 -05:00
Evan Prodromou 84b5480007 update mysqltimestamps on insert and update 2010-01-28 13:54:01 -05:00
Evan Prodromou c81318d3ca additional debugging data for Sessions 2010-01-28 13:53:28 -05:00
Brion Vibber ffaaf9de4a Don't preemptively close existing DB connections for web views (needed to keep # of conns from going insane on multi-site queue daemons, so just doing for CLI)
May, or may not, help with mystery session problems
2010-01-27 23:51:22 -08:00
Brion Vibber 644c319f5a fix notice -- drop unused return value of variable that isn't initialized :) thx @ g0 for the catch 2010-01-27 19:59:25 -08:00
Brion Vibber 3abfb454a3 Adds an emergency switch so we can run inbox distribution at save time (bypassing 'distrib' queue)
Set $config['queue']['inboxes'] = false to do so
2010-01-27 18:39:17 -08:00
Zach Copley 78079f34e2 Merge branch 'testing' into -1.9.x
* testing: (130 commits)
  HTTP auth provided is evaluated even if it's not required
  Rename rc3to09.sql to rc3torc4.sql to avoid confusion if we add a last-minute change after this!
  Add new oauth tables and modifications to 'consumer' table for rc4
  Centred leaderboard ad
  camelcase the uap param names
  move leaderboard to after the header
  Moved rectangle ad into aside and leaderboard to the right in header.
  Aligning wide skyscraper to the right instead of left
  CSS ids and classes fixed in UAPPlugin
  wrong height for rectangle in BlankAd
  Add the moved BlankAdPlugin
  make BlankAd dir and change to use a 1x1 image
  move BlankAdPlugin to its own dir
  Add BlankAdPlugin to test ad layout in different themes
  make uapplugin an abstract class
  move UAP plugin to core
  Lowercased switch cases in UAP Plugin
  Plugin for Universal Ad Package. Outputs four most widely used ad types.
  Add persistent:true property to Stomp messages so ActiveMQ doesn't decide to discard them even though persistence is enabled on the broker. :) (Thanks Aric!)
  quick fix: use common_path() on realtime update JS so it works with the new JS path code (will pull from main server for now)
  ...

Conflicts:
	actions/apioauthaccesstoken.php
	actions/apioauthauthorize.php
	actions/apioauthrequesttoken.php
	actions/editapplication.php
	actions/newapplication.php
	lib/apiauth.php
	lib/queuemanager.php
	lib/router.php
2010-01-27 14:27:22 -08:00
Brion Vibber 58be61b641 Control channel for queue daemons to request graceful shutdown, restart, or update to listen to a newly added or reconfigured site.
queuectl.php --update -s<site>
  queuectl.php --stop
  queuectl.php --restart

Default control channel is /topic/statusnet-control. For external utilities to send a site update ping direct to the queue server, connect via Stomp and send a message formatted thus:

  update:<nickname>

(Nickname here, *not* server hostname! The rest of the queues will be updated to use nicknames later.)

Note that all currently-connected queue daemons will get these notifications, including both queuedaemon.php and xmppdaemon.php. (XMPP will ignore site update requests for sites that it's not handling.)

Limitations:
* only implemented for stomp queue manager so far
* --update may not yet handle a changed server name properly
* --restart won't reload PHP code files that were already loaded at startup. Still need to stop and restart the daemons from 'outside' when updating code base.
2010-01-26 11:49:49 -08:00
Brion Vibber ad6f0501ff Site metadata tags in status_network: single 'tags' field, pipe-separated.
$sn->tags() returns tag list as array; $sn->hasTag('blah') to check for a particular tag only

Could be used to control things in config file:

  $sn = Status_network::setupSite($_server, $_path, $_wildcard);
  if (!$sn) { die("No such site"); }
  if ($sn->hasTag('individual')) { /* blah */ }

Note memcached keys are unchanged; if tags are changed from an external tool clear:
  statusnet:<dbname>:status_network:<key>:<val>
  for <key>s 'nickname', 'hostname', and 'pathname'
2010-01-26 10:33:20 -08:00
Evan Prodromou 663e4e02a1 Merge branch 'master' into testing
Conflicts:
	lib/queuemanager.php
2010-01-25 18:13:09 -05:00
Evan Prodromou b6aa1511eb Merge branch 'master' into 0.9.x 2010-01-25 18:10:59 -05:00
Evan Prodromou e26a843caf Offload inbox updates to a queue handler to speed up posting online
Moved much of the writing that happens when posting a notice to a new
queuehandler, distribqueuehandler. This updates tags, groups, replies
and inboxes at queue time (or at Web time, if queues are disabled).

To make this work well, I had to break up the monolithic
Notice::blowCaches() and make cache blowing happen closer to where
data is updated.

Squashed commit of the following:

commit 5257626c62750ac4ac1db0ce2b71410c5711cfa3
Author: Evan Prodromou <evan@status.net>
Date:   Mon Jan 25 14:56:41 2010 -0500

    slightly better handling of blowing tag memory cache

commit 8a22a3cdf6ec28685da129a0313e7b2a0837c9ef
Author: Evan Prodromou <evan@status.net>
Date:   Mon Jan 25 01:42:56 2010 -0500

    change 'distribute' to 'distrib' so not too long for dbqueue

commit 7a063315b0f7fad27cb6fbd2bdd74e253af83e4f
Author: Evan Prodromou <evan@status.net>
Date:   Mon Jan 25 01:39:15 2010 -0500

    change handle_notice() to handle() in distributqueuehandler

commit 1a39ccd28b9994137d7bfd21bb4f230546938e77
Author: Evan Prodromou <evan@status.net>
Date:   Mon Jan 25 16:05:25 2010 -0500

    error with queuemanager

commit e6b3bb93f305cfd2de71a6340b8aa6fb890049b7
Author: Evan Prodromou <evan@status.net>
Date:   Mon Jan 25 01:11:34 2010 -0500

    Blow memcache at different point rather than one big function for Notice class

commit 94d557cdc016187d1d0647ae1794cd94d6fb8ac8
Author: Evan Prodromou <evan@status.net>
Date:   Mon Jan 25 00:48:44 2010 -0500

    Blow memcache at different point rather than one big function for Notice class

commit 1c781dd08c88a35dafc5c01230b4872fd6b95182
Author: Evan Prodromou <evan@status.net>
Date:   Wed Jan 20 08:54:18 2010 -0500

    move broadcasting and distributing to new queuehandler

commit da3e46d26b84e4f028f34a13fd2ee373e4c1b954
Author: Evan Prodromou <evan@status.net>
Date:   Wed Jan 20 08:53:12 2010 -0500

    Move distribution of notices to new distribute queue handler
2010-01-25 18:08:21 -05:00
Evan Prodromou 536170d788 Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing 2010-01-24 22:42:29 -05:00
Evan Prodromou e6cf293db8 Recover caching logic lost in bad merge
I made a bad merge on Jan 10th from master to 0.9.x. This lost a number
of memcache enhancements made on the 0.9.x branch. I've been able to
re-do the manual merge, and this represents the changes. Most of them
are related to caching on insert.
2010-01-24 22:39:32 -05:00
Zach Copley 6efbf2777a Add verifier and verified callback to token for OAuth 1.0a 2010-01-24 16:36:05 -08:00
Zach Copley d33040089d Remove verifier from Oauth_application_user (not needed there) 2010-01-24 16:36:05 -08:00
Zach Copley 9e7f47652d Revoke access token UI 2010-01-24 16:36:05 -08:00
Zach Copley adfca01808 Can now edit/change application icon 2010-01-24 16:36:04 -08:00
Zach Copley c78937537e Better detial in connected OAuth applications list 2010-01-24 16:36:03 -08:00
Zach Copley c2337ab47c Decided we didn't need to keep the token secret in the
Oauth_application_user record
2010-01-24 16:36:02 -08:00
Zach Copley a0b8438773 Exchanging authorized request tokens for access tokens working 2010-01-24 16:36:02 -08:00
Zach Copley c473a39a7d Associate request tokens with OAuth apps and app users 2010-01-24 16:36:02 -08:00
Zach Copley 48e5f2b3c5 Add icons/icon upload to Oauth apps 2010-01-24 16:36:02 -08:00
Zach Copley 3c2b05d222 Workflow for registering new OAuth apps pretty much done. 2010-01-24 16:36:02 -08:00
Zach Copley 035c475b45 It might help if I checkd in statusnet.ini. 2010-01-24 16:36:02 -08:00
Zach Copley ae46bc5fff Started work on interface for displaying connected OAuth apps 2010-01-24 16:36:01 -08:00
Zach Copley efd84cadc0 Changed the OAuth app tables to refer to profiles instead of users.
Added an owner column to oauth_application.
2010-01-24 16:36:01 -08:00
Zach Copley c0b832d19f Add new OAuth application tables and DataObjects. Also add a new
column for consumer secret to consumer table.
2010-01-24 16:36:01 -08:00
Evan Prodromou 8dce24c82c save nickname and wildcard when setting up status network 2010-01-24 16:01:00 -08:00
Evan Prodromou 238998eca0 save nickname and wildcard when setting up status network 2010-01-24 18:18:24 -05:00
Brion Vibber c7507e7e9d XMPP queued output & initial retooling of DB queue manager to support non-Notice objects.
Queue handlers for XMPP individual & firehose output now send their XML stanzas
to another output queue instead of connecting directly to the chat server. This
lets us have as many general processing threads as we need, while all actual
XMPP input and output go through a single daemon with a single connection open.

This avoids problems with multiple connected resources:
* multiple windows shown in some chat clients (psi, gajim, kopete)
* extra load on server
* incoming message delivery forwarding issues

Database changes:
* queue_item drops 'notice_id' in favor of a 'frame' blob.
  This is based on Craig Andrews' work branch to generalize queues to take any
  object, but conservatively leaving out the serialization for now.
  Table updater (preserves any existing queued items) in db/rc3to09.sql

Code changes to watch out for:
* Queue handlers should now define a handle() method instead of handle_notice()
* QueueDaemon and XmppDaemon now share common i/o (IoMaster) and respawning
  thread management (RespawningDaemon) infrastructure.
* The polling XmppConfirmManager has been dropped, as the message is queued
  directly when saving IM settings.
* Enable $config['queue']['debug_memory'] to output current memory usage at
  each run through the event loop to watch for memory leaks

To do:
* Adapt XMPP i/o to component connection mode for multi-site support.
* XMPP input can also be broken out to a queue, which would allow the actual
  notice save etc to be handled by general queue threads.
* Make sure there are no problems with simply pushing serialized Notice objects
  to queues.
* Find a way to improve interactive performance of the database-backed queue
  handler; polling is pretty painful to XMPP.
* Possibly redo the way QueueHandlers are injected into a QueueManager. The
  grouping used to split out the XMPP output queue is a bit awkward.

Conflicts:

	scripts/xmppdaemon.php
2010-01-22 12:52:36 -08:00
Evan Prodromou d25bd9b292 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-22 14:19:08 -05:00
Evan Prodromou c8bc598cfd Merge branch 'testing' into 0.9.x 2010-01-22 14:18:43 -05:00
Evan Prodromou e666433eb4 Merge branch 'master' into 0.9.x 2010-01-22 14:18:40 -05:00
Evan Prodromou 29d83c8ca9 Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing 2010-01-22 14:18:21 -05:00
Evan Prodromou a3e484a0e8 Memcached_DataObject unnecessarily require_once'd itself 2010-01-22 10:46:11 -05:00
Craig Andrews 672126968f Updated some references to the long gnone "isEnclosure" function to the new "getEnclosure" 2010-01-22 10:12:26 -05:00
Brion Vibber 0e852def6a XMPP queued output & initial retooling of DB queue manager to support non-Notice objects.
Queue handlers for XMPP individual & firehose output now send their XML stanzas
to another output queue instead of connecting directly to the chat server. This
lets us have as many general processing threads as we need, while all actual
XMPP input and output go through a single daemon with a single connection open.

This avoids problems with multiple connected resources:
* multiple windows shown in some chat clients (psi, gajim, kopete)
* extra load on server
* incoming message delivery forwarding issues

Database changes:
* queue_item drops 'notice_id' in favor of a 'frame' blob.
  This is based on Craig Andrews' work branch to generalize queues to take any
  object, but conservatively leaving out the serialization for now.
  Table updater (preserves any existing queued items) in db/rc3to09.sql

Code changes to watch out for:
* Queue handlers should now define a handle() method instead of handle_notice()
* QueueDaemon and XmppDaemon now share common i/o (IoMaster) and respawning
  thread management (RespawningDaemon) infrastructure.
* The polling XmppConfirmManager has been dropped, as the message is queued
  directly when saving IM settings.
* Enable $config['queue']['debug_memory'] to output current memory usage at
  each run through the event loop to watch for memory leaks

To do:
* Adapt XMPP i/o to component connection mode for multi-site support.
* XMPP input can also be broken out to a queue, which would allow the actual
  notice save etc to be handled by general queue threads.
* Make sure there are no problems with simply pushing serialized Notice objects
  to queues.
* Find a way to improve interactive performance of the database-backed queue
  handler; polling is pretty painful to XMPP.
* Possibly redo the way QueueHandlers are injected into a QueueManager. The
  grouping used to split out the XMPP output queue is a bit awkward.
2010-01-21 22:40:35 -08:00
Brion Vibber 26fdf0c9d2 XMPP queued output & initial retooling of DB queue manager to support non-Notice objects.
Queue handlers for XMPP individual & firehose output now send their XML stanzas
to another output queue instead of connecting directly to the chat server. This
lets us have as many general processing threads as we need, while all actual
XMPP input and output go through a single daemon with a single connection open.

This avoids problems with multiple connected resources:
* multiple windows shown in some chat clients (psi, gajim, kopete)
* extra load on server
* incoming message delivery forwarding issues

Database changes:
* queue_item drops 'notice_id' in favor of a 'frame' blob.
  This is based on Craig Andrews' work branch to generalize queues to take any
  object, but conservatively leaving out the serialization for now.
  Table updater (preserves any existing queued items) in db/rc3to09.sql

Code changes to watch out for:
* Queue handlers should now define a handle() method instead of handle_notice()
* QueueDaemon and XmppDaemon now share common i/o (IoMaster) and respawning
  thread management (RespawningDaemon) infrastructure.
* The polling XmppConfirmManager has been dropped, as the message is queued
  directly when saving IM settings.
* Enable $config['queue']['debug_memory'] to output current memory usage at
  each run through the event loop to watch for memory leaks

To do:
* Adapt XMPP i/o to component connection mode for multi-site support.
* XMPP input can also be broken out to a queue, which would allow the actual
  notice save etc to be handled by general queue threads.
* Make sure there are no problems with simply pushing serialized Notice objects
  to queues.
* Find a way to improve interactive performance of the database-backed queue
  handler; polling is pretty painful to XMPP.
* Possibly redo the way QueueHandlers are injected into a QueueManager. The
  grouping used to split out the XMPP output queue is a bit awkward.
2010-01-21 16:42:50 -08:00
Brion Vibber c9c7bb3234 Merge commit 'origin/testing' into 0.9.x 2010-01-21 16:33:11 -08:00
Brion Vibber 8dafe09ab2 Option to log slow db queries or all db queries
$config['db']['log_queries'] = true; // all
$config['db']['log_slow_queries'] = 10; // queries taking > 10 seconds
2010-01-21 11:07:52 -08:00
Evan Prodromou 01dc77c2fd Merge branch 'master' into 0.9.x 2010-01-19 00:31:42 -05:00
Brion Vibber d35faa04c1 Fix for background recalculation of groups; needs to get Group objects not IDs; also don't list any groups for repeats to match saveGroups behavior
todo: merge calculation portion with saveGroups so they don't get out of sync
2010-01-15 13:06:21 -08:00
Brion Vibber 963260d262 Fix since_id and max_id API parameters for inbox-based loads; was failing if the exact id mentioned wasn't present in the inbox (or had been trimmed out) 2010-01-15 10:03:02 -08:00
Brion Vibber 745d428365 Fix since_id and max_id API parameters for inbox-based loads; was failing if the exact id mentioned wasn't present in the inbox (or had been trimmed out) 2010-01-15 10:01:50 -08:00
Brion Vibber ef016dca45 Merge branch 'master' of gitorious.org:statusnet/mainline into 0.9.x 2010-01-15 09:52:50 -08:00
Evan Prodromou 16742d0fde do since_id and max_id in inbox 2010-01-13 22:32:17 -08:00
Evan Prodromou abd67452da go straight to the DB for inbox before insert 2010-01-13 22:12:19 -08:00
Zach Copley ee8c1ec91c Add verifier and verified callback to token for OAuth 1.0a 2010-01-14 02:41:10 +00:00
Zach Copley ead1ef4c68 Remove verifier from Oauth_application_user (not needed there) 2010-01-14 02:41:10 +00:00
Zach Copley 38269a6579 Revoke access token UI 2010-01-14 02:41:10 +00:00
Zach Copley 0d7490470d Can now edit/change application icon 2010-01-14 02:41:08 +00:00
Zach Copley 31c5ebb95c Better detial in connected OAuth applications list 2010-01-14 02:41:06 +00:00
Zach Copley bfe3e3c74e Decided we didn't need to keep the token secret in the
Oauth_application_user record
2010-01-14 02:41:06 +00:00
Zach Copley d8abad7478 Exchanging authorized request tokens for access tokens working 2010-01-14 02:41:06 +00:00
Zach Copley e7f4ab6774 Associate request tokens with OAuth apps and app users 2010-01-14 02:41:05 +00:00
Zach Copley b14a97f5f9 Add icons/icon upload to Oauth apps 2010-01-14 02:41:05 +00:00
Zach Copley dad67b030f Workflow for registering new OAuth apps pretty much done. 2010-01-14 02:41:04 +00:00
Zach Copley 8e0499a233 It might help if I checkd in statusnet.ini. 2010-01-14 02:41:04 +00:00
Zach Copley 5bff6651ba Started work on interface for displaying connected OAuth apps 2010-01-14 02:41:04 +00:00
Zach Copley 6e64ce3777 Changed the OAuth app tables to refer to profiles instead of users.
Added an owner column to oauth_application.
2010-01-14 02:41:04 +00:00
Zach Copley 14bcac31b8 Add new OAuth application tables and DataObjects. Also add a new
column for consumer secret to consumer table.
2010-01-14 02:41:04 +00:00
Evan Prodromou 4d7cdbf1c6 don't write Inbox if on a read-only page, but encache 2010-01-13 16:28:42 -08:00
Evan Prodromou d032fc038a make sure whoGets() doesn't write anything 2010-01-13 12:37:01 -08:00
Brion Vibber 0e1f2d4b47 Fix regressions in XMPP output during inbox refactoring
- NOTICE_INBOX_SOURCE_* constants moved to common.php since Notice_inbox.php not always loaded
- fixed typo in User::staticGet() call which caused user #1 to receive messages once for each subscriber instead of for him/herself
- 'continue' -> 'continue 2' inside switch() statement to fix loop escape (PHP considers switch() a looping construct for break & continue)
2010-01-13 18:17:36 +00:00
Evan Prodromou 430bd69312 add events for subscribing to people and joining groups 2010-01-13 02:16:13 -08:00
Evan Prodromou 43ff542189 Don't save reply info for repeats 2010-01-13 01:13:06 -08:00
Evan Prodromou 8bfa7fdeaf repeats don't get posted to groups 2010-01-13 00:47:12 -08:00
Evan Prodromou 5397249e50 remove vestiges of Notice_inbox from cache clearing code in Notice 2010-01-13 00:45:12 -08:00
Evan Prodromou 1bbd19169f unimplement repeatedToMe() until we figure out how 2010-01-13 00:44:29 -08:00
Evan Prodromou 3d579fc580 memoize Notice::whoGets() 2010-01-13 00:16:54 -08:00
Evan Prodromou 436b8c845e Merge branch '0.9.x' into inblob 2010-01-12 23:53:52 -08:00
Evan Prodromou fb0d837ddc remove transaction for Notice save; causes deadlocks 2010-01-12 23:41:33 -08:00
Brion Vibber ec145b73fc Major refactoring of queue handlers to support running multiple sites in one daemon.
Key changes:
* Initialization code moved from common.php to StatusNet class;
  can now switch configurations during runtime.
* As a consequence, configuration files must now be idempotent...
  Be careful with constant, function or class definitions.
* Control structure for daemons/QueueManager/QueueHandler has been refactored;
  the run loop is now managed by IoMaster run via scripts/queuedaemon.php
  IoManager subclasses are woken to handle socket input or polling, and may
  cover multiple sites.
* Plugins can implement notice queue handlers more easily by registering a
  QueueHandler class; no more need to add a daemon.

The new QueueDaemon runs from scripts/queuedaemon.php:

* This replaces most of the old *handler.php scripts; they've been refactored
  to the bare handler classes.
* Spawns multiple child processes to spread load; defaults to CPU count on
  Linux and Mac OS X systems, or override with --threads=N
* When multithreaded, child processes are automatically respawned on failure.
* Threads gracefully shut down and restart when passing a soft memory limit
  (defaults to 90% of memory_limit), limiting damage from memory leaks.
* Support for UDP-based monitoring: http://www.gitorious.org/snqmon

Rough control flow diagram:
QueueDaemon -> IoMaster -> IoManager
                           QueueManager [listen or poll] -> QueueHandler
                           XmppManager [ping & keepalive]
                           XmppConfirmManager [poll updates]

Todo:

* Respawning features not currently available running single-threaded.
* When running single-site, configuration changes aren't picked up.
* New sites or config changes affecting queue subscriptions are not yet
  handled without a daemon restart.
* SNMP monitoring output to integrate with general tools (nagios, ganglia)
* Convert XMPP confirmation message sends to use stomp queue instead of polling
* Convert xmppdaemon.php to IoManager?
* Convert Twitter status, friends import polling daemons to IoManager
* Clean up some error reporting and failure modes
* May need to adjust queue priorities for best perf in backlog/flood cases

Detailed code history available in my daemon-work branch:
http://www.gitorious.org/~brion/statusnet/brion-fixes/commits/daemon-work
2010-01-12 20:45:09 -08:00
Brion Vibber 4cc9b183d7 Avoid spewing warnings about returning by reference on memcached cache misses by setting a var and returning it instead of trying to return false directly.
This hacky workaround is brought to you by DB_DataObject's PHP 4 roots.
2010-01-12 12:20:45 -08:00
Evan Prodromou ecb3abf84c Merge branch '0.9.x' into inblob 2010-01-11 16:28:27 -08:00
Brion Vibber f397d35527 Regression fix: don't spew notices to log every time we get a non-cached user object 2010-01-11 13:24:52 -08:00
Evan Prodromou 8809e577b2 Merge branch 'sessionidparam' into 0.9.x
Conflicts:
	lib/command.php
2010-01-11 00:45:26 -08:00
Evan Prodromou 866dfa6822 Merge branch 'master' into 0.9.x
Conflicts:
	classes/Memcached_DataObject.php
2010-01-10 14:18:19 -08:00
Evan Prodromou 2e42d3336a check before saving a thumbnail 2010-01-10 13:25:16 -08:00
Evan Prodromou f463329b9a check before inserting File_oembed and File_thumbnail 2010-01-10 13:18:53 -08:00
Evan Prodromou 9d3893255a don't put Users with object IDs in the cache, and don't fetch them 2010-01-10 12:31:43 -08:00
Evan Prodromou e2dee5fedb always set site/server to hostname if it exists 2010-01-10 00:20:08 -08:00
Evan Prodromou 3d723ed1ed allow hostname with SSL 2010-01-09 22:49:26 -08:00
Evan Prodromou e8d85a1ef5 use nickname, not sitename, in domain for SSL 2010-01-09 22:48:05 -08:00
Evan Prodromou deb5ee6154 correct superglobal variable name 2010-01-09 16:31:25 -08:00
Evan Prodromou 5ca41b6870 redirect to sitename.wildcard for SSL 2010-01-09 16:19:45 -08:00
Evan Prodromou ed5828f30e Redirect to a one-time-password when ssl and regular server are different 2010-01-09 15:26:06 -08:00
Evan Prodromou 96e51dad4b whoGets() method for Notice 2010-01-09 13:55:54 -08:00
Evan Prodromou 5e81149e47 create new Inbox from Notice_inbox if not exists at read/write time 2010-01-09 10:26:50 -08:00
Evan Prodromou 920c878221 initialize an Inbox from Notice_inbox records 2010-01-09 10:02:07 -08:00
Evan Prodromou 1de0f37f0d disable all Notice_inbox functions 2010-01-09 10:02:07 -08:00
Evan Prodromou 72934e9f50 Revert "Replace Notice_inbox with Inbox"
We use Notice_inbox to transition to Inbox.

This reverts commit 7640d3f07b.
2010-01-09 10:02:07 -08:00
Evan Prodromou 1e7ec69190 some formatting changes to make inblobs work 2010-01-09 10:02:07 -08:00
Evan Prodromou f2a403589c Use inbox instead of notice_inbox 2010-01-09 10:02:07 -08:00
Evan Prodromou 7ec27b657e Replace Notice_inbox with Inbox 2010-01-09 10:02:07 -08:00
Evan Prodromou 475bf6010f flip exe bit 2010-01-09 10:01:21 -08:00
Evan Prodromou 8b2f6c01fb add inbox data class 2010-01-09 10:01:21 -08:00
Evan Prodromou c0a062dd85 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-07 14:56:09 -08:00
Ciaran Gultnieks deeaafe712 Fixes to bugs where non-local messages were being wrong put in the public timeline and public xmpp feed 2010-01-07 20:59:31 +00:00
Evan Prodromou b2bab7d7ca fixup keytypes so it returns the types no matter what kind of class it is 2010-01-06 23:34:59 -08:00
Evan Prodromou a55939f3b1 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-06 23:23:30 -08:00
Evan Prodromou e50410683f only encache new objects when insert was successful 2010-01-06 16:34:18 -10:00
Brion Vibber 4e2acd153b ...and drop the unnecessary &reference from child class pkeyGet() overrides. 2010-01-06 14:28:40 -08:00
Brion Vibber 85554d0840 Rearrange Memcached_DataObject::staticGet() to avoid "only variables can be passed by reference" warnings when DB lookup fails and we return false.
(We need to keep it returning a reference because the extlib parent class is stuck in PHP 4-land and uses references everywhere, including this function's return value. Yuck!)

Also changed pkeyGet to drop the reference, since it doesn't have an upstream equivalent.
2010-01-06 13:35:13 -08:00
Brion Vibber b93244395f Fix for broken profile flag admin UI: delete stray flag entries when users are deleted so broken entries don't litter the lookups.
* added ProfileDeleteRelated event to match UserDeleteRelated, to allow plugins to add extra related tables on profile deletion
* UserFlagPlugin: deleting flags when target profile is deleted
* UserFlagPlugin: deleting flags when flagging user is deleted
* UserFlagPlugin: fix for autoloader -- class names are case-insensitive. We may get lowercase class names coming in at times, such as when creating DB objects programatically from a table name.

Note that any already-existing bogus entries need to be removed from the database:
select * from user_flag_profile where (select id from profile where id=profile_id) is null;
select * from user_flag_profile where (select id from user where id=user_id) is null;
2010-01-06 11:10:33 -08:00
Evan Prodromou 35d4587172 encache on insert instead of decaching 2010-01-05 19:48:43 -10:00
Brion Vibber 8af7ba0226 Fix for overlong RT trimming: don't trim if textlimit is 0 (unlimited) 2010-01-05 16:16:25 -08:00
Brion Vibber bbbec435b0 Fix for overlong RT trimming: don't trim if textlimit is 0 (unlimited) 2010-01-05 16:15:12 -08:00
Brion Vibber eb22d2d240 Ticket 2135: trim overlong repeats with ellipsis rather than failing.
In web interface and retweet/repeat API we show the original untrimmed text, but some back-compat API messages will still show the trimmed 'RT' version.
This matches Twitter's behavior on overlong retweets, though we're outputting the RT version in more API results than they do.
2010-01-05 16:11:02 -08:00
Brion Vibber 9215496902 Ticket 2135: trim overlong repeats with ellipsis rather than failing.
In web interface and retweet/repeat API we show the original untrimmed text, but some back-compat API messages will still show the trimmed 'RT' version.
This matches Twitter's behavior on overlong retweets, though we're outputting the RT version in more API results than they do.
2010-01-05 16:10:00 -08:00
Brion Vibber aff78e5121 Cache fixes:
* We now cache negative lookups; clear them in Memcached_DataObject->insert()
* Mark file.url as a unique key in statusnet.ini so its negative lookups are cleared properly (first save of a notice with a new URL was failing due to double-insert)
* Now using serialization for default in-process cache instead of just saving objects; avoids potential corruption if you save an object to cache, change the original object, then fetch the same key from cache again
2010-01-05 15:05:53 -08:00
Craig Andrews 250bcfa8dc Require users to login to view attachments on private sites
Thank you jeff-themovie for this implementation!
2010-01-05 17:49:28 -05:00
Craig Andrews 9e2e0605ed Move Authorization and Authentication plugin structures into core, instead of as plugins.
This move makes sense as you can addPlugin('Authentication') for example - these are abstract classes designed to be implemented, not used directly.
2010-01-05 13:56:22 -05:00
Evan Prodromou 4e84c523b7 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Conflicts:
	classes/Memcached_DataObject.php
2010-01-04 22:50:04 -10:00
Evan Prodromou 7aeb11bb07 Merge branch 'master' into 0.9.x
Conflicts:
	actions/publictagcloud.php
	classes/Memcached_DataObject.php
2010-01-04 15:14:54 -10:00
Brion Vibber 78214c4e06 Exclude process-specific link & result cache references from serialized Memcached_Data_Object instances.
Should fix seemingly-random bugs due to destructor free()ing local resources by mistake.

cherry-pick from 0.9.x
2010-01-04 14:38:56 -08:00
Brion Vibber 8f02379f6e Revert "Take Memcached_DataObject destructor back out to check whether it might be causing some under-the-hood problems."
This reverts commit 89cca01259.
2010-01-04 14:37:39 -08:00
Brion Vibber 440b9957f9 Exclude process-specific link & result cache references from serialized Memcached_Data_Object instances.
Should fix seemingly-random bugs due to destructor free()ing local resources by mistake.
2010-01-04 14:30:45 -08:00
Evan Prodromou 06b6a27d7d cached id streams can be empty, compare against false 2010-01-04 10:03:57 -10:00
Evan Prodromou 254ea279d8 carefully compare cached settings against false for Config 2010-01-04 10:02:59 -10:00
Evan Prodromou abc9b33241 Memcached_DataObject stores empty values in the cache
There's great value in knowing that something doesn't exist. We
now cache this information, and carefully compare the results from
cache as $results !== false instead of !empty($results), since some
empty values (null, 0, empty array, empty string) are stored in the
cache.

Caching staticGet() and pkeyGet() now store DB misses in the cache,
and cachedQuery() checks for empty results from the cache.
2010-01-04 10:00:17 -10:00
Evan Prodromou 5a1ea0b9b2 Stop caching unfindable keys
There were some problems with the automated cache/uncache system
for data objects that made us cache unfindable keys (with null
attributes and sometimes null names). Fixed those problems and
refactored the encache() and decache() methods so they use a helper
to find the cache keys to use.
2010-01-04 08:59:19 -10:00
Evan Prodromou 8f362e9956 user_id is a non-autoincrement pkey for user_location_prefs 2010-01-04 08:53:28 -10:00
Evan Prodromou d5fb88e1c0 Revert "use keys() instead of keyTypes() so plugin data object work"
This reverts commit ec380887f7.
2010-01-03 11:24:05 -10:00
Evan Prodromou ec380887f7 use keys() instead of keyTypes() so plugin data object work 2010-01-03 10:52:24 -10:00
Evan Prodromou 90a2563a90 Merge branch 'master' into 0.9.x
Conflicts:
	classes/Memcached_DataObject.php
2010-01-02 19:47:34 -10:00
Evan Prodromou d32fb7c7c4 return false from Memcached_DataObject::staticGet() on not found, like DB_DataObject 2010-01-02 16:28:46 -10:00
Evan Prodromou 2bd32dfad7 change harmless check of to check of in Memcached_DataObject 2010-01-02 16:21:19 -10:00
Evan Prodromou 52fbd10162 incorrectly used empty() instead of isset() for a variable that could be 0 2010-01-02 08:36:47 -10:00
Evan Prodromou d2bbf65f19 Merge branch 'master' of git@gitorious.org:statusnet/mainline 2010-01-01 11:27:28 -10:00
Evan Prodromou 79c2e3f720 Revert "add cleanup method to cleanup a single row"
This reverts commit b0527801d9.
2010-01-01 11:27:13 -10:00
Evan Prodromou a9d8359208 Merge branch 'master' into 0.9.x
Conflicts:
	classes/Memcached_DataObject.php
2010-01-01 11:20:25 -10:00
Evan Prodromou b0527801d9 add cleanup method to cleanup a single row 2010-01-01 11:02:56 -10:00
Evan Prodromou 727978332a stop using DB_DataObject's staticGet() which caches 2010-01-01 10:57:22 -10:00
Evan Prodromou 053b8c600d Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2009-12-31 09:14:55 -10:00
Brion Vibber 89cca01259 Take Memcached_DataObject destructor back out to check whether it might be causing some under-the-hood problems. 2009-12-30 16:42:57 -08:00
Brion Vibber ff50c2b91d Revert debugging code 2009-12-30 16:40:59 -08:00
Brion Vibber 9218cce3cd subbug debug info to check on free ordering 2009-12-30 15:55:15 -08:00
Evan Prodromou ad8ea98cd7 Merge branch 'locshunt2' into 0.9.x
Conflicts:
	classes/User_location_prefs.php
2009-12-30 08:57:39 -10:00
Evan Prodromou 544e884d30 Add magic formula to keep DB_DataObject from treating location prefs pkey as autoincrement 2009-12-30 08:56:43 -10:00
Brion Vibber 45c9d3d729 Add progress output and optional --sleep-time parameter to triminboxes.php 2009-12-29 14:17:03 -08:00
Brion Vibber e3850e5273 Add progress output and optional --sleep-time parameter to triminboxes.php 2009-12-29 14:16:22 -08:00
Brion Vibber 0fb114c34f Fix for saving user location preferences -- user_id field was marked as an auto-increment and wasn't getting saved with new inserts. 2009-12-29 12:49:28 -08:00
Evan Prodromou a1b130541b Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2009-12-29 12:48:59 -08:00
Evan Prodromou 05e2b4d92d Merge branch 'master' into 0.9.x 2009-12-29 12:09:17 -08:00
Brion Vibber e152bec282 Fix for saving user location preferences -- user_id field was marked as an auto-increment and wasn't getting saved with new inserts. 2009-12-29 11:46:10 -08:00
Evan Prodromou 45c4078ca9 notices are immutable, use created date for updated 2009-12-28 17:51:04 -08:00
Evan Prodromou e3789be03f Move location-argument-handling code into a single function
Moved the important parts of the location-argument-handling stuff
to a single function. Handles defaults and overrides correctly, and
easy to use. Changed Web and API channels to use it.
2009-12-28 15:59:24 -08:00
Evan Prodromou 97f611107a More configuration options for location sharing 2009-12-28 15:58:58 -08:00
Evan Prodromou 6a6d88f0f4 user_id is primary key for user_location_prefs 2009-12-28 15:58:47 -08:00
Evan Prodromou c1e3b2f032 remove namespace setting from location; it's unused 2009-12-28 15:58:05 -08:00
Evan Prodromou 33786b2c4e turn off exe bits 2009-12-28 15:57:54 -08:00
Evan Prodromou 51a33dc66d add user-location-prefs data objects 2009-12-28 15:57:38 -08:00
Evan Prodromou e119362fde Merge branch 'locshunt' into 0.9.x 2009-12-28 15:49:27 -08:00
Evan Prodromou 98a579fedf Merge branch 'master' into 0.9.x 2009-12-28 15:49:14 -08:00
Evan Prodromou ca6669538a Move location-argument-handling code into a single function
Moved the important parts of the location-argument-handling stuff
to a single function. Handles defaults and overrides correctly, and
easy to use. Changed Web and API channels to use it.
2009-12-28 15:13:15 -08:00
Evan Prodromou 39bdda9c7e More configuration options for location sharing 2009-12-28 14:43:34 -08:00
Evan Prodromou 29a1669c01 user_id is primary key for user_location_prefs 2009-12-28 14:43:14 -08:00
Evan Prodromou bb93d6b1c7 remove namespace setting from location; it's unused 2009-12-28 14:21:07 -08:00
Evan Prodromou bbf516b965 turn off exe bits 2009-12-28 13:59:31 -08:00
Evan Prodromou c326824135 add user-location-prefs data objects 2009-12-28 13:59:03 -08:00
Evan Prodromou c07f221040 check if other user exists before unsub 2009-12-28 10:42:31 -08:00
Evan Prodromou 3262930ed4 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2009-12-23 10:31:27 -08:00
Brion Vibber fa0fbd0118 Fix for massively slow friends timeline query due to indexing bug introduced with repeats.
Sorting on notice.id when our primary selector was notice_inbox.user_id caused a filesort and table scan of the notice table.
Switchng to notice_inbox's notice_id means we can use our index, and everything comes right up.

Before:
mysql> explain SELECT notice.id AS id FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id WHERE notice_inbox.user_id = 18574 AND notice.repeat_of IS NULL ORDER BY notice.id DESC LIMIT 61 OFFSET 0;
+----+-------------+--------------+--------+------------------------------------+---------+---------+-------------------------------+--------+----------------------------------------------+
| id | select_type | table        | type   | possible_keys                      | key     | key_len | ref                           | rows   | Extra                                        |
+----+-------------+--------------+--------+------------------------------------+---------+---------+-------------------------------+--------+----------------------------------------------+
|  1 | SIMPLE      | notice_inbox | ref    | PRIMARY,notice_inbox_notice_id_idx | PRIMARY | 4       | const                         | 102600 | Using index; Using temporary; Using filesort |
|  1 | SIMPLE      | notice       | eq_ref | PRIMARY                            | PRIMARY | 4       | stoica.notice_inbox.notice_id |      1 | Using index                                  |
+----+-------------+--------------+--------+------------------------------------+---------+---------+-------------------------------+--------+----------------------------------------------+

After:
mysql> explain SELECT notice.id AS id FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id WHERE notice_inbox.user_id = 18574 AND notice.repeat_of IS NULL ORDER BY notice_id DESC LIMIT 61 OFFSET 0;
+----+-------------+--------------+--------+------------------------------------+---------+---------+-------------------------------+--------+--------------------------+
| id | select_type | table        | type   | possible_keys                      | key     | key_len | ref                           | rows   | Extra                    |
+----+-------------+--------------+--------+------------------------------------+---------+---------+-------------------------------+--------+--------------------------+
|  1 | SIMPLE      | notice_inbox | ref    | PRIMARY,notice_inbox_notice_id_idx | PRIMARY | 4       | const                         | 102816 | Using where; Using index |
|  1 | SIMPLE      | notice       | eq_ref | PRIMARY,notice_repeatof_idx        | PRIMARY | 4       | stoica.notice_inbox.notice_id |      1 | Using where              |
+----+-------------+--------------+--------+------------------------------------+---------+---------+-------------------------------+--------+--------------------------+
2009-12-22 20:30:41 -08:00
Brion Vibber eab6d1c954 Fix for massively slow friends timeline query due to indexing bug introduced with repeats.
Sorting on notice.id when our primary selector was notice_inbox.user_id caused a filesort and table scan of the notice table.
Switchng to notice_inbox's notice_id means we can use our index, and everything comes right up.

Before:
mysql> explain SELECT notice.id AS id FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id WHERE notice_inbox.user_id = 18574 AND notice.repeat_of IS NULL ORDER BY notice.id DESC LIMIT 61 OFFSET 0;
+----+-------------+--------------+--------+------------------------------------+---------+---------+-------------------------------+--------+----------------------------------------------+
| id | select_type | table        | type   | possible_keys                      | key     | key_len | ref                           | rows   | Extra                                        |
+----+-------------+--------------+--------+------------------------------------+---------+---------+-------------------------------+--------+----------------------------------------------+
|  1 | SIMPLE      | notice_inbox | ref    | PRIMARY,notice_inbox_notice_id_idx | PRIMARY | 4       | const                         | 102600 | Using index; Using temporary; Using filesort |
|  1 | SIMPLE      | notice       | eq_ref | PRIMARY                            | PRIMARY | 4       | stoica.notice_inbox.notice_id |      1 | Using index                                  |
+----+-------------+--------------+--------+------------------------------------+---------+---------+-------------------------------+--------+----------------------------------------------+

After:
mysql> explain SELECT notice.id AS id FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id WHERE notice_inbox.user_id = 18574 AND notice.repeat_of IS NULL ORDER BY notice_id DESC LIMIT 61 OFFSET 0;
+----+-------------+--------------+--------+------------------------------------+---------+---------+-------------------------------+--------+--------------------------+
| id | select_type | table        | type   | possible_keys                      | key     | key_len | ref                           | rows   | Extra                    |
+----+-------------+--------------+--------+------------------------------------+---------+---------+-------------------------------+--------+--------------------------+
|  1 | SIMPLE      | notice_inbox | ref    | PRIMARY,notice_inbox_notice_id_idx | PRIMARY | 4       | const                         | 102816 | Using where; Using index |
|  1 | SIMPLE      | notice       | eq_ref | PRIMARY,notice_repeatof_idx        | PRIMARY | 4       | stoica.notice_inbox.notice_id |      1 | Using where              |
+----+-------------+--------------+--------+------------------------------------+---------+---------+-------------------------------+--------+--------------------------+
2009-12-22 20:18:27 -08:00