Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/user/user.api.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
56 $nodes = \Drupal::entityQuery('node') | 56 $nodes = \Drupal::entityQuery('node') |
57 ->condition('uid', $account->id()) | 57 ->condition('uid', $account->id()) |
58 ->execute(); | 58 ->execute(); |
59 node_mass_update($nodes, ['uid' => 0], NULL, TRUE); | 59 node_mass_update($nodes, ['uid' => 0], NULL, TRUE); |
60 // Anonymize old revisions. | 60 // Anonymize old revisions. |
61 db_update('node_field_revision') | 61 \Drupal::database()->update('node_field_revision') |
62 ->fields(['uid' => 0]) | 62 ->fields(['uid' => 0]) |
63 ->condition('uid', $account->id()) | 63 ->condition('uid', $account->id()) |
64 ->execute(); | 64 ->execute(); |
65 break; | 65 break; |
66 } | 66 } |
148 $config = \Drupal::config('system.date'); | 148 $config = \Drupal::config('system.date'); |
149 // If the user has a NULL time zone, notify them to set a time zone. | 149 // If the user has a NULL time zone, notify them to set a time zone. |
150 if (!$account->getTimezone() && $config->get('timezone.user.configurable') && $config->get('timezone.user.warn')) { | 150 if (!$account->getTimezone() && $config->get('timezone.user.configurable') && $config->get('timezone.user.warn')) { |
151 \Drupal::messenger() | 151 \Drupal::messenger() |
152 ->addStatus(t('Configure your <a href=":user-edit">account time zone setting</a>.', [ | 152 ->addStatus(t('Configure your <a href=":user-edit">account time zone setting</a>.', [ |
153 ':user-edit' => $account->url('edit-form', [ | 153 ':user-edit' => $account->toUrl('edit-form', [ |
154 'query' => \Drupal::destination() | 154 'query' => \Drupal::destination() |
155 ->getAsArray(), | 155 ->getAsArray(), |
156 'fragment' => 'edit-timezone', | 156 'fragment' => 'edit-timezone', |
157 ]), | 157 ])->toString(), |
158 ])); | 158 ])); |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 /** | 162 /** |
164 * | 164 * |
165 * @param \Drupal\Core\Session\AccountInterface $account | 165 * @param \Drupal\Core\Session\AccountInterface $account |
166 * The user object on which the operation was just performed. | 166 * The user object on which the operation was just performed. |
167 */ | 167 */ |
168 function hook_user_logout(AccountInterface $account) { | 168 function hook_user_logout(AccountInterface $account) { |
169 db_insert('logouts') | 169 \Drupal::database()->insert('logouts') |
170 ->fields([ | 170 ->fields([ |
171 'uid' => $account->id(), | 171 'uid' => $account->id(), |
172 'time' => time(), | 172 'time' => time(), |
173 ]) | 173 ]) |
174 ->execute(); | 174 ->execute(); |