Skip to content
Snippets Groups Projects
Commit 129a8dcd authored by Ere Maijala's avatar Ere Maijala Committed by Demian Katz
Browse files

Allow theme init and permissions manager to work in console mode. (#1136)

- More progress on VUFIND-999.
parent e7cd0d87
No related merge requests found
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
namespace VuFind\Role\PermissionProvider; namespace VuFind\Role\PermissionProvider;
use VuFind\Net\IpAddressUtils; use VuFind\Net\IpAddressUtils;
use Zend\Http\PhpEnvironment\Request; use Zend\Console\Console;
use Zend\Stdlib\RequestInterface;
/** /**
* IpRange permission provider for VuFind. * IpRange permission provider for VuFind.
...@@ -63,10 +64,10 @@ class IpRange implements PermissionProviderInterface ...@@ -63,10 +64,10 @@ class IpRange implements PermissionProviderInterface
/** /**
* Constructor * Constructor
* *
* @param Request $request Request object * @param RequestInterface $request Request object
* @param IpAddressUtils $ipUtils IpAddressUtils object * @param IpAddressUtils $ipUtils IpAddressUtils object
*/ */
public function __construct(Request $request, IpAddressUtils $ipUtils) public function __construct(RequestInterface $request, IpAddressUtils $ipUtils)
{ {
$this->request = $request; $this->request = $request;
$this->ipAddressUtils = $ipUtils; $this->ipAddressUtils = $ipUtils;
...@@ -82,6 +83,9 @@ class IpRange implements PermissionProviderInterface ...@@ -82,6 +83,9 @@ class IpRange implements PermissionProviderInterface
*/ */
public function getPermissions($options) public function getPermissions($options)
{ {
if (Console::isConsole()) {
return [];
}
// Check if any regex matches.... // Check if any regex matches....
$ip = $this->request->getServer()->get('REMOTE_ADDR'); $ip = $this->request->getServer()->get('REMOTE_ADDR');
if ($this->ipAddressUtils->isInRange($ip, (array)$options)) { if ($this->ipAddressUtils->isInRange($ip, (array)$options)) {
......
...@@ -217,6 +217,9 @@ class Initializer ...@@ -217,6 +217,9 @@ class Initializer
{ {
// Load standard configuration options: // Load standard configuration options:
$standardTheme = $this->config->theme; $standardTheme = $this->config->theme;
if (Console::isConsole()) {
return $standardTheme;
}
$mobileTheme = $this->mobile->enabled() $mobileTheme = $this->mobile->enabled()
? $this->config->mobile_theme : false; ? $this->config->mobile_theme : false;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment