From 835d3c45ad9978ffad6bee73e5d3ee2e839cdd03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D1=83=D0=B4?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D1=86?= <andrey.rudenets@gmail.com> Date: Tue, 26 Aug 2014 12:17:18 +0400 Subject: [PATCH] =?UTF-8?q?1.=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BD=D0=B5=D0=BE=D0=B1=D1=85=D0=BE=D0=B4=D0=B8=D0=BC?= =?UTF-8?q?=D1=8B=D1=85=20=D0=B4=D0=B8=D1=80=D0=B5=D0=BA=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D0=B9=20=D0=BF=D1=80=D0=B8=20=D0=B8=D1=85=20=D0=BE=D1=82?= =?UTF-8?q?=D1=81=D1=83=D1=82=D1=81=D1=82=D0=B2=D0=B8=D0=B8,=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D0=B8=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=B4=D0=B5=D0=BF=D0=BB=D0=BE=D1=8F=20=D0=B8=20=D0=B8=D1=85=20?= =?UTF-8?q?=D0=B0=D0=B2=D1=82=D0=BE=D0=BA=D0=BE=D0=BF=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B2=20config=20=D0=B2=20?= =?UTF-8?q?=D1=82=D0=BE=D0=BC=20=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B5,=20?= =?UTF-8?q?=D0=B5=D1=81=D0=BB=D0=B8=20=D0=B4=D0=BE=20=D1=8D=D1=82=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=BF=D0=B0=D0=BF=D0=BA=D0=B8=20config=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D0=B1=D1=8B=D0=BB=D0=BE=202.=20=D0=9F=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=B5=D0=B7=D0=B4=20=D0=BA=D1=8D=D1=88=D0=B0=20=D1=88?= =?UTF-8?q?=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=D0=B8=D0=B7=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B0=20Twig=20=D0=B8=D0=B7=20TWIGPATH/cache=20=D0=B2=20?= =?UTF-8?q?APPPATH/cache/twig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ~dev_rating/deploy.php | 21 +++++++++++++++++++ .../config => deployConfig}/database.php | 6 +++--- .../config => deployConfig}/security.php | 0 .../config => deployConfig}/twig.php | 2 +- ~dev_rating/index.php | 20 +++++++++++++++++- .../modules/kotwig/cache/deleteThis.php | 8 ------- 6 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 ~dev_rating/deploy.php rename ~dev_rating/{application/config => deployConfig}/database.php (85%) rename ~dev_rating/{application/config => deployConfig}/security.php (100%) rename ~dev_rating/{application/config => deployConfig}/twig.php (94%) delete mode 100644 ~dev_rating/modules/kotwig/cache/deleteThis.php diff --git a/~dev_rating/deploy.php b/~dev_rating/deploy.php new file mode 100644 index 000000000..bd691ffee --- /dev/null +++ b/~dev_rating/deploy.php @@ -0,0 +1,21 @@ +<?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 diff --git a/~dev_rating/application/config/database.php b/~dev_rating/deployConfig/database.php similarity index 85% rename from ~dev_rating/application/config/database.php rename to ~dev_rating/deployConfig/database.php index 122322b06..2636e3a2f 100644 --- a/~dev_rating/application/config/database.php +++ b/~dev_rating/deployConfig/database.php @@ -13,9 +13,9 @@ return array * string password database password * boolean persistent use persistent connections? */ - 'dsn' => 'mysql:host=localhost;dbname=kohana_new_db', - 'username' => 'root', - 'password' => '', + 'dsn' => 'mysql:host=localhost;dbname=mmcs_rating', + 'username' => 'mmcs_rating', + 'password' => 'Pefnesdy', 'persistent' => FALSE, 'options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8') ), diff --git a/~dev_rating/application/config/security.php b/~dev_rating/deployConfig/security.php similarity index 100% rename from ~dev_rating/application/config/security.php rename to ~dev_rating/deployConfig/security.php diff --git a/~dev_rating/application/config/twig.php b/~dev_rating/deployConfig/twig.php similarity index 94% rename from ~dev_rating/application/config/twig.php rename to ~dev_rating/deployConfig/twig.php index 7e7ddc2e6..3705682b8 100644 --- a/~dev_rating/application/config/twig.php +++ b/~dev_rating/deployConfig/twig.php @@ -19,7 +19,7 @@ return array( 'auto_reload' => (Kohana::$environment == Kohana::DEVELOPMENT), 'autoescape' => TRUE, 'base_template_class' => 'Twig_Template', - 'cache' => TWIGPATH.'cache', + 'cache' => APPPATH.'cache/twig', 'charset' => 'utf-8', 'optimizations' => -1, 'strict_variables' => FALSE, diff --git a/~dev_rating/index.php b/~dev_rating/index.php index 30b21e52d..82fd3794d 100644 --- a/~dev_rating/index.php +++ b/~dev_rating/index.php @@ -23,6 +23,13 @@ $modules = 'modules'; */ $system = 'system'; +/** + * Директория, в которой содержатся конфиги, используемые при деплое. + * + * @link http://kohanaframework.org/guide/about.install#system + */ +$deployConfig = 'deployConfig'; + /** * The default extension of resource files. If you change this, all resources * must be renamed to use the new extension. @@ -69,13 +76,18 @@ if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules)) if ( ! is_dir($system) AND is_dir(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('APPPATH', realpath($application).DIRECTORY_SEPARATOR); define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR); define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR); +define('CFGPATH', realpath($deployConfig).DIRECTORY_SEPARATOR); // Clean up the configuration vars -unset($application, $modules, $system); +unset($application, $modules, $system, $deployConfig); if (file_exists('install'.EXT)) { @@ -83,6 +95,12 @@ if (file_exists('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. */ diff --git a/~dev_rating/modules/kotwig/cache/deleteThis.php b/~dev_rating/modules/kotwig/cache/deleteThis.php deleted file mode 100644 index 3ac00faa6..000000000 --- a/~dev_rating/modules/kotwig/cache/deleteThis.php +++ /dev/null @@ -1,8 +0,0 @@ -<?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. - */ - -- GitLab