The overloaded DB_DataObject function staticGet is now called getKV
I used this hacky sed-command (run it from your GNU Social root, or change the first grep's path to where it actually lies) to do a rough fix on all ::staticGet calls and rename them to ::getKV sed -i -s -e '/DataObject::staticGet/I!s/::staticGet/::getKV/Ig' $(grep -R ::staticGet `pwd`/* | grep -v -e '^extlib' | grep -v DataObject:: |grep -v "function staticGet"|cut -d: -f1 |sort |uniq) If you're applying this, remember to change the Managed_DataObject and Memcached_DataObject function definitions of staticGet to getKV! This might of course take some getting used to, or modification fo StatusNet plugins, but the result is that all the static calls (to staticGet) are now properly made without breaking PHP Strict Standards. Standards are there to be followed (and they caused some very bad confusion when used with get_called_class) Reasonably any plugin or code that tests for the definition of 'GNUSOCIAL' or similar will take this change into consideration.
This commit is contained in:
@@ -245,7 +245,7 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||
$gps = null;
|
||||
|
||||
if (!empty($form->group)) {
|
||||
$gps = Group_privacy_settings::staticGet('group_id', $form->group->id);
|
||||
$gps = Group_privacy_settings::getKV('group_id', $form->group->id);
|
||||
}
|
||||
|
||||
$form->out->elementStart('li');
|
||||
@@ -286,7 +286,7 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||
$gps = null;
|
||||
|
||||
if (!empty($action->group)) {
|
||||
$gps = Group_privacy_settings::staticGet('group_id', $action->group->id);
|
||||
$gps = Group_privacy_settings::getKV('group_id', $action->group->id);
|
||||
}
|
||||
|
||||
$orig = null;
|
||||
@@ -441,7 +441,7 @@ class GroupPrivateMessagePlugin extends Plugin
|
||||
"but group ".$group->nickname." does not allow them.");
|
||||
}
|
||||
|
||||
$user = User::staticGet('id', $notice->profile_id);
|
||||
$user = User::getKV('id', $notice->profile_id);
|
||||
|
||||
if (empty($user)) {
|
||||
common_log(LOG_WARNING,
|
||||
|
@@ -151,7 +151,7 @@ class Group_message extends Managed_DataObject
|
||||
|
||||
function distribute()
|
||||
{
|
||||
$group = User_group::staticGet('id', $this->to_group);
|
||||
$group = User_group::getKV('id', $this->to_group);
|
||||
|
||||
$member = $group->getMembers();
|
||||
|
||||
@@ -162,7 +162,7 @@ class Group_message extends Managed_DataObject
|
||||
|
||||
function getGroup()
|
||||
{
|
||||
$group = User_group::staticGet('id', $this->to_group);
|
||||
$group = User_group::getKV('id', $this->to_group);
|
||||
if (empty($group)) {
|
||||
// TRANS: Exception thrown when trying to send group private message to a non-existing group.
|
||||
throw new ServerException(_m('No group for group message.'));
|
||||
@@ -172,7 +172,7 @@ class Group_message extends Managed_DataObject
|
||||
|
||||
function getSender()
|
||||
{
|
||||
$sender = Profile::staticGet('id', $this->from_profile);
|
||||
$sender = Profile::getKV('id', $this->from_profile);
|
||||
if (empty($sender)) {
|
||||
// TRANS: Exception thrown when trying to send group private message without having a sender.
|
||||
throw new ServerException(_m('No sender for group message.'));
|
||||
|
@@ -126,15 +126,15 @@ class Group_message_profile extends Managed_DataObject
|
||||
|
||||
function notifyByMail()
|
||||
{
|
||||
$to = User::staticGet('id', $this->to_profile);
|
||||
$to = User::getKV('id', $this->to_profile);
|
||||
|
||||
if (empty($to) || is_null($to->email) || !$to->emailnotifymsg) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$gm = Group_message::staticGet('id', $this->group_message_id);
|
||||
$gm = Group_message::getKV('id', $this->group_message_id);
|
||||
|
||||
$from_profile = Profile::staticGet('id', $gm->from_profile);
|
||||
$from_profile = Profile::getKV('id', $gm->from_profile);
|
||||
|
||||
$group = $gm->getGroup();
|
||||
|
||||
|
@@ -126,7 +126,7 @@ class Group_privacy_settings extends Managed_DataObject
|
||||
|
||||
function forGroup($group)
|
||||
{
|
||||
$gps = Group_privacy_settings::staticGet('group_id', $group->id);
|
||||
$gps = Group_privacy_settings::getKV('group_id', $group->id);
|
||||
|
||||
if (empty($gps)) {
|
||||
// make a fake one with defaults
|
||||
|
@@ -76,14 +76,14 @@ class GroupinboxAction extends GroupAction
|
||||
return false;
|
||||
}
|
||||
|
||||
$localGroup = Local_group::staticGet('nickname', $nickname);
|
||||
$localGroup = Local_group::getKV('nickname', $nickname);
|
||||
|
||||
if (empty($localGroup)) {
|
||||
// TRANS: Client exception thrown when trying to view group inbox for non-existing group.
|
||||
throw new ClientException(_m('No such group.'), 404);
|
||||
}
|
||||
|
||||
$this->group = User_group::staticGet('id', $localGroup->group_id);
|
||||
$this->group = User_group::getKV('id', $localGroup->group_id);
|
||||
|
||||
if (empty($this->group)) {
|
||||
// TRANS: Client exception thrown when trying to view group inbox for non-existing group.
|
||||
|
@@ -84,14 +84,14 @@ class NewgroupmessageAction extends Action
|
||||
return false;
|
||||
}
|
||||
|
||||
$localGroup = Local_group::staticGet('nickname', $nickname);
|
||||
$localGroup = Local_group::getKV('nickname', $nickname);
|
||||
|
||||
if (empty($localGroup)) {
|
||||
// TRANS: Client exception thrown when trying to send a private group message to a non-existing group.
|
||||
throw new ClientException(_m('No such group.'), 404);
|
||||
}
|
||||
|
||||
$this->group = User_group::staticGet('id', $localGroup->group_id);
|
||||
$this->group = User_group::getKV('id', $localGroup->group_id);
|
||||
|
||||
if (empty($this->group)) {
|
||||
// TRANS: Client exception thrown when trying to send a private group message to a non-existing group.
|
||||
|
@@ -72,14 +72,14 @@ class ShowgroupmessageAction extends Action
|
||||
|
||||
$id = $this->trimmed('id');
|
||||
|
||||
$this->gm = Group_message::staticGet('id', $id);
|
||||
$this->gm = Group_message::getKV('id', $id);
|
||||
|
||||
if (empty($this->gm)) {
|
||||
// TRANS: Client exception thrown when trying to view a non-existing group private message.
|
||||
throw new ClientException(_m('No such message.'), 404);
|
||||
}
|
||||
|
||||
$this->group = User_group::staticGet('id', $this->gm->to_group);
|
||||
$this->group = User_group::getKV('id', $this->gm->to_group);
|
||||
|
||||
if (empty($this->group)) {
|
||||
// TRANS: Server exception thrown when trying to view group private messages for a non-exsting group.
|
||||
@@ -91,7 +91,7 @@ class ShowgroupmessageAction extends Action
|
||||
throw new ClientException(_m('Cannot read message.'), 403);
|
||||
}
|
||||
|
||||
$this->sender = Profile::staticGet('id', $this->gm->from_profile);
|
||||
$this->sender = Profile::getKV('id', $this->gm->from_profile);
|
||||
|
||||
if (empty($this->sender)) {
|
||||
// TRANS: Server exception thrown when trying to view a group private message without a sender.
|
||||
|
Reference in New Issue
Block a user