Skip to content

Instantly share code, notes, and snippets.

@samsonasik
Created June 25, 2014 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samsonasik/3795eac740246a9b099f to your computer and use it in GitHub Desktop.
Save samsonasik/3795eac740246a9b099f to your computer and use it in GitHub Desktop.
disable some module in console environment in ZF2
<?php
use Zend\Console\Console;
/**
* This makes our life easier when dealing with paths. Everything is relative
* to the application root now.
*/
chdir(dirname(__DIR__));
// Decline static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
return false;
}
// Setup autoloading
require 'init_autoloader.php';
$settings = require 'config/application.config.php';
if (Console::isConsole()) {
// no need to authorize on console
array_splice($settings['modules'], array_search('BjyAuthorize', $settings['modules']),1);
}
// Run the application!
Zend\Mvc\Application::init($settings)->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment