public function qsBootstrap() { $this->application->bootstrap(); $bootstrap = $this->application->getBootstrap(); $frontController = $bootstrap->getResource('FrontController'); $frontController->setParam('bootstrap', $bootstrap); $configApplication = $this->application->bootstrap('config'); $requestConfig = $configApplication->getOption('request'); $this->requestParameterName = $requestConfig['parameter']; }
public static function bootstrap() { // // set the include_path set_include_path(implode(PATH_SEPARATOR, array('/usr/share/php/libzend-framework-php', realpath(APPLICATION_PATH . '/../glo-framework/library'), realpath(APPLICATION_PATH . '/../glo-generated'), realpath(APPLICATION_PATH . '/../library'), realpath(APPLICATION_PATH . '/../vendor'), get_include_path()))); // // set up the autoloader require_once 'Zend/Loader/Autoloader.php'; require_once 'Glo/Loader.php'; $autoLoader = Zend_Loader_Autoloader::getInstance(); $autoLoader->pushAutoloader(array('Glo_Loader', 'loadClass')); $autoLoader->setFallbackAutoloader(true); // // register the config $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', Glo_Environment::get(), array('allowModifications' => TRUE)); $registry = Zend_Registry::getInstance(); $registry->set('config', $config); // // initialize the Zend Application require_once 'Zend/Application.php'; $application = new Zend_Application(Glo_Environment::get(), APPLICATION_PATH . '/configs/application.ini'); // // register the database configuration $bootstrap = $application->getBootstrap(); $bootstrap->bootstrap('multidb'); $resource = $bootstrap->getResource('multidb'); Zend_Registry::set("conn_read", $resource->getDb('read')); Zend_Registry::set("conn_read_volatile", $resource->getDb('read_volatile')); Zend_Registry::set("conn_write", $resource->getDb('write')); return $application; }
protected function setUp() { parent::setUp(); $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application->getBootstrap()->bootstrap(); $this->_form = new Student_Form_CreateStudentProfile(); }
public function setUp() { parent::setUp(); $app = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $app->getBootstrap()->bootstrap(); $this->_form = new Student_Form_UpdateProfile(); }
protected function getInternalDomains() { $router = $this->bootstrap->getBootstrap()->getResource('frontcontroller')->getRouter(); $this->domainCollector = []; $this->addInternalDomainsFromRoutes($router->getRoutes()); return array_unique($this->domainCollector); }
function restoreDBFromBackup() { makeRed("Restore Database? WARNING: This will drop all tables and restore data to last backup!"); echo "(Y/N): "; $data = FOPEN("php://stdin", "rb"); $input = ''; while (1 == 1) { $chunk = FREAD($data, 1); if ($chunk == "\n" || $chunk == "\r") { break; } $input .= $chunk; } FCLOSE($data); if (strtolower(@$input) == 'y') { echo "Getting Credentials from application.ini...\n"; $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $bootstrap = $application->getBootstrap(); $options = $bootstrap->getOptions(); $db = $options['resources']['db']['params']; echo "Database Restoring. Please be patient, this could take a while..."; sleep(1); echo "."; sleep(1); echo "."; sleep(1); echo "."; echo "\n"; exec("mysql -u " . $db['username'] . " -p" . $db['password'] . " " . $db['dbname'] . " < " . APPLICATION_PATH . "/../data/dbbackup.sql", $output); makeGreen("DONE!"); echo "\n\n"; } else { echo "Operation Cancelled.\n"; } }
public function init() { // Define some CLI options $getopt = new Zend_Console_Getopt(array('withdata|w' => 'Load database with sample data', 'env|e-s' => 'Application environment for which to create database (defaults to development)', 'help|h' => 'Help -- usage message')); try { $getopt->parse(); } catch (Zend_Console_Getopt_Exception $e) { // Bad options passed: report usage echo $e->getUsageMessage(); return false; } // Initialize Zend_Application $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); // Initialize and retrieve DB resource $bootstrap = $application->getBootstrap(); $bootstrap->bootstrap('db'); $dbAdapter = $bootstrap->getResource('db'); // let the user know whats going on (we are actually creating a // database here) if ('testing' != APPLICATION_ENV) { echo 'Writing Database Guestbook in (control-c to cancel): ' . PHP_EOL; for ($x = 5; $x > 0; $x--) { echo $x . "\r"; sleep(1); } } vd(1); }
public function setUp() { include APPLICATION_PATH . '/../scripts/load.sqlite.php'; $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $this->bootstrap = array($application->getBootstrap(), 'bootstrap'); return parent::setUp(); }
protected function setUp() { parent::setUp(); $app = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . "/configs/application.ini"); $app->bootstrap('translate'); $this->translate = $app->getBootstrap()->getResource('translate'); $this->translate->setLocale(new Zend_Locale('vi_VN')); }
public static function bootstrap($resource = null) { include_once 'Zend/Loader/Autoloader.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('Saffron_'); $application = new Zend_Application(self::_getEnv(), self::_getConfig()); return $application->getBootstrap()->bootstrap($resource); }
public function setUp() { include APPLICATION_PATH . '/../scripts/load.sqlite.php'; $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $bootstrap = $application->getBootstrap(); $bootstrap->bootstrap('autoload'); $bootstrap->bootstrap('db'); $this->guestbook = new Model_Guestbook(); }
public function __construct(\Zend_Application $application) { parent::__construct(); $this->_application = $application; $this->_bootstrap = $application->getBootstrap(); $this->_angel_bootstrap = $this->_bootstrap->getResource('modules')->offsetGet('angel'); $this->_container = $this->_bootstrap->getResource('serviceContainer'); $this->_documentManager = $this->_angel_bootstrap->getResource('mongoDocumentManager'); $this->_logger = $this->_bootstrap->getResource('logger'); }
public static function getResource($resourceName, $moduleName = '') { $front = Zend_Controller_Front::getInstance(); $boot = $front->getParam('bootstrap'); if (empty($boot)) { $application = new Zend_Application(APPLICATION_ENV, CONFIG_PATH . '/' . APPLICATION_CONFIG_FILENAME); if (empty($moduleName)) { $application->getBootstrap()->bootstrap($resourceName); return $application->getBootstrap()->getResource($resourceName); } else { $application->getBootstrap()->bootstrap('modules'); return $application->getBootstrap()->getResource('modules')->offsetGet($moduleName)->getResource($resourceName); } } else { if (empty($moduleName)) { return $front->getParam('bootstrap')->getResource($resourceName); } else { return $front->getParam('bootstrap')->getResource('modules')->offsetGet($moduleName)->getResource($resourceName); } } }
public function doRequest($request) { // redirector should not exit $redirector = \Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $redirector->setExit(false); // json helper should not exit $json = \Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $zendRequest = new \Zend_Controller_Request_HttpTestCase(); $zendRequest->setMethod($request->getMethod()); $zendRequest->setCookies($request->getCookies()); //$zendRequest->setParams($request->getParameters()); if (strtoupper($request->getMethod()) == 'GET') { $_GET = $this->remapRequestParameters($request->getParameters()); } if (strtoupper($request->getMethod()) == 'POST') { $_POST = $this->remapRequestParameters($request->getParameters()); } $zendRequest->setRequestUri(str_replace('http://localhost', '', $request->getUri())); $zendRequest->setHeaders($request->getServer()); $_FILES = $this->remapFiles($request->getFiles()); // это нужно для нормальной работы SE $_SERVER['HTTP_HOST'] = str_replace('http://', '', $this->host); if (isset($_SERVER['HTTP_REFERER'])) { $_SERVER['HTTP_REFERER'] = str_replace('http://localhost', '', $_SERVER['HTTP_REFERER']); } //$_SERVER['SERVER_SOFTWARE'] = ''; $_SERVER['REQUEST_METHOD'] = strtoupper($request->getMethod()); $_SERVER['REQUEST_URI'] = str_replace('http://localhost', '', $request->getUri()); $zendResponse = new \Zend_Controller_Response_Http(); $this->bootstrap->getBootstrap()->getContainer()->frontcontroller->setRequest($zendRequest)->setResponse($zendResponse); ob_start(); $this->bootstrap->run(); ob_end_clean(); $this->zendRequest = $zendRequest; $headers['Content-type'] = "text/html; charset=UTF-8"; $response = new Response($zendResponse->getBody(), $zendResponse->getHttpResponseCode(), $headers); return $response; }
public function _after(\Codeception\TestCase $test) { $_SESSION = array(); $_GET = array(); $_POST = array(); $_COOKIE = array(); $this->front = $this->bootstrap->getBootstrap()->getContainer()->frontcontroller->resetInstance(); \Zend_Layout::resetMvcInstance(); \Zend_Controller_Action_HelperBroker::resetHelpers(); \Zend_Session::$_unitTestEnabled = true; $this->queries = 0; $this->time = 0; }
public static function bootstrap($resource = null) { include_once 'Zend/Loader/Autoloader.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('Vslice_'); $autoloader->registerNamespace('ZFDebug'); // $autoloader->registerNamespace('Bvb'); $autoloader->registerNamespace('My'); $autoloader->registerNamespace('F5'); $autoloader->registerNamespace('Zendx'); $options = array('jquery_path' => 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js', 'plugins' => array('Variables', 'Html', 'File' => array('base_path' => '/Library/WebServer/Documents/'), 'Memory', 'Time', 'Exception')); $debug = new ZFDebug_Controller_Plugin_Debug($options); $application = new Zend_Application(self::_getEnv(), self::_getConfig()); return $application->getBootstrap()->bootstrap($resource); }
public function setUp() { parent::setUp(); $config = new \Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', null, true); $system_ini = new \Zend_Config_Ini('/var/yujiaqu.ini'); $config->merge($system_ini); $application = new Zend_Application(APPLICATION_ENV, $config->get(APPLICATION_ENV)); $application->bootstrap(); $this->_bootstrap = $application->getBootstrap(); // manually init Zend_Controller_Front, otherwise, it is not inited in testing environment $this->_bootstrap->getResource('FrontController')->setParam('bootstrap', $this->_bootstrap); $this->_angel_bootstrap = $this->_bootstrap->getResource('modules')->offsetGet('angel'); $this->_container = $this->_bootstrap->getResource('serviceContainer'); $this->_documentManager = $this->_angel_bootstrap->getResource('mongoDocumentManager'); $this->_logger = $this->_bootstrap->getResource('logger'); }
public function _after(\Codeception\TestCase $test) { $_SESSION = []; $_GET = []; $_POST = []; $_COOKIE = []; if ($this->bootstrap) { $fc = $this->bootstrap->getBootstrap()->getResource('frontcontroller'); if ($fc) { $fc->resetInstance(); } } \Zend_Layout::resetMvcInstance(); \Zend_Controller_Action_HelperBroker::resetHelpers(); \Zend_Session::$_unitTestEnabled = true; $this->queries = 0; $this->time = 0; }
} // If help requested, report usage message if ($getopt->getOption('h')) { echo $getopt->getUsageMessage(); return true; } // Initialize values based on presence or absence of CLI options $withData = $getopt->getOption('w'); $withBuffer = $getopt->getOption('b'); $withDevs = $getopt->getOption('d'); $env = $getopt->getOption('e'); defined('APPLICATION_ENV') || define('APPLICATION_ENV', null === $env ? 'development' : $env); // Initialize Zend_Application $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); // Initialize and retrieve DB resource $bootstrap = $application->getBootstrap(); $bootstrap->bootstrap('db'); $dbAdapter = $bootstrap->getResource('db'); // let the user know whats going on (we are actually creating a // database here) /* if ('testing' != APPLICATION_ENV) { echo 'Writing Database Guestbook in (control-c to cancel): ' . PHP_EOL; for ($x = 5; $x > 0; $x--) { echo $x . "\r"; sleep(1); } } */ // Check to see if we have a database file already $options = $bootstrap->getOption('resources'); $dbFile = $options['db']['params']['dbname'];
/** * @group ZF-8193 */ public function testWhenApplicationObjectUsedAsBootstrapTestCaseShouldExecuteBootstrapRunMethod() { require_once 'Zend/Application.php'; $application = new Zend_Application('testing', array('resources' => array('frontcontroller' => array('controllerDirectory' => dirname(__FILE__) . '/_files/application/controllers')))); $this->testCase->bootstrap = $application; $this->testCase->bootstrap(); $this->testCase->dispatch('/'); $front = $application->getBootstrap()->getResource('frontcontroller'); $boot = $front->getParam('bootstrap'); $type = is_object($boot) ? get_class($boot) : gettype($boot); $this->assertTrue($boot === $this->testCase->bootstrap->getBootstrap(), $type); }
<?php /** * Doctrine CLI script * * @author Juozas Kaziukenas (juozas@juokaz.com) */ define('APPLICATION_ENV', 'development'); define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), './', get_include_path()))); require_once 'Zend/Application.php'; // Create application, bootstrap, and run $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application->getBootstrap()->bootstrap('doctrine'); // set aggressive loading to make sure migrations are working Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_AGGRESSIVE); $options = $application->getBootstrap()->getOptions(); $cli = new Doctrine_Cli($options['doctrine']); $cli->run($_SERVER['argv']);
exit; } if (isset($opts->app_env)) { defined('APPLICATION_ENV') || define('APPLICATION_ENV', $opts->app_env); } else { echo "\n\nParametr app_env jest wymagany!"; echo "\n\n" . $opts->getUsageMessage() . "\n\n"; exit; } /** Zend_Application */ require_once 'Zend/Application.php'; // Create application, bootstrap, and run $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); Base_Controller_Action_Helper_Currentip::$_unitTestEnabled = true; $application->bootstrap(); Zend_Controller_Front::getInstance()->setParam('bootstrap', $application->getBootstrap()); $user = $application->getOption('bin'); if ($user['user'] === null || $user['branch'] === null) { throw new Exception('Brak ustawień w application.ini bin.user lub bin.branch'); } $u = new User(); $u_data = $u->fetchRow("login = '******'user'] . "'", "id DESC"); if (null == $u_data) { throw new Exception('Brak użytkownika o podanym loginie ' . $user['user']); } $u_data->toArray(); $storageRow = new stdClass(); foreach ($u_data as $key => $value) { $storageRow->{$key} = $value; } $auth = Zend_Auth::getInstance();
/** * Setup application * * @param mixed $appPath Path to application root * @param array $options Options to setup application * @access public * @return Zend_Application Application */ public static function app($appPath, array $options = array()) { defined('GENE_APP_PATH') || define('GENE_APP_PATH', $appPath); defined('GENE_LIB_PATH') || define('GENE_LIB_PATH', dirname(__FILE__)); self::$_appPath = GENE_APP_PATH; if (!isset($options['ini'])) { $options['ini'] = rtrim(GENE_APP_PATH, '\\/') . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.ini'; } if (!isset($options['env'])) { $options['env'] = 'production'; } self::$_env = $options['env']; require_once 'Zend/Application.php'; $app = new Zend_Application($options['env'], $options['ini']); $autoloader = $app->getAutoloader(); $autoloader->setFallbackAutoloader(true)->suppressNotFoundWarnings(false); $app->getBootstrap()->setAppPath($appPath); if (isset($options['config'])) { $app->setConfigPath($options['config']); } $resources = null; if (isset($options['resources'])) { $resources = $options['resources']; } $bootstrap = $app->getBootstrap()->bootstrap($resources); $params = $bootstrap->getParams(); self::$_params = $params; return $app; }
<?php // Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/..')); if (isset($_SERVER['argv'][2]) && $_SERVER['argv'][2] != '') { switch ($_SERVER['argv'][2]) { case "test": define('APPLICATION_ENV', 'testing'); break; case "dev": define('APPLICATION_ENV', 'development'); break; case "prod": define('APPLICATION_ENV', 'production'); break; } } // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'doctrineCLI'); // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path()))); /** Zend_Application */ require_once 'Zend/Application.php'; // Create application, bootstrap, and run $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application->getBootstrap()->bootstrap('doctrine'); $config = $application->getOption('doctrine'); $cli = new Doctrine_Cli($config); $cli->run($_SERVER['argv']);
/** * @group ZF-6618 */ public function testCanExecuteBoostrapResourceViaApplicationInstanceBootstrapMethod() { $application = new Zend_Application('testing', array('bootstrap' => array('path' => dirname(__FILE__) . '/_files/ZfAppBootstrap.php', 'class' => 'ZfAppBootstrap'))); $application->bootstrap('foo'); $this->assertEquals(1, $application->getBootstrap()->fooExecuted); $this->assertEquals(0, $application->getBootstrap()->barExecuted); }
public function setBootstrap($bootstrap) { $this->bootstrap = $bootstrap; $this->front = $this->bootstrap->getBootstrap()->getResource('frontcontroller'); $this->front->throwExceptions(true)->returnResponse(false); }
} $loader = Zend_Loader_Autoloader::getInstance(); $env = getenv('APPLICATION_ENV'); if (!$env) { $env = 'production'; } defined('APPLICATION_ENV') || define('APPLICATION_ENV', $env); /** * initialize Zend_Application */ $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $loader->registerNamespace('Iron_'); /** * bootstrap and retrive the frontController resource */ $front = $application->getBootstrap()->bootstrap(array('frontController'))->getResource('frontController'); $request = new Zend_Controller_Request_Simple('index', 'dummy', 'default'); /** * set front controller options to make everything operational from CLI */ $front->setRequest($request)->setRouter(new Iron_Controller_Router_Cli())->setResponse(new Zend_Controller_Response_Cli())->throwExceptions(true); /** * lets bootstrap our application and enjoy! */ class DummyController extends Zend_Controller_Action { public function indexAction() { $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout()->disableLayout(); }
<?php error_reporting(E_ALL | E_STRICT); // Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application')); // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'); // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path()))); /** Zend_Application */ require_once 'Zend/Application.php'; require_once 'Zend/Config.php'; require_once 'Zend/Config/Ini.php'; require_once 'ControllerTestCase.php'; $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application->getBootstrap()->bootstrap("doctrine"); $cli = new Doctrine_Cli($application->getOption('doctrine')); @$cli->run(array("doctrine", "drop-db", "force")); @$cli->run(array("doctrine", "generate-models-yaml", "force")); @$cli->run(array("doctrine", "create-db", "force")); @$cli->run(array("doctrine", "create-tables", "force")); $cli->run(array("doctrine", "load-data", "force"));
* Foundation; either version 2 of the Licence, or any later version. * OPUS is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. You should have received a copy of the GNU General Public License * along with OPUS; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * @category Application * @author Pascal-Nicolas Becker <*****@*****.**> * @author Ralf Claussnitzer <*****@*****.**> * @author Thoralf Klein <*****@*****.**> * @author Felix Ostrowski <*****@*****.**> * @copyright Copyright (c) 2009-2010, OPUS 4 development team * @license http://www.gnu.org/licenses/gpl.html General Public License * @version $Id$ */ // Configure include path. set_include_path(implode(PATH_SEPARATOR, array('.', dirname(__FILE__), dirname(dirname(dirname(__FILE__))) . '/library', dirname(dirname(dirname(__FILE__))) . '/vendor', get_include_path()))); // Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(dirname(dirname(__FILE__))))); // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'); require_once 'autoload.php'; // environment initializiation $application = new Zend_Application(APPLICATION_ENV, array("config" => array(APPLICATION_PATH . '/application/configs/application.ini', APPLICATION_PATH . '/application/configs/config.ini'))); // Bootstrapping application $application->bootstrap('Backend'); // Bootstrapping modules $application->getBootstrap()->getPluginResource('modules')->init();
/** * bootstrap application */ public function appBootstrap() { $this->_application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $this->_application->bootstrap(); /* * Fix for ZF-8193 * http://framework.zend.com/issues/browse/ZF-8193 * Zend_Controller_Action->getInvokeArg('bootstrap') doesn't work * under the unit testing environment. */ $front = Zend_Controller_Front::getInstance(); if ($front->getParam('bootstrap') === null) { $front->setParam('bootstrap', $this->_application->getBootstrap()); } }