Skip to content
Snippets Groups Projects
Commit 7cc26d4b authored by Fabian de Rijk's avatar Fabian de Rijk
Browse files

Issue #3289195 by Project Update Bot, batigolix: Automated Drupal 10 compatibility fixes

parent 789f9be9
Branches 2.0.x 2.x
Tags 2.0.0-alpha2
No related merge requests found
......@@ -182,7 +182,7 @@ function pusherapi_shoutbox_post() {
$data->name = variable_get('anonymous', 'Anonymous');
}
}
$data->time = format_date(REQUEST_TIME, 'custom', 'd-m-Y H:i:s');
$data->time = \Drupal::service('date.formatter')->format(\Drupal::time()->getRequestTime(), 'custom', 'd-m-Y H:i:s');
pusher_api_push($channel, $eventname, $data, PUSHERAPI_SHOUTBOX_NAME);
}
......
......@@ -72,7 +72,7 @@ function pusher_notifications_save($notification) {
if (!empty($notification['nfid'])) {
// Set the default timestamp when not set
if (empty($notification['created'])) {
$notification['created'] = REQUEST_TIME;
$notification['created'] = \Drupal::time()->getRequestTime();
}
drupal_write_record('pusher_notifications_data', $notification);
......@@ -86,15 +86,21 @@ function pusher_notifications_save($notification) {
* A notification ID or array of IDs.
*/
function pusher_notifications_delete($nfid) {
db_delete('pusher_notifications')->condition('nfid', $nfid)->execute();
db_delete('pusher_notifications_data')->condition('nfid', $nfid)->execute();
// TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
// You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
\Drupal::database()->delete('pusher_notifications')->condition('nfid', $nfid)->execute();
// TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
// You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
\Drupal::database()->delete('pusher_notifications_data')->condition('nfid', $nfid)->execute();
}
/**
* Implements hook_user_delete().
*/
function pusher_notifications_user_delete($account) {
$nfids = db_select('pusher_notifications', 'pn')
// TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
// You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
$nfids = \Drupal::database()->select('pusher_notifications', 'pn')
->fields('pn', array('nfid'))
->condition('uid', $account->uid)
->execute()
......@@ -111,7 +117,9 @@ function pusher_notifications_user_delete($account) {
* A user account object.
*/
function pusher_notifications_mark_read($account) {
db_update('pusher_notifications')
// TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
// You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
\Drupal::database()->update('pusher_notifications')
->fields(array(
'new' => 0,
))
......@@ -127,7 +135,9 @@ function pusher_notifications_mark_read($account) {
* A user account object.
*/
function pusher_notifications_new($account) {
$count = db_select('pusher_notifications', 'pn')
// TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
// You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
$count = \Drupal::database()->select('pusher_notifications', 'pn')
->condition('uid', $account->uid)
->condition('new', 1)
->countQuery()
......
......@@ -23,7 +23,9 @@ function pusher_notifications_list($type = 'ajax') {
pusher_notifications_mark_read($user);
// Query for a list of the latest notifications
$query = db_select('pusher_notifications', 'pn');
// TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
// You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
$query = \Drupal::database()->select('pusher_notifications', 'pn');
$query->join('pusher_notifications_data', 'pnd', 'pn.nfid = pnd.nfid');
$result = $query
......
......@@ -17,7 +17,7 @@
<div class="pusher-notification">
<?php print $markup; ?>
<span class="pusher-notification-date">
<?php print format_date($notification['created']); ?>
<?php print \Drupal::service('date.formatter')->format($notification['created']); ?>
</span>
</div>
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment