summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/Profile.php3
-rw-r--r--classes/Profile_role.php1
-rw-r--r--classes/Safe_DataObject.php19
-rw-r--r--classes/Subscription.php4
4 files changed, 25 insertions, 2 deletions
diff --git a/classes/Profile.php b/classes/Profile.php
index 91f6e4692..eded1ff71 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -732,6 +732,9 @@ class Profile extends Memcached_DataObject
function hasRight($right)
{
$result = false;
+ if ($this->hasRole(Profile_role::DELETED)) {
+ return false;
+ }
if (Event::handle('UserRightsCheck', array($this, $right, &$result))) {
switch ($right)
{
diff --git a/classes/Profile_role.php b/classes/Profile_role.php
index d0a0b31f0..e7aa1f0f0 100644
--- a/classes/Profile_role.php
+++ b/classes/Profile_role.php
@@ -53,6 +53,7 @@ class Profile_role extends Memcached_DataObject
const ADMINISTRATOR = 'administrator';
const SANDBOXED = 'sandboxed';
const SILENCED = 'silenced';
+ const DELETED = 'deleted'; // Pending final deletion of notices...
public static function isValid($role)
{
diff --git a/classes/Safe_DataObject.php b/classes/Safe_DataObject.php
index 021f7b506..08bc6846f 100644
--- a/classes/Safe_DataObject.php
+++ b/classes/Safe_DataObject.php
@@ -43,6 +43,25 @@ class Safe_DataObject extends DB_DataObject
}
/**
+ * Magic function called at clone() time.
+ *
+ * We use this to drop connection with some global resources.
+ * This supports the fairly common pattern where individual
+ * items being read in a loop via a single object are cloned
+ * for individual processing, then fall out of scope when the
+ * loop comes around again.
+ *
+ * As that triggers the destructor, we want to make sure that
+ * the original object doesn't have its database result killed.
+ * It will still be freed properly when the original object
+ * gets destroyed.
+ */
+ function __clone()
+ {
+ $this->_DB_resultid = false;
+ }
+
+ /**
* Magic function called at serialize() time.
*
* We use this to drop a couple process-specific references
diff --git a/classes/Subscription.php b/classes/Subscription.php
index 9cef2df1a..5ac95f922 100644
--- a/classes/Subscription.php
+++ b/classes/Subscription.php
@@ -105,8 +105,8 @@ class Subscription extends Memcached_DataObject
$auto = new Subscription();
- $auto->subscriber = $subscriber->id;
- $auto->subscribed = $other->id;
+ $auto->subscriber = $other->id;
+ $auto->subscribed = $subscriber->id;
$auto->created = common_sql_now();
$result = $auto->insert();