Commit Graph

759 Commits

Author SHA1 Message Date
Evan Prodromou
1ba8045a9b set session cookie correctly 2010-01-28 01:24:00 -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
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
464ce741a4 remove session info in syslog 2010-01-13 16:19:20 -08:00
Evan Prodromou
155e4ef4f3 remove some debugging statements from util.php 2010-01-12 23:58:25 -08:00
Evan Prodromou
e34ece8b06 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-12 23:25:25 -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
Evan Prodromou
5d676352c3 strip out session ID from root URL 2010-01-11 15:09:46 -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
ae7469a127 accept session from 2010-01-11 08:39:02 +00:00
Evan Prodromou
e0eb51e4bb add session ID to local URL when server parts differ 2010-01-10 23:51:57 -08:00
Evan Prodromou
dd7195346c Sever -> server in error message 2010-01-10 22:59:50 -08:00
Evan Prodromou
ad63a9518c Sever -> server in error message 2010-01-10 22:59:32 -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
30409f7bad debugging code to find passed-in objects in munge_password 2010-01-10 12:07:49 -08:00
Brion Vibber
af95005bc4 Ticket 2141: bugs with weighted popularity lists across year boundary.
Consolidated several separate implementations of the same weighting algorithm into common_sql_weight() and fixed some bugs...
For MySQL, now using timestampdiff() instead of subtraction for the comparison, so we get sane results when the year doesn't match, and utc_timestamp() rather than now() so we don't get negative ages for recent items with local server timezone.
Unknown whether the same problems affect PostgreSQL, but note that it lacks the timestampdiff() SQL function.
2010-01-04 13:01:17 -08:00
Brion Vibber
6911e1c797 Ticket 2141: bugs with weighted popularity lists across year boundary.
Consolidated several separate implementations of the same weighting algorithm into common_sql_weight() and fixed some bugs...
For MySQL, now using timestampdiff() instead of subtraction for the comparison, so we get sane results when the year doesn't match, and utc_timestamp() rather than now() so we don't get negative ages for recent items with local server timezone.
Unknown whether the same problems affect PostgreSQL, but note that it lacks the timestampdiff() SQL function.
2010-01-04 11:55:27 -08:00
Evan Prodromou
c5d23e27a6 Make caching a plugin system 2010-01-02 20:26:33 -10:00
Evan Prodromou
3b912ac97e fixup memcache functions 2010-01-02 16:27:04 -10:00
Craig Andrews
1e9c03e199 Enable memcache automatic compression, starting at 20k and only if compression gain is greater than 20%.
Allows storage of larger objects (over 1mb in size uncompressed), such as huge LDAP schemas.
Should also improve cache efficiency (allows more stuff to be stored in same memory) and reduce network latency (less data transfer)
2009-12-30 19:29:38 -05:00
Evan Prodromou
f6bf952980 Merge branch 'testing' 2009-12-22 16:44:19 -08:00
Brion Vibber
f987273f11 Ignore user language settings that aren't listed in language config; we'll then fall back to current autodetection. This prevents the surprises where your profile suddenly switches to Arabic because it was selected by default due to lack of a match in the drop-down box. 2009-12-21 06:57:10 -08:00
Brion Vibber
b244ac6462 Ignore user language settings that aren't listed in language config; we'll then fall back to current autodetection. This prevents the surprises where your profile suddenly switches to Arabic because it was selected by default due to lack of a match in the drop-down box. 2009-12-19 15:29:53 -05:00
Brion Vibber
dc4bedd25a Add some doc comments and fixmes in util.php 2009-12-16 09:27:48 -05:00
Brion Vibber
0158f4f73d PHP 5.3 closure-based implementation of curry(); old implementation used as fallback for older PHP versions. Added unit tests to confirm they both work! 2009-12-16 09:27:48 -05:00
Craig Andrews
2ab01e040e Add 2 new events to enable logger pluginization: StartLog and EndLog 2009-12-05 02:11:27 -05:00
Brion Vibber
c89b10ffe4 Code style cleanup: dropped some unnecessary =& reference assignments where they're used only out of habit for PHP 4-style object semantics 2009-12-03 12:58:48 -08:00
Brion Vibber
914242e224 Drop the username from the log id for now; seems to trigger an error loop in some circumstances 2009-11-27 13:30:21 -08:00
Brion Vibber
9f075a6898 Drop the username from the log id for now; seems to trigger an error loop in some circumstances 2009-11-27 13:29:33 -08:00
Brion Vibber
b933f5bb15 request id on logs... pid + random id per web request + username + method + url 2009-11-27 12:32:55 -08:00
Brion Vibber
5bacd98905 request id on logs... pid + random id per web request + username + method + url 2009-11-27 12:28:15 -08:00
Brion Vibber
6d5d63636a Drop error message on setlocale() failure; this is harmless, since we actually have a working locale set up. 2009-11-25 11:23:11 -08:00
Brion Vibber
4ef515973a Drop error message on setlocale() failure; this is harmless, since we actually have a working locale set up. 2009-11-25 11:20:41 -08:00
Craig Andrews
d07df8a796 Added Authorization plugin
Added LDAPAuthorization plugin
2009-11-18 14:19:43 -05:00
Craig Andrews
f60a55d9ec blasted, that should not be there 2009-11-12 20:15:10 -05:00
Craig Andrews
ed690615de Added a User_username table that links the external username with a StatusNet user_id
Added EmailAuthenticationPlugin
Added ReverseUsernameAuthenticationPlugin
Changed the StartChangePassword and EndChangePassword events to take a user, instead of a nickname
User::allowed_nickname was declared non-static, but used as if it was static, so I made the declaration static
2009-11-12 20:12:36 -05:00
Craig Andrews
014d6b1d19 Redid how URL shorteners work. This way is much more like how Evan wants events to work (and more like how the rest of SN works). 2009-11-11 14:04:44 -05:00
Brion Vibber
7f8dbb8e45 Fix bug 1963: Web UI throws warnings during previously open login session after user account is deleted
common_logged_in() returned bogus results because it checks against null specifically, but common_current_user() was sticking 'false' into $_cur because that's what User::staticGet() returned from a failed lookup. Now we skip over a failed lookup here, so we keep null and all is well.
2009-11-11 10:38:11 -08:00
Evan Prodromou
923fa068a6 change credential check to work more like other events 2009-11-10 14:45:19 -05:00
Evan Prodromou
7ae10c27b0 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Conflicts:
	lib/util.php
