diff --git a/application/bootstrap.php b/application/bootstrap.php index 0d1c0a9..59d716b 100644 --- a/application/bootstrap.php +++ b/application/bootstrap.php @@ -60,7 +60,7 @@ ini_set('unserialize_callback_func', 'spl_autoload_call'); /** * Enable modules. Modules are referenced by a relative or absolute path. */ -Kohana::modules([ +$modules = [ 'application' => APPPATH, // Main application module 'auth' => $vendor_path.'kohana/auth', // Basic authentication 'cache' => $vendor_path.'kohana/cache', // Caching with multiple backends @@ -70,14 +70,19 @@ Kohana::modules([ 'minion' => $vendor_path.'kohana/minion', // CLI Tasks 'orm' => $vendor_path.'kohana/orm', // Object Relationship Mapping //'unittest' => $vendor_path.'kohana/unittest', // Unit testing - //'userguide' => $vendor_path.'kohana/userguide', // User guide and API documentation 'kostache' => $vendor_path.'zombor/kostache', // Logic-less Mustache views 'email' => $vendor_path.'tscms/email',// Electronic mail class 'debug-toolbar' => MODPATH.'debug-toolbar', // Debug toolbar 'config-writer' => MODPATH.'config-writer', // Write to PHP configs 'migrations' => MODPATH.'migrations', // SQL migrations 'core' => SYSPATH, // Core system -]); +]; +if (Kohana::$environment === Kohana::DEVELOPMENT) +{ + $modules['userguide'] = $vendor_path.'kohana/userguide'; // User guide and API documentation +} +Kohana::modules($modules); +unset($modules); /** * Set the default language */ diff --git a/application/classes/Task/Password.php b/application/classes/Task/Password.php index 4329a74..65ce69d 100644 --- a/application/classes/Task/Password.php +++ b/application/classes/Task/Password.php @@ -8,10 +8,10 @@ **/ class Task_Password extends Minion_Task { - protected $_options = array( + protected $_options = [ 'user' => 'admin', 'password' => NULL, - ); + ]; public function build_validation(Validation $validation) { @@ -22,15 +22,18 @@ class Task_Password extends Minion_Task /** * This is an admin password task * - * @return null + * @return void */ - protected function _execute(array $params) + protected function _execute() { + $params = $this->get_options(); $writer = new Config_File_Writer; Kohana::$config->attach($writer); $config = Kohana::$config->load('auth'); $hash = hash_hmac($config->get('hash_method'), $params['password'], $config->get('hash_key')); - $config->set('users', array($params['user'] => $hash)); + $users = $config->get('users'); + $users[$params['user']] = $hash; + $config->set('users', $users); Kohana::$config->detach($writer); echo __('The password was successfully changed.'); } diff --git a/application/config/url.php b/application/config/url.php new file mode 100644 index 0000000..bf3c7d3 --- /dev/null +++ b/application/config/url.php @@ -0,0 +1,7 @@ + [ + 'localhost', + 'courses.reiki42.ru', + ], +];