From 727357695e2faef8a30602808cd6a11f9047fdd3 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 11 Dec 2009 14:19:18 -0800 Subject: [PATCH 1/9] Debug check to track down live error -- wrong data type sometimes being sent down to Memcached_DataObject::cacheKey() via various fetch functions, need a backtrace to track it down. --- classes/Memcached_DataObject.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 753fe954e0..644b84d5cf 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -93,6 +93,11 @@ class Memcached_DataObject extends DB_DataObject } static function cacheKey($cls, $k, $v) { + if (is_object($cls) || is_object($j) || is_object($v)) { + $e = new Exception(); + common_log(LOG_ERR, __METHOD__ . ' object in param: ' . + str_replace("\n", " ", $e->getTraceAsString())); + } return common_cache_key(strtolower($cls).':'.$k.':'.$v); } From cc2b2a82da65b262dcbb3e0f595f0a0b846e71d5 Mon Sep 17 00:00:00 2001 From: Christopher Vollick Date: Fri, 11 Dec 2009 10:34:57 -0500 Subject: [PATCH 2/9] Added UserEmail script. Used to query user's emails. Mostly used for administration, to see if a user requesting something is who they say. Also, some people assume that the admin knows this data, and says things like: "If you could do _____ with the account connected to this email". It'd be nice if we could do that without raw SQL. --- scripts/useremail.php | 77 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 scripts/useremail.php diff --git a/scripts/useremail.php b/scripts/useremail.php new file mode 100644 index 0000000000..6676a87c80 --- /dev/null +++ b/scripts/useremail.php @@ -0,0 +1,77 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'i:n:e:'; +$longoptions = array('id=', 'nickname=', 'email='); + +$helptext = <<email)) { + print "No email registered for user '$user->nickname'\n"; + } else { + print "$user->email\n"; + } + exit(0); +} + +if (have_option('e', 'email')) { + $user = new User(); + $user->email = get_option_value('e', 'email'); + $user->find(false); + if (!$user->fetch()) { + print "No users with email $user->email\n"; + exit(0); + } + do { + print "$user->id $user->nickname\n"; + } while ($user->fetch()); +} else { + print "You must provide either an ID, email, or a nickname.\n"; + exit(1); +} From dd96558b6660c2c8cd41ff0dd3e13c6baa6e2e8a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 11 Dec 2009 13:14:40 -0800 Subject: [PATCH 3/9] Make useremail.php executable --- scripts/useremail.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/useremail.php diff --git a/scripts/useremail.php b/scripts/useremail.php old mode 100644 new mode 100755 From 2fb76eec62fee8cabda69bb3df2b5a6c988f9e8a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 18 Dec 2009 09:36:30 -0500 Subject: [PATCH 4/9] Followup fix for ticket 1672: Twitter bridge !group->#hash conversion will now happen regardless of whether account was configured with oauth or basic auth (previously applied only on the oauth path) --- plugins/TwitterBridge/twitter.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index fd51506388..2b9cde1aa8 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -170,8 +170,6 @@ function broadcast_twitter($notice) function broadcast_oauth($notice, $flink) { $user = $flink->getUser(); $statustxt = format_status($notice); - // Convert !groups to #hashes - $statustxt = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/', "\\1#\\2", $statustxt); $token = TwitterOAuthClient::unpackToken($flink->credentials); $client = new TwitterOAuthClient($token->key, $token->secret); $status = null; @@ -276,7 +274,12 @@ function process_error($e, $flink) function format_status($notice) { // XXX: Hack to get around PHP cURL's use of @ being a a meta character - return preg_replace('/^@/', ' @', $notice->content); + $statustxt = preg_replace('/^@/', ' @', $notice->content); + + // Convert !groups to #hashes + $statustxt = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/', "\\1#\\2", $statustxt); + + return $statustxt; } function remove_twitter_link($flink) From f987273f118a12d443b6789c2ab59d7a4b01f678 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 19 Dec 2009 14:03:31 -0500 Subject: [PATCH 5/9] 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. --- lib/util.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/util.php b/lib/util.php index 99a0a1db30..5d20ed82df 100644 --- a/lib/util.php +++ b/lib/util.php @@ -91,8 +91,16 @@ function common_language() if (_have_config() && common_logged_in()) { $user = common_current_user(); $user_language = $user->language; - if ($user_language) - return $user_language; + + if ($user->language) { + // Validate -- we don't want to end up with a bogus code + // left over from some old junk. + foreach (common_config('site', 'languages') as $code => $info) { + if ($info['lang'] == $user_language) { + return $user_language; + } + } + } } // Otherwise, find the best match for the languages requested by the From d708e40be222b27ad009f3eeec7c951152742ff0 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 22 Dec 2009 16:41:07 -0800 Subject: [PATCH 6/9] update README for 0.9.0rc2 --- README | 176 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 96 insertions(+), 80 deletions(-) diff --git a/README b/README index dc2e2b4ba4..9e91ad674d 100644 --- a/README +++ b/README @@ -2,8 +2,8 @@ README ------ -StatusNet 0.8.2 ("Life and How to Live It") -1 Nov 2009 +StatusNet 0.9.0 ("Stand") Release Candidate 2 +22 Dec 2009 This is the README file for StatusNet (formerly Laconica), the Open Source microblogging platform. It includes installation instructions, @@ -16,10 +16,10 @@ About StatusNet (formerly Laconica) is a Free and Open Source microblogging platform. It helps people in a community, company or group to exchange -short (140 character) messages over the Web. Users can choose which -people to "follow" and receive only their friends' or colleagues' -status messages. It provides a similar service to sites like Twitter, -Jaiku, Yammer, and Plurk. +short (140 characters, by default) messages over the Web. Users can +choose which people to "follow" and receive only their friends' or +colleagues' status messages. It provides a similar service to sites +like Twitter, Jaiku, Yammer, and Plurk. With a little work, status messages can be sent to mobile phones, instant messenger programs (GTalk/Jabber), and specially-designed @@ -77,81 +77,96 @@ for additional terms. New this version ================ -This is a minor feature and bugfix release since version 0.8.1, -released Aug 26 2009. Notable changes this version: +This is a major feature release since version 0.8.2, released Nov 1 2009. +Notable changes this version: -- New script for deleting user accounts. Not particularly safe or - community-friendly. Better for deleting abusive accounts than for - users who are 'retiring'. -- Improved detection of URLs in notices, specifically for punctuation - chars like ~, :, $, _, -, +, !, @, and %. -- Removed some extra
semantic HTML code. -- Correct error in status-network database ini file (having multiple - statusnet sites with a single codebase) -- Fixed error output for Twitter posting failures. -- Fixed bug in Twitter queue handler that requeued inapplicable - notices ad infinitum. -- Improve FOAF output for remote users. -- new commands to join and leave groups. -- Fixed bug in which you cannot turn off importing friends timelines - flag. -- Better error handling in Twitter posting. -- Show oEmbed data for XHTML files as well as plain HTML. -- Updated bug database link in README. -- add support for HTTP Basic Auth in PHP CGI or FastCGI (e.g. GoDaddy). -- autofocus input to selected entry elements depending on page. -- updated layout for filter-by-tag form. -- better layout for inbox and outbox pages. -- fix highlighting search terms in attributes of notice list elements. -- Correctly handle errors in linkback plugin. -- Updated biz theme. -- Updated cloudy theme. -- Don't match '::' as an IPv6 address. -- Use the same decision logic for deciding whether to mark an - attachment as an enclosure in RSS or as a paperclip item in Web - output. -- Fixed a bug in the Piwik plugin that hard-coded the site ID. -- Add a param, inreplyto, to notice/new to allow an explicit response - to another notice. -- Show username in subject of emails. -- Check if avatar exists before trying to delete it. -- Correctly add omb_version to response for request token in OMB. -- Add a few more SMS carriers. -- Add a few more notice sources. -- Vary: header. -- Improvements to the AutoCompletePlugin. -- Check for 'dl' before using it. -- Make it impossible to delete self-subscriptions via the API. -- Fix pagination of tagged user pages. -- Make PiwikAnalyticsPlugin work with addPlugin(). -- Removed trailing single space in user nicknames in notice lists. -- Show context link if a notice starts a conversation. -- blacklist all files and directories in install dir. -- handle GoDaddy-style PATH_INFO, including script name. -- add home_timeline synonym for friends_timeline. -- Add a popup window for the realtime plugin. -- Add some more streams for the realtime plugin. -- Fix a bug that overwrote group creation timestamp on every edit. -- Moved HTTP error code strings to a class variable. -- The Twitter API now returns server errors in the correct format. -- Reset the doctype for HTML output. -- Fixed a number of notices. -- Don't show search suggestions for private sites. -- Some corrections to FBConnect nav overrides. -- Slightly less database-intensive session management. -- Updated name of software in installer script. -- Include long-form attachment URLs if url-shortener is disabled. -- Include updated localisations for Polish, Greek, Hebrew, Icelandic, - Norwegian, and Chinese. -- Include upstream fixes to gettext.php. -- Correct for regression in Facebook API for updates. -- Ignore "Sent from my iPhone" (and similar) in mail updates. -- Use the NICKNAME_FMT constant for detecting nicknames. -- Check for site servername config'd. -- Compatibility fix for empty status updates with Twitter API. -- Option to show files privately (EXPERIMENTAL! Use with caution.) -- a script to register a new user. -- a script to make a user admin of a group. +- Records of deleted notices are stored without the notice content. +- Much of the optional core featureset has been moved to plugins. +- OpenID support moved from core to a plugin. Helps test the strength of + our plugin architecture and makes it easy to disable this + functionality for e.g. intranet sites. +- Many additional hook events (see EVENTS.txt for details). +- OMB 0.1 support re-implemented using libomb. +- Re-structure database so notices, messages, bios and group + descriptions can be over 140 characters. Limit defined by + site administrator as configuration option; can be unlimited. +- Configuration data now optionally stored in the database, which + overrides any settings in config files. +- Twitter integration re-implemented as a plugin. +- Facebook integration re-implemented as a plugin. +- Role-based authorization framework. Users can have named roles, and + roles can have rights (e.g., to delete notices, change configuration + data, or ban uncooperative users). Default roles 'admin' (for + configuration) and 'moderator' (for community management) added. +- Plugin for PubSubHubBub (PuSH) support. +- Considerable code style cleanup to meet PEAR code standards. +- Made a common library for HTTP-client access which uses available + HTTP libraries where possible. +- Added statuses/home_timeline method to API. +- Hooks for plugins to handle notices offline, either by defining + their own queue handler scripts or to use a default plugin queue + handler script. +- Plugins can now modify the database schema, adding their own tables + or modifying existing ones. +- Groups API. +- Twitter API supports Web caching for some methods. +- Twitter API refactored into one-action-per-method. +- Realtime plugin supports a tear-off window. +- FOAF for groups. +- Moved all JavaScript tags to just before by default, + significantly speeding up apparent page load time. +- Added a Realtime plugin for Orbited server. +- Added a mobile plugin to give a more mobile-phone-friendly layout + when a mobile browser is detected. +- Use CSS sprites for most common icons. +- Fixes for images and buttons on Web output. +- New plugin requires that users validate their email before posting. +- New plugin UserFlag lets users flag other profiles for review. +- Considerably better i18n support. Use TranslateWiki to update + translations. +- Notices and profiles now store location information. +- New plugin, Geonames, for turning location names and lat/long pairs + into structured IDs and vice versa. Architecture reusable for other + systems. +- Better check of license compatibility between site licenses. +- Some improvements in XMPP output. +- Media upload in the API. +- Replies appear in the user's inbox. +- Improved the UI on the bookmarklet. +- StatusNet identities can be used as OpenID identities. +- Script to register a user. +- Script to make someone a group admin. +- Script to make someone a site admin or moderator. +- 'login' command. +- Pluggable authentication. +- LDAP authentication plugin. +- Script for console interaction with the site (!). +- Users don't see group posts from people they've blocked. +- Admin panel interface for changing site configuration. +- Users can be sandboxed (limited contributions) or silenced + (no contributions) by moderators. +- Many changes to make language usage more consistent. +- Sphinx search moved to a plugin. +- GeoURL plugin. +- Profile and group lists support hAtom. +- Massive refactoring of util.js. +- Mapstraction plugin to show maps on inbox and profile pages. +- Play/pause buttons for realtime notices. +- Support for geo microformat. +- Partial support for feed subscriptions, RSSCloud, PubSubHubBub. +- Support for geolocation in browser (Chrome, Firefox). +- Quit trying to negotiate HTML format. Always use text/html. + We lose, and so do Web standards. Boo. +- Better logging of request info. +- Better output for errors in Web interface. +- No longer store .mo files; these need to be generated. +- Minify plugin. +- Events to allow pluginizing logger. +- New framework for plugin localization. +- Gravatar plugin. +- Add support for "repeats" (similar to Twitter's "retweets"). +- Support for repeats in Twitter API. +- Better notification of direct messages. Prerequisites ============= @@ -1600,6 +1615,7 @@ if anyone's been overlooked in error. * Federico Marani * Craig Andrews * mEDI +* Brett Taylor Thanks also to the developers of our upstream library code and to the thousands of people who have tried out Identi.ca, installed StatusNet, From 30c2e2ce83282f0bc268153d7ec465fbb5cf00ca Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 22 Dec 2009 16:41:39 -0800 Subject: [PATCH 7/9] update to rc2 --- lib/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/common.php b/lib/common.php index 9b3ded037b..7fa1910af8 100644 --- a/lib/common.php +++ b/lib/common.php @@ -20,9 +20,9 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } //exit with 200 response, if this is checking fancy from the installer -if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') { exit; } +if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') { exit; } -define('STATUSNET_VERSION', '0.9.0rc1'); +define('STATUSNET_VERSION', '0.9.0rc2'); define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility define('STATUSNET_CODENAME', 'Stand'); From fa0fbd011812e9df52c9e5684d4cf953c6f75d8e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 22 Dec 2009 20:18:27 -0800 Subject: [PATCH 8/9] 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 | +----+-------------+--------------+--------+------------------------------------+---------+---------+-------------------------------+--------+--------------------------+ --- classes/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/User.php b/classes/User.php index ae709b46b6..484dc8c82b 100644 --- a/classes/User.php +++ b/classes/User.php @@ -543,7 +543,7 @@ class User extends Memcached_DataObject // NOTE: we sort by fave time, not by notice time! - $qry .= 'ORDER BY notice.id DESC '; + $qry .= 'ORDER BY notice_id DESC '; if (!is_null($offset)) { $qry .= "LIMIT $limit OFFSET $offset"; From 725b2d0475ba3d0dcfafd48a191b4ddee09cae68 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 22 Dec 2009 21:58:23 -0800 Subject: [PATCH 9/9] save location at notice post time --- actions/newnotice.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/actions/newnotice.php b/actions/newnotice.php index c6c70e3260..c014f1781c 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -169,6 +169,14 @@ class NewnoticeAction extends Action $location_id = $this->trimmed('location_id'); $location_ns = $this->trimmed('location_ns'); + if (!empty($lat) && !empty($lon) && empty($location_id)) { + $location = Location::fromLatLon($lat, $lon); + if (!empty($location)) { + $location_id = $location->location_id; + $location_ns = $location->location_ns; + } + } + $upload = null; $upload = MediaFile::fromUpload('attach');