2009-11-10 14:26:49 -05:00
Evan Prodromou
8d5c2b3129 fixup output of object attributes in db error code 2009-11-10 14:06:30 -05:00
Brion Vibber
088081675f Revert "Remove more contractions"
This reverts commit 5ab709b739.

Missed this one yesterday...
2009-11-09 20:01:46 +01:00
Siebrand Mazeland
b10f362ede Merge branch '0.9.x' of git://gitorious.org/statusnet/mainline into 0.9.x 2009-11-08 23:33:58 +01:00
Siebrand Mazeland
5ab709b739 Remove more contractions
* doesn't
* won't
* isn't
* don't
2009-11-08 23:32:15 +01:00
Brion Vibber
fc5002015b Revert "* [Cc]an't -> [Cc]annot"
This reverts commit 0ab17f382b.
2009-11-08 23:28:51 +01:00
Siebrand Mazeland
0ab17f382b * [Cc]an't -> [Cc]annot
* [Cc]ould't -> [Cc]ould not
2009-11-08 23:22:38 +01:00
Craig Andrews
1845c8c773 Added an AutoRegister event
LDAP plugin can do autoregistration
2009-11-05 16:40:41 -05:00
Craig Andrews
a82df5fae8 Added a CheckPassword event 2009-11-04 13:06:55 -05:00
Brion Vibber
86560eeb3d Merge commit 'refs/merge-requests/1900' of git://gitorious.org/statusnet/mainline into integration 2009-11-02 10:16:06 -08:00
Craig Andrews
1cf67f4f71 allow <> to surround the url (like () or []) 2009-11-02 12:59:11 -05:00
Craig Andrews
8782f5fedf do not allow " in URLs - they are not legal URL characters 2009-11-02 12:53:02 -05:00
Craig Andrews
b179ab650a do not allow [ and ] - they are not legal URL characters 2009-11-02 12:53:02 -05:00
Evan Prodromou
4e9ec0d0e1 merge from testing 2009-10-31 14:36:04 -04:00
Stephen Paul Weber
58b9ce5946 Better license check.
Tokenise CC license parts and check for compatability.
Fallback is old directly-equal test.
2009-10-23 21:22:26 -04:00
Zach Copley
2544310e73 Remove automatic enqueuing for Facebook 2009-10-23 23:34:48 +00:00
Brion Vibber
b89878511f Fix three fatal errors when posting from 0.9.x:
* OMB remote updates were trying to load nonexistent Laconica_OMB_Service_Consumer class -- fixed to StatusNet_OMB_Service_Consumer. Regression caused during libomb merge.
* Twitter processing was still being queued from core when no twitter plugin was present, which triggered an exception from UnqueueHandler; leftover code from before the plugin extraction.
* UnqueueHandler's exception caused a fatal error instead because it was missing the "new" keyword. Wouldn't have been seen when testing with the plugin enabled.
2009-10-23 20:31:53 +00:00
Eric Helgeson
490dfc6f5a Better check if site,server is configured. 2009-10-19 20:08:20 -04:00
Evan Prodromou
fc61b71625 merge from testing 2009-10-19 18:12:00 -04:00
Eric Helgeson
9d0e37c4e8 Utilize NICKNAME_FMT constant when creating at replies 2009-10-19 13:11:55 -04:00
Brion Vibber
39598582d9 Merge branch 'i18n-work' into i18n-0.9.x 2009-10-19 09:25:05 -07:00
Brion Vibber
b3c29800fb Drop a debug info line that isn't really needed 2009-10-16 11:49:27 -07:00
Brion Vibber
531c0738da Workaround for not fully natively set up locales with native gettext...
Set "en_US" locale first, then the locale we want for our user.
This seems to initialize gettext properly somehow, which I could see when the languages would come up briefly on settings save when changing from a supported language.
Definitely works for ga_ES on my Ubuntu system (8.10 intrepid), hopefully reasonably consistent.
2009-10-16 17:42:27 +00:00
Craig Andrews
f719720e8a Merge remote branch 'statusnet/0.8.x' into 0.9.x
Conflicts:
	lib/common.php
