本文整理汇总了PHP中Zend_Application类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Application类的具体用法?PHP Zend_Application怎么用?PHP Zend_Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restoreDBFromBackup
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";
}
}
示例2: setUp
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();
}
示例3: setUpBeforeClass
/**
* Prepares the environment before running ALL tests.
*/
public static function setUpBeforeClass()
{
// Inicializa o ZF
$inifile = getenv('TRAVIS') !== false ? 'application.travis.ini' : 'application.ini';
$bootstrap = new Zend_Application('testing', TEST_ROOT . '/assets/application/configs/' . $inifile);
$bootstrap->bootstrap();
}
示例4: setUp
public function setUp()
{
$application = new Zend_Application('testing', APPLICATION_PATH . '/configs/application.ini');
$bootstrap = $application->bootstrap()->getBootstrap();
$this->em = $bootstrap->getResource('entityManager');
parent::setUp();
}
示例5: testBootstrap
public function testBootstrap()
{
$application = new Zend_Application('tests', dirname(__FILE__) . '/application.ini');
$rediska = $application->bootstrap()->getBootstrap()->getResource('rediska');
$this->assertType('Rediska', $rediska);
$this->assertEquals('Rediska_Test_', $rediska->getOption('namespace'));
}
示例6: testBootstrap
public function testBootstrap()
{
$application = new Zend_Application('tests', REDISKA_TESTS_PATH . '/Test/Zend/Application/application.ini');
$rediska = $application->bootstrap()->getBootstrap()->getResource('rediska');
$this->assertType('Rediska', $rediska);
$this->assertEquals('Rediska_Test_', $rediska->getOption('namespace'));
}
示例7: getApplication
/**
*
* @return Zend_Application
*/
public static function getApplication()
{
$application = new Zend_Application(APPLICATION_ENV);
$applicationini = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", APPLICATION_ENV);
$options = $applicationini->toArray();
foreach (self::$_ini as $value) {
$iniFile = APPLICATION_PATH . self::$_pathConfig . $value;
if (is_readable($iniFile)) {
$config = new Zend_Config_Ini($iniFile);
$options = $application->mergeOptions($options, $config->toArray());
} else {
throw new Zend_Exception('error en la configuracion de los .ini');
}
}
// foreach (self::$_ini as $value) {
// $iniFile = APPLICATION_PATH . self::$_pathConfig . $value;
//
// if (is_readable($iniFile)) {
// $config = new Zend_Config_Ini($iniFile);
// $options = $application->mergeOptions($options,
// $config->toArray());
// } else {
// throw new Zend_Exception('error en la configuracion de los .ini');
// }
// }
Zend_Registry::set('config', $options);
$a = $application->setOptions($options);
return $application;
}
示例8: init
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);
}
示例9: bootstrap
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;
}
示例10: setUp
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();
}
示例11: 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'));
}
示例12: bootstrap
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);
}
示例13: testNewInstance
public function testNewInstance()
{
$application = new Zend_Application('tests', dirname(__FILE__) . '/application4.ini');
$application->bootstrap()->getBootstrap()->getResource('session');
$rediska = Zend_Session::getSaveHandler()->getRediska();
$this->assertEquals('default', $rediska->getOption('name'));
$this->assertEquals(array(), Rediska_Manager::getAll());
}
示例14: setUp
/**
* Overwrite standard setUp method, no database connection needed. Will
* create a file listing of class files instead.
*
* @return void
*/
public function setUp()
{
require_once 'Zend/Application.php';
set_include_path('../modules' . PATH_SEPARATOR . get_include_path());
// Do test environment initializiation.
$application = new Zend_Application(APPLICATION_ENV, array("config" => array(APPLICATION_PATH . '/application/configs/application.ini', APPLICATION_PATH . '/tests/config.ini')));
$application->bootstrap();
}
示例15: __construct
/**
* Constructor
*
* Invoke setContainerFactory, set _coantainerFactory if factory is configurated
* Ensure FrontController resource is registered
*
* @param Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application
* @return void
*/
public function __construct($application)
{
$this->setContainerFactory($application->getOptions());
parent::__construct($application);
if (!$this->hasPluginResource('FrontController')) {
$this->registerPluginResource('FrontController');
}
}