2012-04-26 04:05:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Handles counts of node views via AJAX with minimal bootstrap.
|
|
|
|
*/
|
|
|
|
|
2014-06-26 10:47:01 +00:00
|
|
|
use Drupal\Core\DrupalKernel;
|
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
|
2012-04-26 04:05:27 +00:00
|
|
|
chdir('../../..');
|
|
|
|
|
2015-03-11 08:31:22 +00:00
|
|
|
$autoloader = require_once 'autoload.php';
|
2014-06-26 10:47:01 +00:00
|
|
|
|
|
|
|
$kernel = DrupalKernel::createFromRequest(Request::createFromGlobals(), $autoloader, 'prod');
|
|
|
|
$kernel->boot();
|
Issue #1446932 by timmillwood, mallezie, RobLoach, hussainweb, Wim Leers, rpayanm, kostyashupenko, mparker17, dawehner, Berdir, Crell: Improve statistics performance by adding a swappable backend
2016-08-03 11:04:48 +00:00
|
|
|
$container = $kernel->getContainer();
|
2014-06-26 10:47:01 +00:00
|
|
|
|
Issue #1446932 by timmillwood, mallezie, RobLoach, hussainweb, Wim Leers, rpayanm, kostyashupenko, mparker17, dawehner, Berdir, Crell: Improve statistics performance by adding a swappable backend
2016-08-03 11:04:48 +00:00
|
|
|
$views = $container
|
2014-06-26 10:47:01 +00:00
|
|
|
->get('config.factory')
|
|
|
|
->get('statistics.settings')
|
|
|
|
->get('count_content_views');
|
2012-08-07 19:49:48 +00:00
|
|
|
|
2014-06-26 10:47:01 +00:00
|
|
|
if ($views) {
|
2012-08-09 20:21:01 +00:00
|
|
|
$nid = filter_input(INPUT_POST, 'nid', FILTER_VALIDATE_INT);
|
|
|
|
if ($nid) {
|
Issue #1446932 by timmillwood, mallezie, RobLoach, hussainweb, Wim Leers, rpayanm, kostyashupenko, mparker17, dawehner, Berdir, Crell: Improve statistics performance by adding a swappable backend
2016-08-03 11:04:48 +00:00
|
|
|
$container->get('request_stack')->push(Request::createFromGlobals());
|
|
|
|
$container->get('statistics.storage.node')->recordView($nid);
|
2012-04-26 04:05:27 +00:00
|
|
|
}
|
|
|
|
}
|