Skip to content
Snippets Groups Projects
Commit 835d3c45 authored by Andrew Rudenets's avatar Andrew Rudenets
Browse files

1. Создание необходимых директорий при их отсутствии, конфиги для деплоя и их...

1. Создание необходимых директорий при их отсутствии, конфиги для деплоя и их автокопирование в config в том случае, если до этого папки config не было
2. Переезд кэша шаблонизатора Twig из TWIGPATH/cache в APPPATH/cache/twig
parent c6402305
Branches
Tags
No related merge requests found
<?php defined('SYSPATH') OR die('No direct access allowed.');
if(!is_dir(APPPATH.'config'))
{
mkdir(APPPATH.'config');
if(!copy(CFGPATH.'database.php', APPPATH.'config/database.php'))
echo 'Беда!';
if(!copy(CFGPATH.'security.php', APPPATH.'config/security.php'))
echo 'Беда!';
if(!copy(CFGPATH.'twig.php', APPPATH.'config/twig.php'))
echo 'Беда!';
}
if(!is_dir(APPPATH.'logs/'))
mkdir(APPPATH.'logs');
if(!is_dir(APPPATH.'cache/'))
{
mkdir(APPPATH.'cache');
mkdir(APPPATH.'cache/twig');
}
\ No newline at end of file
...@@ -13,9 +13,9 @@ return array ...@@ -13,9 +13,9 @@ return array
* string password database password * string password database password
* boolean persistent use persistent connections? * boolean persistent use persistent connections?
*/ */
'dsn' => 'mysql:host=localhost;dbname=kohana_new_db', 'dsn' => 'mysql:host=localhost;dbname=mmcs_rating',
'username' => 'root', 'username' => 'mmcs_rating',
'password' => '', 'password' => 'Pefnesdy',
'persistent' => FALSE, 'persistent' => FALSE,
'options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8') 'options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')
), ),
......
...@@ -19,7 +19,7 @@ return array( ...@@ -19,7 +19,7 @@ return array(
'auto_reload' => (Kohana::$environment == Kohana::DEVELOPMENT), 'auto_reload' => (Kohana::$environment == Kohana::DEVELOPMENT),
'autoescape' => TRUE, 'autoescape' => TRUE,
'base_template_class' => 'Twig_Template', 'base_template_class' => 'Twig_Template',
'cache' => TWIGPATH.'cache', 'cache' => APPPATH.'cache/twig',
'charset' => 'utf-8', 'charset' => 'utf-8',
'optimizations' => -1, 'optimizations' => -1,
'strict_variables' => FALSE, 'strict_variables' => FALSE,
......
...@@ -23,6 +23,13 @@ $modules = 'modules'; ...@@ -23,6 +23,13 @@ $modules = 'modules';
*/ */
$system = 'system'; $system = 'system';
/**
* Директория, в которой содержатся конфиги, используемые при деплое.
*
* @link http://kohanaframework.org/guide/about.install#system
*/
$deployConfig = 'deployConfig';
/** /**
* The default extension of resource files. If you change this, all resources * The default extension of resource files. If you change this, all resources
* must be renamed to use the new extension. * must be renamed to use the new extension.
...@@ -69,13 +76,18 @@ if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules)) ...@@ -69,13 +76,18 @@ if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
if ( ! is_dir($system) AND is_dir(DOCROOT.$system)) if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
$system = DOCROOT.$system; $system = DOCROOT.$system;
// Make the configs relative to the docroot, for symlink'd index.php
if ( ! is_dir($deployConfig) AND is_dir(DOCROOT.$deployConfig))
$deployConfig = DOCROOT.$deployConfig;
// Define the absolute paths for configured directories // Define the absolute paths for configured directories
define('APPPATH', realpath($application).DIRECTORY_SEPARATOR); define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);
define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR); define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR); define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);
define('CFGPATH', realpath($deployConfig).DIRECTORY_SEPARATOR);
// Clean up the configuration vars // Clean up the configuration vars
unset($application, $modules, $system); unset($application, $modules, $system, $deployConfig);
if (file_exists('install'.EXT)) if (file_exists('install'.EXT))
{ {
...@@ -83,6 +95,12 @@ if (file_exists('install'.EXT)) ...@@ -83,6 +95,12 @@ if (file_exists('install'.EXT))
return include 'install'.EXT; return include 'install'.EXT;
} }
if (file_exists('deploy'.EXT))
{
// Load the deploy check
include 'deploy'.EXT;
}
/** /**
* Define the start time of the application, used for profiling. * Define the start time of the application, used for profiling.
*/ */
......
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
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