MemcacheStatusController.php in Memcache Status 8
File
lib/Drupal/memcache_status/Routing/MemcacheStatusController.php
View source
<?php
namespace Drupal\memcache_status\Routing;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\ControllerInterface;
class MemcacheStatusController implements ControllerInterface {
public static function create(ContainerInterface $container) {
return new static();
}
public function memcacheReport() {
$memcache_php = __DIR__ . '/../../../../memcache.php.inc';
if (!is_file($memcache_php)) {
$output = t('<code>memcache.php.inc</code> not found. Please download and extract <a href="@memcache-url">memcache</a>, rename <code>memcache.php</code> to <code>memcache.php.inc</code> and place the file in a directory named <code>memcache</code> that <a href="@libraries-api-url">Libraries API</a> can find (i.e., in <code>sites/all/libraries/memcache</code>).', array(
'@memcache-url' => "http://pecl.php.net/package/memcache",
'@libraries-api-url' => "http://drupal.org/project/libraries",
));
return $output;
}
global $MEMCACHE_SERVERS, $PHP_SELF;
$_SERVER['PHP_SELF'] = url('admin/reports/status/memcache');
$PHP_SELF = $_SERVER['PHP_SELF'];
$_SERVER['PHP_AUTH_USER'] = 'memcache';
$_SERVER['PHP_AUTH_PW'] = 'password';
$MEMCACHE_SERVERS = array(
'localhost:11211',
);
require_once $memcache_php;
drupal_exit();
}
}