63 $entity->setMetadata(
'__content_owner_subscription_upgrade_migrated', time());
69 foreach ($entities as
$entity) {
70 $owner = $entity->getOwnerEntity();
73 $process_entity($entity);
78 $content_preferences =
$owner->getNotificationSettings(
'content_create');
79 $enabled_methods = array_keys(array_filter($content_preferences));
80 if (empty($enabled_methods)) {
81 $process_entity($entity);
85 if ($entity->hasSubscriptions(
$owner->guid)) {
87 $process_entity($entity);
92 $entity->addSubscription(
$owner->guid, $enabled_methods);
94 $process_entity($entity);
112 'created_before' =>
$upgrade->time_created,
117 'preload_owners' =>
true,
120 $owner_guids = $qb->
subquery(
'entities');
121 $owner_guids->select(
'guid')
124 return $qb->
compare(
"{$main_alias}.owner_guid",
'in', $owner_guids->getSQL());
147 $notification_relationship = $qb->
subquery(
'entity_relationships',
'er');
148 $notification_relationship->select(
'er.guid_one')
149 ->andWhere($qb->
compare(
'er.guid_two',
'=',
"{$main_alias}.guid"))
152 return $qb->
compare(
"{$main_alias}.owner_guid",
'NOT IN', $notification_relationship->getSQL());
run(Result $result, $offset)
Database abstraction query builder.
addSuccesses(int $num=1)
Set an item (or items) as successfully upgraded.
getUpgrade()
Returns the related upgrade entity.
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
Subscribe all content owners to their own content.
elgg_count_entities(array $options=[])
Returns a count of entities.
compare($x, $comparison, $y=null, $type=null, $case_sensitive=null)
Build value comparison clause.
Result of a single BatchUpgrade run.
subquery($table, $alias=null)
Creates a new SelectQueryBuilder for join/where subqueries using the DB connection of the primary Que...
const MUTE_NOTIFICATIONS_RELATIONSHIP
if($email instanceof\Elgg\Email) $object
merge($parts=null, $boolean= 'AND')
Merges multiple composite expressions with a boolean.
getOptions(array $options=[])
Get query options.
elgg_get_notification_methods()
Returns registered delivery methods for notifications [ 'email' => 'email', 'sms' => 'sms'...
Class to extend for asynchronous upgrades, i.e.