From 37f2da03e107ca4644532d9e2ef7bf851f1ff321 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sat, 10 Oct 2015 21:31:26 +0200 Subject: [PATCH] newUri might as well be put in Managed_DataObject --- classes/Managed_DataObject.php | 12 ++++++++++++ .../ActivityModeration/classes/Deleted_notice.php | 12 ------------ plugins/Favorite/classes/Fave.php | 12 ------------ 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/classes/Managed_DataObject.php b/classes/Managed_DataObject.php index ec51402993..e645b5aec9 100644 --- a/classes/Managed_DataObject.php +++ b/classes/Managed_DataObject.php @@ -453,4 +453,16 @@ abstract class Managed_DataObject extends Memcached_DataObject { // NOOP } + + static function newUri(Profile $actor, Managed_DataObject $object, $created=null) + { + if (is_null($created)) { + $created = common_sql_now(); + } + return TagURI::mint(strtolower(get_called_class()).':%d:%s:%d:%s', + $actor->getID(), + ActivityUtils::resolveUri($object->getObjectType(), true), + $object->getID(), + common_date_iso8601($created)); + } } diff --git a/plugins/ActivityModeration/classes/Deleted_notice.php b/plugins/ActivityModeration/classes/Deleted_notice.php index b7413cfb27..254d410721 100644 --- a/plugins/ActivityModeration/classes/Deleted_notice.php +++ b/plugins/ActivityModeration/classes/Deleted_notice.php @@ -175,18 +175,6 @@ class Deleted_notice extends Managed_DataObject $act->title = ActivityUtils::verbToTitle($act->verb); } - static function newUri(Profile $actor, Managed_DataObject $object, $created=null) - { - if (is_null($created)) { - $created = common_sql_now(); - } - return TagURI::mint(strtolower(get_called_class()).':%d:%s:%d:%s', - $actor->getID(), - ActivityUtils::resolveUri($object->getObjectType(), true), - $object->getID(), - common_date_iso8601($created)); - } - static public function beforeSchemaUpdate() { $table = strtolower(get_called_class()); diff --git a/plugins/Favorite/classes/Fave.php b/plugins/Favorite/classes/Fave.php index 1e011decf8..ad7cc67df8 100644 --- a/plugins/Favorite/classes/Fave.php +++ b/plugins/Favorite/classes/Fave.php @@ -440,16 +440,4 @@ class Fave extends Managed_DataObject // We (should've in this case) created it ourselves, so we tag it ourselves return self::newUri($this->getActor(), $this->getTarget(), $this->created); } - - static function newUri(Profile $actor, Managed_DataObject $target, $created=null) - { - if (is_null($created)) { - $created = common_sql_now(); - } - return TagURI::mint(strtolower(get_called_class()).':%d:%s:%d:%s', - $actor->id, - ActivityUtils::resolveUri(self::getObjectType(), true), - $target->id, - common_date_iso8601($created)); - } } -- 2.39.5