2009-10-11 13:39:10 -04:00
Jeffery To
838c13063a Fixed E_NOTICE when returnto isn't set 2009-10-07 17:28:30 +08:00
Sarven Capadisli
cc776478e2 Revert "Outputting UTF-8 charset in document header irrespective of mimetype."
This reverts commit 353f58c231.

Even though outputting UTF-8 by default at all times is a good thing,
it shouldn't be forced in startHTML().
2009-10-01 10:07:09 +00:00
Sarven Capadisli
7bd65a7b86 Merge branch '0.8.x' into 0.9.x 2009-09-30 10:54:17 +00:00
Sarven Capadisli
353f58c231 Outputting UTF-8 charset in document header irrespective of mimetype. 2009-09-30 10:51:59 +00:00
Craig Andrews
fc2426d7ce Fix some bugs in the URL linkification, and fixed the unit test. 2009-09-27 16:52:15 -04:00
Evan Prodromou
8284b3cb82 Merge branch '0.8.x' into 0.9.x
Conflicts:
	actions/requesttoken.php
	classes/File.php
	install.php
	lib/noticeform.php
2009-09-23 09:45:22 -04:00
Evan Prodromou
bef4a8b6ba Revert "When viewing a page in https, all links to non-actions (links to CSS, JS, etc) should be https. Fixes the mixed content warnings that browsers display."
This reverts commit 20997619b3.

The commit doesn't take into account having different servers (theme
server, avatar server) and being able to set HTTPS for some but not all.
2009-09-23 09:34:55 -04:00
Craig Andrews
2cabfba767 Allow some punctuation instead of just spaces before @user, !group, and #tag 2009-09-22 19:34:10 -04:00
Craig Andrews
f3c8fcccc1 Link hrefs are the short url, and title is the long url 2009-09-22 11:12:55 -04:00
Craig Andrews
ebb52efeb4 Make link href the long url so users can tell where links are going 2009-09-21 22:48:19 -04:00
Evan Prodromou
98924a80d7 'easy' way to handle notices at queue time 2009-09-21 14:39:22 -04:00
Evan Prodromou
5b91223ce4 add a hook at point of enqueuing notices 2009-09-21 14:14:55 -04:00
Brion Vibber
3c89d31b18 Fixes for posting shortened URLs or uploads
* If no shortener plugin is enabled, fall back to using the long URL instead of trying to load nonexistent ur1.ca plugin and throwing 'Class  does not exist'
* Fix bad call to call_user_func_array() in callback_helper() which broke all shortening
2009-09-21 21:34:59 +12:00
Craig Andrews
20997619b3 When viewing a page in https, all links to non-actions (links to CSS, JS, etc) should be https. Fixes the mixed content warnings that browsers display.
Fixes http://status.net/trac/ticket/1552
2009-09-13 01:24:57 -04:00
Craig Andrews
292bb7c4d8 Allow @ signs in the path, querystring, and fragment parts of URLs 2009-09-10 21:19:38 -04:00
Craig Andrews
2a56245614 Re-use enclosure decision logic to decide if a link gets a paperclip/lightbox popup. 2009-09-10 21:13:30 -04:00
Craig Andrews
584ea1b23c Revert "If a shortened URL begins with http://, don't include it in the shortened url. Saves 7 characters, which is pretty awesome for 140 character max length notices."
This reverts commit e2848eb862.

