64 $entity->setMetadata(
'__content_owner_subscription_upgrade_migrated', time());
70 foreach ($entities as
$entity) {
71 $owner = $entity->getOwnerEntity();
74 $process_entity($entity);
79 $content_preferences =
$owner->getNotificationSettings(
'content_create');
80 $enabled_methods = array_keys(array_filter($content_preferences));
81 if (empty($enabled_methods)) {
82 $process_entity($entity);
86 if ($entity->hasSubscriptions(
$owner->guid)) {
88 $process_entity($entity);
93 $entity->addSubscription(
$owner->guid, $enabled_methods);
95 $process_entity($entity);
113 'created_before' =>
$upgrade->time_created,
118 'preload_owners' =>
true,
122 $owner_guids->select(
'guid')
125 return $qb->
compare(
"{$main_alias}.owner_guid",
'in', $owner_guids->getSQL());
148 $notification_relationship = $qb->
subquery(
'entity_relationships',
'er');
149 $notification_relationship->select(
'er.guid_one')
150 ->andWhere($qb->
compare(
'er.guid_two',
'=',
"{$main_alias}.guid"))
153 return $qb->
compare(
"{$main_alias}.owner_guid",
'NOT IN', $notification_relationship->getSQL());
subquery(string $table, string $alias=null)
Creates a new SelectQueryBuilder for join/where sub queries using the DB connection of the primary Qu...
run(Result $result, $offset)
Database abstraction query builder.
addSuccesses(int $num=1)
Set an item (or items) as successfully upgraded.
if($who_can_change_language=== 'nobody') elseif($who_can_change_language=== 'admin_only'&&!elgg_is_admin_logged_in()) $options
getUpgrade()
Returns the related upgrade entity.
if(empty($guid)) $upgrade
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
Subscribe all content owners to their own content.
compare(string $x, string $comparison, $y=null, string $type=null, bool $case_sensitive=null)
Build value comparison clause.
elgg_count_entities(array $options=[])
Returns a count of entities.
Result of a single BatchUpgrade run.
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.