Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
This commit is contained in:
commit
e53512cd2c
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -37,7 +37,7 @@ class Avatar extends Memcached_DataObject
|
|||
}
|
||||
}
|
||||
|
||||
function &pkeyGet($kv)
|
||||
function pkeyGet($kv)
|
||||
{
|
||||
return Memcached_DataObject::pkeyGet('Avatar', $kv);
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ class Config extends Memcached_DataObject
|
|||
return $result;
|
||||
}
|
||||
|
||||
function &pkeyGet($kv)
|
||||
function pkeyGet($kv)
|
||||
{
|
||||
return Memcached_DataObject::pkeyGet('Config', $kv);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class Fave extends Memcached_DataObject
|
|||
return $fave;
|
||||
}
|
||||
|
||||
function &pkeyGet($kv)
|
||||
function pkeyGet($kv)
|
||||
{
|
||||
return Memcached_DataObject::pkeyGet('Fave', $kv);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
@ -143,7 +146,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class Notice_tag extends Memcached_DataObject
|
|||
}
|
||||
}
|
||||
|
||||
function &pkeyGet($kv)
|
||||
function pkeyGet($kv)
|
||||
{
|
||||
return Memcached_DataObject::pkeyGet('Notice_tag', $kv);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
@ -97,7 +108,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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user