Downstream consumers of our notices (such as Friendfeed, Facebook, etc) don't have sophisticated URL detection, so a notice that reads: "check out ur1.ca/1" won't be linked. So the http:// prefix is
mandatory.
2009-09-10 12:13:43 -04:00
Craig Andrews
cd650b090a Merge remote branch 'laconica/0.8.x' into 0.9.x 2009-09-09 22:58:19 -04:00
Craig Andrews
e2848eb862 If a shortened URL begins with http://, don't include it in the shortened url. Saves 7 characters, which is pretty awesome for 140 character max length notices. 2009-09-09 22:57:15 -04:00
Craig Andrews
d7ae0ed4fd Merge remote branch 'laconica/0.8.x' into 0.9.x
Conflicts:
	lib/omb.php
2009-09-09 22:52:38 -04:00
Craig Andrews
aecdba1ded :: isn't a valid IPv6 address for our purposes 2009-09-09 16:57:11 -04:00
brenda
f218d7fd58 more info in error message, to help next person who has to debug locales 2009-09-05 16:12:50 +12:00
Craig Andrews
80b7e54ca2 Added additional characters as allowed in URLs. 2009-09-04 11:30:29 -04:00
Craig Andrews
beae3db413 Pluginize the URL shorteners 2009-09-03 14:58:50 -04:00
Craig Andrews
a535ccdc4e Merge remote branch 'laconica/0.8.x' into 0.9.x
Conflicts:
	lib/common.php
	lib/twitter.php
2009-09-02 16:42:15 -04:00
Craig Andrews
951a787877 Fix attachment saving 2009-08-31 15:36:03 -04:00
Craig Andrews
20423af689 Allow :'s in the path, query string, and fragment parts of the url (Mediawiki URLs often do this) 2009-08-31 10:33:37 -04:00
Evan Prodromou
a44c064397 Merge branch '0.8.x' of git@gitorious.org:laconica/mainline into 0.8.x 2009-08-28 13:35:48 -07:00
Craig Andrews
3368452ebf Add % and ~ as valid characters in the path, querystring, and fragment parts of URLs 2009-08-28 16:18:45 -04:00
Evan Prodromou
b4ca06edb2 fix 'callback_helper' 2009-08-28 08:43:28 -07:00
Evan Prodromou
c0d03fc279 make URL analyzer save new info on URLs 2009-08-27 20:23:31 -07:00
Evan Prodromou
34ce75c71d remove duplicate save of Notice and streamline attachment detection 2009-08-27 20:09:07 -07:00
Evan Prodromou
0056b635c6 reformat curry() to make my editor happy 2009-08-27 20:06:03 -07:00
Evan Prodromou
bbb830e14c Merge branch '0.8.x' of git@gitorious.org:laconica/mainline into 0.8.x 2009-08-27 14:18:51 -07:00
Evan Prodromou
5d09b6b3f0 Merge branch '0.8.x' into 0.9.x
Conflicts:
	EVENTS.txt
	actions/finishremotesubscribe.php
	actions/postnotice.php
	actions/public.php
	actions/remotesubscribe.php
	actions/showstream.php
	actions/updateprofile.php
	actions/userauthorization.php
	classes/laconica.ini
	lib/common.php
	lib/oauthstore.php
	lib/omb.php
2009-08-27 11:16:45 -07:00
Craig Andrews
2dd5a5f86d Do not used named capturing groups
I'm not sure all php 5.2's are compiled with a PCRE library that supported named captures.
2009-08-27 12:06:45 -04:00
Evan Prodromou
f1fda6c050 Merge branch '0.8.x' into 0.9.x 2009-08-27 07:56:19 -07:00