$act->actor = $actor->asActivityObject();
$act->target = new ActivityObject(); // We don't save the notice object, as it's supposed to be removed!
$act->target->id = $notice->getUri();
- $act->target->type = $notice->getObjectType();
+ try {
+ $act->target->type = $notice->getObjectType();
+ } catch (NoObjectTypeException $e) {
+ // This could be for example an RSVP which is a verb and carries no object-type
+ $act->target->type = null;
+ }
$act->objects = array(clone($act->target));
$url = $notice->getUrl();
static public function fromStored(Notice $stored)
{
$class = get_called_class();
- return self::getByPK(array('uri' => $stored->getUri()));
+ return self::getByKeys( ['uri' => $stored->getUri()] );
}
// The one who deleted the notice, not the notice's author
$actobj->title = ActivityUtils::verbToTitle($actobj->verb);
$actor = $this->getActor();
+ // TRANS: Notice HTML content of a deleted notice. %1$s is the
+ // TRANS: actor's URL, %2$s its "fancy name" and %3$s the notice URI.
$actobj->content = sprintf(_m('<a href="%1$s">%2$s</a> deleted notice {{%3$s}}.'),
htmlspecialchars($actor->getUrl()),
- htmlspecialchars($actor->getBestName()),
+ htmlspecialchars($actor->getFancyName()),
htmlspecialchars($this->getUri())
);
echo "\nFound old $table table, upgrading it to add 'act_created' field...";
$schemadef['fields']['act_created'] = array('type' => 'datetime', 'not null' => true, 'description' => 'datetime the notice record was created');
+ $schemadef['fields']['uri']['length'] = 191; // we likely don't have to discover too long keys here
$schema->ensureTable($table, $schemadef);
$deleted = new Deleted_notice();
print "Resuming core schema upgrade...";
}
+ function insert()
+ {
+ $result = parent::insert();
+
+ if ($result === false) {
+ common_log_db_error($this, 'INSERT', __FILE__);
+ // TRANS: Server exception thrown when a stored object entry cannot be saved.
+ throw new ServerException('Could not save Deleted_notice');
+ }
+ }
}