From b93244395f2c5643ae5e1be1e4e1d652c6d654c1 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 6 Jan 2010 11:10:33 -0800 Subject: [PATCH 01/13] 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; --- classes/Profile.php | 1 + plugins/UserFlag/UserFlagPlugin.php | 51 ++++++++++++++++++++++++----- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/classes/Profile.php b/classes/Profile.php index 03196447b8..25d908dbf9 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -504,6 +504,7 @@ class Profile extends Memcached_DataObject 'Reply', 'Group_member', ); + Event::handle('ProfileDeleteRelated', array($this, &$related)); foreach ($related as $cls) { $inst = new $cls(); diff --git a/plugins/UserFlag/UserFlagPlugin.php b/plugins/UserFlag/UserFlagPlugin.php index 602a5bfa88..a33869c19e 100644 --- a/plugins/UserFlag/UserFlagPlugin.php +++ b/plugins/UserFlag/UserFlagPlugin.php @@ -102,20 +102,20 @@ class UserFlagPlugin extends Plugin function onAutoload($cls) { - switch ($cls) + switch (strtolower($cls)) { - case 'FlagprofileAction': - case 'AdminprofileflagAction': - case 'ClearflagAction': + case 'flagprofileaction': + case 'adminprofileflagaction': + case 'clearflagaction': include_once INSTALLDIR.'/plugins/UserFlag/' . strtolower(mb_substr($cls, 0, -6)) . '.php'; return false; - case 'FlagProfileForm': - case 'ClearFlagForm': + case 'flagprofileform': + case 'clearflagform': include_once INSTALLDIR.'/plugins/UserFlag/' . strtolower($cls . '.php'); return false; - case 'User_flag_profile': - include_once INSTALLDIR.'/plugins/UserFlag/'.$cls.'.php'; + case 'user_flag_profile': + include_once INSTALLDIR.'/plugins/UserFlag/'.ucfirst(strtolower($cls)).'.php'; return false; default: return true; @@ -258,4 +258,39 @@ class UserFlagPlugin extends Plugin } return true; } + + /** + * Ensure that flag entries for a profile are deleted + * along with the profile when deleting users. + * This prevents breakage of the admin profile flag UI. + * + * @param Profile $profile + * @param array &$related list of related tables; entries + * with matching profile_id will be deleted. + * + * @return boolean hook result + */ + + function onProfileDeleteRelated($profile, &$related) + { + $related[] = 'user_flag_profile'; + return true; + } + + /** + * Ensure that flag entries created by a user are deleted + * when that user gets deleted. + * + * @param User $user + * @param array &$related list of related tables; entries + * with matching user_id will be deleted. + * + * @return boolean hook result + */ + + function onUserDeleteRelated($user, &$related) + { + $related[] = 'user_flag_profile'; + return true; + } } From 6f5b765c97c8616e4a79719bfe835cb03dc0a236 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 6 Jan 2010 13:08:56 -0800 Subject: [PATCH 02/13] suppress notice for undefined prompt variable when console.php is used from non-interactive terminal --- scripts/console.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/console.php b/scripts/console.php index 329caf4724..8b62a3a967 100755 --- a/scripts/console.php +++ b/scripts/console.php @@ -128,6 +128,8 @@ function console_help() if (CONSOLE_INTERACTIVE) { print "StatusNet interactive PHP console... type ctrl+D or enter 'exit' to exit.\n"; $prompt = common_config('site', 'name') . '> '; +} else { + $prompt = ''; } while (!feof(STDIN)) { $line = read_input_line($prompt); From 85554d0840642f4c1b47b50202dd648db565781c Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 6 Jan 2010 13:23:39 -0800 Subject: [PATCH 03/13] 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. --- classes/Memcached_DataObject.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index d11bd63682..04f75b775c 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -90,17 +90,16 @@ class Memcached_DataObject extends DB_DataObject unset($i); } $i = Memcached_DataObject::getcached($cls, $k, $v); - if ($i !== false) { // false == cache miss - return $i; - } else { + if ($i === false) { // false == cache miss $i = DB_DataObject::factory($cls); if (empty($i)) { - return false; + $i = false; + return $i; } $result = $i->get($k, $v); if ($result) { + // Hit! $i->encache(); - return $i; } else { // save the fact that no such row exists $c = self::memcache(); @@ -108,12 +107,16 @@ class Memcached_DataObject extends DB_DataObject $ck = self::cachekey($cls, $k, $v); $c->set($ck, null); } - return false; + $i = false; } } + return $i; } - function &pkeyGet($cls, $kv) + /** + * @fixme Should this return false on lookup fail to match staticGet? + */ + function pkeyGet($cls, $kv) { $i = Memcached_DataObject::multicache($cls, $kv); if ($i !== false) { // false == cache miss From 013e6dfdd481470cc02994b6db58a387a95016ca Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 6 Jan 2010 13:40:28 -0800 Subject: [PATCH 04/13] Don't output notices from deleted users. --- actions/twitapisearchatom.php | 9 ++++++++- lib/jsonsearchresultslist.php | 10 ++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php index 1cb8d7efe6..baed2a0c7c 100644 --- a/actions/twitapisearchatom.php +++ b/actions/twitapisearchatom.php @@ -208,7 +208,14 @@ class TwitapisearchatomAction extends ApiAction $this->showFeed(); foreach ($notices as $n) { - $this->showEntry($n); + + $profile = $n->getProfile(); + + // Don't show notices from deleted users + + if (!empty($profile)) { + $this->showEntry($n); + } } $this->endAtom(); diff --git a/lib/jsonsearchresultslist.php b/lib/jsonsearchresultslist.php index 569bfa8734..0d72ddf7ab 100644 --- a/lib/jsonsearchresultslist.php +++ b/lib/jsonsearchresultslist.php @@ -105,8 +105,14 @@ class JSONSearchResultsList break; } - $item = new ResultItem($this->notice); - array_push($this->results, $item); + $profile = $this->notice->getProfile(); + + // Don't show notices from deleted users + + if (!empty($profile)) { + $item = new ResultItem($this->notice); + array_push($this->results, $item); + } } $time_end = microtime(true); From 208bab32b7f9784701c538217d0c1c2779a22146 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 6 Jan 2010 16:48:24 -0500 Subject: [PATCH 05/13] Remove erroneous call to parent::onInitializePlugin() --- plugins/LdapAuthorization/LdapAuthorizationPlugin.php | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/LdapAuthorization/LdapAuthorizationPlugin.php b/plugins/LdapAuthorization/LdapAuthorizationPlugin.php index 7673e61efb..e5e22c0dde 100644 --- a/plugins/LdapAuthorization/LdapAuthorizationPlugin.php +++ b/plugins/LdapAuthorization/LdapAuthorizationPlugin.php @@ -52,7 +52,6 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin public $attributes = array(); function onInitializePlugin(){ - parent::onInitializePlugin(); if(!isset($this->host)){ throw new Exception("must specify a host"); } From 541053e84b2754e0d2c8b735c624383b6a126122 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 6 Jan 2010 17:08:01 -0500 Subject: [PATCH 06/13] The structure return by parse_url is an associative array, not an object. --- lib/htmloutputter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 2091c6e2ca..31660ce954 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -352,7 +352,7 @@ class HTMLOutputter extends XMLOutputter { if(Event::handle('StartScriptElement', array($this,&$src,&$type))) { $url = parse_url($src); - if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment)) + if( empty($url['scheme']) && empty($url['host']) && empty($url['query']) && empty($url['fragment'])) { $src = common_path($src) . '?version=' . STATUSNET_VERSION; } From 20144285ca610812abe09018ee208e12e38a966a Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 6 Jan 2010 17:13:09 -0500 Subject: [PATCH 07/13] The structure return by parse_url is an associative array, not an object. --- plugins/Minify/MinifyPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Minify/MinifyPlugin.php b/plugins/Minify/MinifyPlugin.php index 71fade19a5..718bfd1635 100644 --- a/plugins/Minify/MinifyPlugin.php +++ b/plugins/Minify/MinifyPlugin.php @@ -84,7 +84,7 @@ class MinifyPlugin extends Plugin function onStartScriptElement($action,&$src,&$type) { $url = parse_url($src); - if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment)) + if( empty($url['scheme']) && empty($url['host']) && empty($url['query']) && empty($url['fragment'])) { $src = $this->minifyUrl($src); } From 4e2acd153b4e3208e24464478098fac458a13590 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 6 Jan 2010 14:28:40 -0800 Subject: [PATCH 08/13] ...and drop the unnecessary &reference from child class pkeyGet() overrides. --- classes/Avatar.php | 2 +- classes/Config.php | 2 +- classes/Fave.php | 2 +- classes/File_to_post.php | 2 +- classes/Group_block.php | 2 +- classes/Group_inbox.php | 2 +- classes/Group_member.php | 2 +- classes/Notice_inbox.php | 2 +- classes/Notice_tag.php | 2 +- classes/Profile_role.php | 2 +- classes/Queue_item.php | 2 +- classes/Subscription.php | 2 +- plugins/OpenID/User_openid_trustroot.php | 2 +- plugins/UserFlag/User_flag_profile.php | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/classes/Avatar.php b/classes/Avatar.php index 8d6424e8b2..91bde0f040 100644 --- a/classes/Avatar.php +++ b/classes/Avatar.php @@ -37,7 +37,7 @@ class Avatar extends Memcached_DataObject } } - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Avatar', $kv); } diff --git a/classes/Config.php b/classes/Config.php index 6d914ca1f6..43b99587fa 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -120,7 +120,7 @@ class Config extends Memcached_DataObject return $result; } - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Config', $kv); } diff --git a/classes/Fave.php b/classes/Fave.php index 11e876ff19..8113c8e166 100644 --- a/classes/Fave.php +++ b/classes/Fave.php @@ -32,7 +32,7 @@ class Fave extends Memcached_DataObject return $fave; } - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Fave', $kv); } diff --git a/classes/File_to_post.php b/classes/File_to_post.php index e3db91b205..72a42b0880 100644 --- a/classes/File_to_post.php +++ b/classes/File_to_post.php @@ -62,7 +62,7 @@ class File_to_post extends Memcached_DataObject } } - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('File_to_post', $kv); } diff --git a/classes/Group_block.php b/classes/Group_block.php index de2cf5f6eb..9f4d592956 100644 --- a/classes/Group_block.php +++ b/classes/Group_block.php @@ -40,7 +40,7 @@ class Group_block extends Memcached_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Group_block', $kv); } diff --git a/classes/Group_inbox.php b/classes/Group_inbox.php index 1af7439f7f..2a0787e387 100644 --- a/classes/Group_inbox.php +++ b/classes/Group_inbox.php @@ -20,7 +20,7 @@ class Group_inbox extends Memcached_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Group_inbox', $kv); } diff --git a/classes/Group_member.php b/classes/Group_member.php index 3c23a991f0..069b2c7a1c 100644 --- a/classes/Group_member.php +++ b/classes/Group_member.php @@ -21,7 +21,7 @@ class Group_member extends Memcached_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Group_member', $kv); } diff --git a/classes/Notice_inbox.php b/classes/Notice_inbox.php index d3ddad656a..e350e6e2f8 100644 --- a/classes/Notice_inbox.php +++ b/classes/Notice_inbox.php @@ -101,7 +101,7 @@ class Notice_inbox extends Memcached_DataObject return $ids; } - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Notice_inbox', $kv); } diff --git a/classes/Notice_tag.php b/classes/Notice_tag.php index 02740280f5..79231f0b0c 100644 --- a/classes/Notice_tag.php +++ b/classes/Notice_tag.php @@ -96,7 +96,7 @@ class Notice_tag extends Memcached_DataObject } } - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Notice_tag', $kv); } diff --git a/classes/Profile_role.php b/classes/Profile_role.php index afa7fb74e4..74aca37305 100644 --- a/classes/Profile_role.php +++ b/classes/Profile_role.php @@ -43,7 +43,7 @@ class Profile_role extends Memcached_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Profile_role', $kv); } diff --git a/classes/Queue_item.php b/classes/Queue_item.php index 295c321b57..9c673540d7 100644 --- a/classes/Queue_item.php +++ b/classes/Queue_item.php @@ -55,7 +55,7 @@ class Queue_item extends Memcached_DataObject return null; } - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Queue_item', $kv); } diff --git a/classes/Subscription.php b/classes/Subscription.php index fedfd5f19e..faf1331cda 100644 --- a/classes/Subscription.php +++ b/classes/Subscription.php @@ -46,7 +46,7 @@ class Subscription extends Memcached_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('Subscription', $kv); } diff --git a/plugins/OpenID/User_openid_trustroot.php b/plugins/OpenID/User_openid_trustroot.php index 44288945be..0b411b8f7f 100644 --- a/plugins/OpenID/User_openid_trustroot.php +++ b/plugins/OpenID/User_openid_trustroot.php @@ -22,7 +22,7 @@ class User_openid_trustroot extends Memcached_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('User_openid_trustroot', $kv); } diff --git a/plugins/UserFlag/User_flag_profile.php b/plugins/UserFlag/User_flag_profile.php index 6582594524..063ed04eac 100644 --- a/plugins/UserFlag/User_flag_profile.php +++ b/plugins/UserFlag/User_flag_profile.php @@ -97,7 +97,7 @@ class User_flag_profile extends Memcached_DataObject * @return User_flag_profile found object or null */ - function &pkeyGet($kv) + function pkeyGet($kv) { return Memcached_DataObject::pkeyGet('User_flag_profile', $kv); } From 5d9a2eb17e3f6e3bc73b5aa80625a365761b6689 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 6 Jan 2010 14:42:46 -0800 Subject: [PATCH 09/13] Ticket 2107: remove "not implemented" items from sms/xmpp help; nobody likes being told what they can't do! Also broke up the localized help message into line-by-line pieces to ease translation maintenance. --- doc-src/sms | 11 +------- lib/command.php | 74 ++++++++++++++++++++++++------------------------- 2 files changed, 38 insertions(+), 47 deletions(-) diff --git a/doc-src/sms b/doc-src/sms index 1a3064318f..2c20921c35 100644 --- a/doc-src/sms +++ b/doc-src/sms @@ -56,13 +56,4 @@ You can use the following commands with %%site.name%%. * sub <nickname> - same as 'follow' * unsub <nickname> - same as 'leave' * last <nickname> - same as 'get' -* on <nickname> - not yet implemented. -* off <nickname> - not yet implemented. -* nudge <nickname> - not yet implemented. -* invite <phone number> - not yet implemented. -* track <word> - not yet implemented. -* untrack <word> - not yet implemented. -* track off - not yet implemented. -* untrack all - not yet implemented. -* tracks - not yet implemented. -* tracking - not yet implemented. +* nudge <nickname> - remind a user to update. diff --git a/lib/command.php b/lib/command.php index 67140c3485..ad2e0bb975 100644 --- a/lib/command.php +++ b/lib/command.php @@ -742,42 +742,42 @@ class HelpCommand extends Command function execute($channel) { $channel->output($this->user, - _("Commands:\n". - "on - turn on notifications\n". - "off - turn off notifications\n". - "help - show this help\n". - "follow - subscribe to user\n". - "groups - lists the groups you have joined\n". - "subscriptions - list the people you follow\n". - "subscribers - list the people that follow you\n". - "leave - unsubscribe from user\n". - "d - direct message to user\n". - "get - get last notice from user\n". - "whois - get profile info on user\n". - "fav - add user's last notice as a 'fave'\n". - "fav # - add notice with the given id as a 'fave'\n". - "repeat # - repeat a notice with a given id\n". - "repeat - repeat the last notice from user\n". - "reply # - reply to notice with a given id\n". - "reply - reply to the last notice from user\n". - "join - join group\n". - "login - Get a link to login to the web interface\n". - "drop - leave group\n". - "stats - get your stats\n". - "stop - same as 'off'\n". - "quit - same as 'off'\n". - "sub - same as 'follow'\n". - "unsub - same as 'leave'\n". - "last - same as 'get'\n". - "on - not yet implemented.\n". - "off - not yet implemented.\n". - "nudge - remind a user to update.\n". - "invite - not yet implemented.\n". - "track - not yet implemented.\n". - "untrack - not yet implemented.\n". - "track off - not yet implemented.\n". - "untrack all - not yet implemented.\n". - "tracks - not yet implemented.\n". - "tracking - not yet implemented.\n")); + _("Commands:")."\n". + _("on - turn on notifications")."\n". + _("off - turn off notifications")."\n". + _("help - show this help")."\n". + _("follow - subscribe to user")."\n". + _("groups - lists the groups you have joined")."\n". + _("subscriptions - list the people you follow")."\n". + _("subscribers - list the people that follow you")."\n". + _("leave - unsubscribe from user")."\n". + _("d - direct message to user")."\n". + _("get - get last notice from user")."\n". + _("whois - get profile info on user")."\n". + _("fav - add user's last notice as a 'fave'")."\n". + _("fav # - add notice with the given id as a 'fave'")."\n". + _("repeat # - repeat a notice with a given id")."\n". + _("repeat - repeat the last notice from user")."\n". + _("reply # - reply to notice with a given id")."\n". + _("reply - reply to the last notice from user")."\n". + _("join - join group")."\n". + #_("login - Get a link to login to the web interface")."\n". + _("drop - leave group")."\n". + _("stats - get your stats")."\n". + _("stop - same as 'off'")."\n". + _("quit - same as 'off'")."\n". + _("sub - same as 'follow'")."\n". + _("unsub - same as 'leave'")."\n". + _("last - same as 'get'")."\n". + #_("on - not yet implemented.")."\n". + #_("off - not yet implemented.")."\n". + _("nudge - remind a user to update.")."\n"); + #_("invite - not yet implemented.")."\n". + #_("track - not yet implemented.")."\n". + #_("untrack - not yet implemented.")."\n". + #_("track off - not yet implemented.")."\n". + #_("untrack all - not yet implemented.")."\n". + #_("tracks - not yet implemented.")."\n". + #_("tracking - not yet implemented.")."\n" } } From a1c3a2d3a12c1667492e4107007b31ec3a1f9c7b Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 6 Jan 2010 16:21:29 -0800 Subject: [PATCH 10/13] Fix broken API method /api/statusnet/groups/leave/:id.:format --- actions/apigroupleave.php | 8 ++++---- actions/leavegroup.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/actions/apigroupleave.php b/actions/apigroupleave.php index 514a3a557d..5627bfc146 100644 --- a/actions/apigroupleave.php +++ b/actions/apigroupleave.php @@ -108,7 +108,7 @@ class ApiGroupLeaveAction extends ApiAuthAction $member = new Group_member(); $member->group_id = $this->group->id; - $member->profile_id = $this->auth->id; + $member->profile_id = $this->auth_user->id; if (!$member->find(true)) { $this->serverError(_('You are not a member of this group.')); @@ -118,12 +118,12 @@ class ApiGroupLeaveAction extends ApiAuthAction $result = $member->delete(); if (!$result) { - common_log_db_error($member, 'INSERT', __FILE__); + common_log_db_error($member, 'DELETE', __FILE__); $this->serverError( sprintf( - _('Could not remove user %s to group %s.'), + _('Could not remove user %s from group %s.'), $this->user->nickname, - $this->$group->nickname + $this->group->nickname ) ); return; diff --git a/actions/leavegroup.php b/actions/leavegroup.php index 08fce15098..90c85e1a4e 100644 --- a/actions/leavegroup.php +++ b/actions/leavegroup.php @@ -123,8 +123,8 @@ class LeavegroupAction extends Action $result = $member->delete(); if (!$result) { - common_log_db_error($member, 'INSERT', __FILE__); - $this->serverError(sprintf(_('Could not remove user %s to group %s'), + common_log_db_error($member, 'DELETE', __FILE__); + $this->serverError(sprintf(_('Could not remove user %s from group %s'), $cur->nickname, $this->group->nickname)); } From e50410683fa29dd424f893dd302d835828e0711f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 6 Jan 2010 16:34:18 -1000 Subject: [PATCH 11/13] only encache new objects when insert was successful --- classes/Memcached_DataObject.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index d11bd63682..15ca348218 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -143,7 +143,9 @@ class Memcached_DataObject extends DB_DataObject function insert() { $result = parent::insert(); - $this->encache(); // in case of cached negative lookups + if ($result) { + $this->encache(); // in case of cached negative lookups + } return $result; } From e1c7851a067d4d8201126816884b9992720010f5 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 6 Jan 2010 23:22:49 -0800 Subject: [PATCH 12/13] pass through keys() as keyTypes() for UserFlag --- plugins/UserFlag/User_flag_profile.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/UserFlag/User_flag_profile.php b/plugins/UserFlag/User_flag_profile.php index 6582594524..6bf47071b2 100644 --- a/plugins/UserFlag/User_flag_profile.php +++ b/plugins/UserFlag/User_flag_profile.php @@ -89,6 +89,17 @@ class User_flag_profile extends Memcached_DataObject return array('profile_id' => 'N', 'user_id' => 'N'); } + /** + * return key definitions for DB_DataObject + * + * @return array key definitions + */ + + function keyTypes() + { + return $this->keys(); + } + /** * Get a single object with multiple keys * From f4fa785fb7cf6f222f77ad81f6a1e50e5af7fdf3 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 6 Jan 2010 23:24:24 -0800 Subject: [PATCH 13/13] Revert "Ticket 2107: remove "not implemented" items from sms/xmpp help; nobody likes being told what they can't do!" This reverts commit 5d9a2eb17e3f6e3bc73b5aa80625a365761b6689. These are commands that are/were implemented by Twitter, and we don't (yet) implemented. People will be looking for that information. --- doc-src/sms | 11 +++++++- lib/command.php | 74 ++++++++++++++++++++++++------------------------- 2 files changed, 47 insertions(+), 38 deletions(-) diff --git a/doc-src/sms b/doc-src/sms index 2c20921c35..1a3064318f 100644 --- a/doc-src/sms +++ b/doc-src/sms @@ -56,4 +56,13 @@ You can use the following commands with %%site.name%%. * sub <nickname> - same as 'follow' * unsub <nickname> - same as 'leave' * last <nickname> - same as 'get' -* nudge <nickname> - remind a user to update. +* on <nickname> - not yet implemented. +* off <nickname> - not yet implemented. +* nudge <nickname> - not yet implemented. +* invite <phone number> - not yet implemented. +* track <word> - not yet implemented. +* untrack <word> - not yet implemented. +* track off - not yet implemented. +* untrack all - not yet implemented. +* tracks - not yet implemented. +* tracking - not yet implemented. diff --git a/lib/command.php b/lib/command.php index ad2e0bb975..67140c3485 100644 --- a/lib/command.php +++ b/lib/command.php @@ -742,42 +742,42 @@ class HelpCommand extends Command function execute($channel) { $channel->output($this->user, - _("Commands:")."\n". - _("on - turn on notifications")."\n". - _("off - turn off notifications")."\n". - _("help - show this help")."\n". - _("follow - subscribe to user")."\n". - _("groups - lists the groups you have joined")."\n". - _("subscriptions - list the people you follow")."\n". - _("subscribers - list the people that follow you")."\n". - _("leave - unsubscribe from user")."\n". - _("d - direct message to user")."\n". - _("get - get last notice from user")."\n". - _("whois - get profile info on user")."\n". - _("fav - add user's last notice as a 'fave'")."\n". - _("fav # - add notice with the given id as a 'fave'")."\n". - _("repeat # - repeat a notice with a given id")."\n". - _("repeat - repeat the last notice from user")."\n". - _("reply # - reply to notice with a given id")."\n". - _("reply - reply to the last notice from user")."\n". - _("join - join group")."\n". - #_("login - Get a link to login to the web interface")."\n". - _("drop - leave group")."\n". - _("stats - get your stats")."\n". - _("stop - same as 'off'")."\n". - _("quit - same as 'off'")."\n". - _("sub - same as 'follow'")."\n". - _("unsub - same as 'leave'")."\n". - _("last - same as 'get'")."\n". - #_("on - not yet implemented.")."\n". - #_("off - not yet implemented.")."\n". - _("nudge - remind a user to update.")."\n"); - #_("invite - not yet implemented.")."\n". - #_("track - not yet implemented.")."\n". - #_("untrack - not yet implemented.")."\n". - #_("track off - not yet implemented.")."\n". - #_("untrack all - not yet implemented.")."\n". - #_("tracks - not yet implemented.")."\n". - #_("tracking - not yet implemented.")."\n" + _("Commands:\n". + "on - turn on notifications\n". + "off - turn off notifications\n". + "help - show this help\n". + "follow - subscribe to user\n". + "groups - lists the groups you have joined\n". + "subscriptions - list the people you follow\n". + "subscribers - list the people that follow you\n". + "leave - unsubscribe from user\n". + "d - direct message to user\n". + "get - get last notice from user\n". + "whois - get profile info on user\n". + "fav - add user's last notice as a 'fave'\n". + "fav # - add notice with the given id as a 'fave'\n". + "repeat # - repeat a notice with a given id\n". + "repeat - repeat the last notice from user\n". + "reply # - reply to notice with a given id\n". + "reply - reply to the last notice from user\n". + "join - join group\n". + "login - Get a link to login to the web interface\n". + "drop - leave group\n". + "stats - get your stats\n". + "stop - same as 'off'\n". + "quit - same as 'off'\n". + "sub - same as 'follow'\n". + "unsub - same as 'leave'\n". + "last - same as 'get'\n". + "on - not yet implemented.\n". + "off - not yet implemented.\n". + "nudge - remind a user to update.\n". + "invite - not yet implemented.\n". + "track - not yet implemented.\n". + "untrack - not yet implemented.\n". + "track off - not yet implemented.\n". + "untrack all - not yet implemented.\n". + "tracks - not yet implemented.\n". + "tracking - not yet implemented.\n")); } }