Issue #2061927 by joelpittet, InternetDevels, m1r1k: Remove references to global in History module.
parent
6819e5e0d6
commit
c33c50beeb
|
@ -100,10 +100,9 @@ function history_read_multiple($nids) {
|
||||||
* current user.
|
* current user.
|
||||||
*/
|
*/
|
||||||
function history_write($nid, $account = NULL) {
|
function history_write($nid, $account = NULL) {
|
||||||
global $user;
|
|
||||||
|
|
||||||
if (!isset($account)) {
|
if (!isset($account)) {
|
||||||
$account = $user;
|
$account = \Drupal::currentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($account->isAuthenticated()) {
|
if ($account->isAuthenticated()) {
|
||||||
|
|
|
@ -38,8 +38,7 @@ class HistoryUserTimestamp extends Node {
|
||||||
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
|
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
|
||||||
parent::init($view, $display, $options);
|
parent::init($view, $display, $options);
|
||||||
|
|
||||||
global $user;
|
if (\Drupal::currentUser()->isAuthenticated()) {
|
||||||
if ($user->isAuthenticated()) {
|
|
||||||
$this->additional_fields['created'] = array('table' => 'node_field_data', 'field' => 'created');
|
$this->additional_fields['created'] = array('table' => 'node_field_data', 'field' => 'created');
|
||||||
$this->additional_fields['changed'] = array('table' => 'node_field_data', 'field' => 'changed');
|
$this->additional_fields['changed'] = array('table' => 'node_field_data', 'field' => 'changed');
|
||||||
if (module_exists('comment') && !empty($this->options['comments'])) {
|
if (module_exists('comment') && !empty($this->options['comments'])) {
|
||||||
|
@ -69,8 +68,7 @@ class HistoryUserTimestamp extends Node {
|
||||||
|
|
||||||
public function query() {
|
public function query() {
|
||||||
// Only add ourselves to the query if logged in.
|
// Only add ourselves to the query if logged in.
|
||||||
global $user;
|
if (\Drupal::currentUser()->isAnonymous()) {
|
||||||
if ($user->isAnonymous()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
parent::query();
|
parent::query();
|
||||||
|
@ -84,8 +82,7 @@ class HistoryUserTimestamp extends Node {
|
||||||
// This code shadows node_mark, but it reads from the db directly and
|
// This code shadows node_mark, but it reads from the db directly and
|
||||||
// we already have that info.
|
// we already have that info.
|
||||||
$mark = MARK_READ;
|
$mark = MARK_READ;
|
||||||
global $user;
|
if (\Drupal::currentUser()->isAuthenticated()) {
|
||||||
if ($user->isAuthenticated()) {
|
|
||||||
$last_read = $this->getValue($values);
|
$last_read = $this->getValue($values);
|
||||||
$changed = $this->getValue($values, 'changed');
|
$changed = $this->getValue($values, 'changed');
|
||||||
|
|
||||||
|
|
|
@ -60,9 +60,8 @@ class HistoryUserTimestamp extends FilterPluginBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function query() {
|
public function query() {
|
||||||
global $user;
|
|
||||||
// This can only work if we're authenticated in.
|
// This can only work if we're authenticated in.
|
||||||
if (!$user->isAuthenticated()) {
|
if (!\Drupal::currentUser()->isAuthenticated()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue