function activity_creator_update_8002 in Open Social 10.2.x
Same name and namespace in other branches
- 8.9 modules/custom/activity_creator/activity_creator.install \activity_creator_update_8002()
- 8.8 modules/custom/activity_creator/activity_creator.install \activity_creator_update_8002()
- 10.3.x modules/custom/activity_creator/activity_creator.install \activity_creator_update_8002()
- 10.0.x modules/custom/activity_creator/activity_creator.install \activity_creator_update_8002()
- 10.1.x modules/custom/activity_creator/activity_creator.install \activity_creator_update_8002()
Updates activities with status READ to SEEN.
As we are removing the ACTIVITY_STATUS_READ, so we want to update all the current activities with status as read to seen, so that we don't have any dangling data in tables.
File
- modules/
custom/ activity_creator/ activity_creator.install, line 105 - Installation code for the activity_creator module.
Code
function activity_creator_update_8002() {
try {
$connection = Database::getConnection();
// Get all the activities with status READ.
$txn = $connection
->startTransaction();
// Update all the activities status as READ to SEEN.
$connection
->update('activity__field_activity_status')
->fields([
'field_activity_status_value' => 2,
])
->condition('field_activity_status_value', 3)
->execute();
} catch (\PDOException $exception) {
\Drupal::logger('default')
->error($exception
->getMessage());
$txn
->rollBack();
}
}