Criação da estrutura de diretórios para as configurações do sistema conforme padrão de Arquitetura de aplicativos do Zend Framework. Construtor de arquivos de configuração e tratamento de tipo de adaptador de banco de dados, dando suporte somente ao MySQL e PostgreSQL. Arquivo de saída de dados para configuração do aplicativo. Arquivo de Bootstrap do aplicativo Zend Framework.
Esse commit está contido em:
@@ -126,6 +126,8 @@ class Mimoza extends Module implements Module_Interface
|
||||
{
|
||||
$htaccess = $this->getProject()->buildHtaccess(null);
|
||||
$this->getFramework()->mkFile('project/public/.htaccess', $htaccess);
|
||||
$configuration = $this->getProject()->buildConfiguration(null);
|
||||
$this->getFramework()->mkFile('project/application/configs/application.ini', $configuration);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
Mimoza_Loader::loadClass('Mimoza_Builder');
|
||||
|
||||
/**
|
||||
*
|
||||
* Arquivo de Configuração do Aplicativo Zend Framework
|
||||
* @author Wanderson Henrique Camargo Rosa
|
||||
*
|
||||
*/
|
||||
class Builder_Configuration extends Mimoza_Builder
|
||||
{
|
||||
public function build($element)
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$mind = $project->getMindProject();
|
||||
|
||||
$this->adapter = $this->convertPdo($mind->dbms);
|
||||
|
||||
$this->production = array(
|
||||
'host' => $mind->environment['production']['dbAddress'],
|
||||
'dbname' => $mind->environment['production']['dbName'],
|
||||
'username' => $mind->environment['production']['user'],
|
||||
'password' => $mind->environment['production']['userPwd'],
|
||||
);
|
||||
|
||||
$this->development = array(
|
||||
'host' => $mind->environment['development']['dbAddress'],
|
||||
'dbname' => $mind->environment['development']['dbName'],
|
||||
'username' => $mind->environment['development']['user'],
|
||||
'password' => $mind->environment['development']['userPwd'],
|
||||
);
|
||||
|
||||
return $this->render('configuration.phtml');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Conversão de Tipo de Banco de Dados
|
||||
* @param string $source Nome de Banco de Dados do Webmind
|
||||
* @return string Nome de Adaptador de Banco de Dados do Zend Framework
|
||||
*/
|
||||
public function convertPdo($source)
|
||||
{
|
||||
$adapter = null;
|
||||
switch(strtolower($source)) {
|
||||
case 'mysql':
|
||||
$adapter = 'pdo_mysql';
|
||||
break;
|
||||
case 'postgresql':
|
||||
$adapter = 'pdo_pgsql';
|
||||
break;
|
||||
}
|
||||
return $adapter;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
// 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') : 'production'));
|
||||
|
||||
// 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
|
||||
try {
|
||||
$application = new Zend_Application(
|
||||
APPLICATION_ENV,
|
||||
APPLICATION_PATH . '/configs/application.ini'
|
||||
);
|
||||
$application->bootstrap()->run();
|
||||
} catch (Exception $e) {
|
||||
header('Content-type: text/plain');
|
||||
echo $e;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
[production]
|
||||
phpSettings.display_startup_errors = 0
|
||||
phpSettings.display_errors = 0
|
||||
autoloaderNamespaces[] = "System_"
|
||||
includePaths.library = APPLICATION_PATH "/../library"
|
||||
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
|
||||
bootstrap.class = "Bootstrap"
|
||||
appnamespace = "Application"
|
||||
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
resources.db.adapter = "<?php echo $this->adapter ?>"
|
||||
resources.db.params.host = "<?php echo $this->production['host'] ?>"
|
||||
resources.db.params.username = "<?php echo $this->production['username'] ?>"
|
||||
resources.db.params.password = "<?php echo $this->production['password'] ?>"
|
||||
resources.db.params.dbname = "<?php echo $this->production['dbname'] ?>"
|
||||
resources.db.isDefaultTableAdapter = "true"
|
||||
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
|
||||
resources.locale.default = "pt_BR"
|
||||
resources.locale.force = true
|
||||
|
||||
[development : production]
|
||||
phpSettings.display_startup_errors = 1
|
||||
phpSettings.display_errors = 1
|
||||
resources.frontController.params.displayExceptions = 1
|
||||
resources.db.params.host = "<?php echo $this->development['host'] ?>"
|
||||
resources.db.params.username = "<?php echo $this->development['username'] ?>"
|
||||
resources.db.params.password = "<?php echo $this->development['password'] ?>"
|
||||
resources.db.params.dbname = "<?php echo $this->development['dbname'] ?>"
|
||||
Referência em uma Nova Issue
Bloquear um usuário