1
0
Fork 0
mirror of https://github.com/Oreolek/kangana.git synced 2024-06-26 03:40:56 +03:00

minion fixes

This commit is contained in:
Alexander Yakovlev 2016-10-05 08:21:06 +07:00
parent b04489ef94
commit 955a4258ea
3 changed files with 23 additions and 8 deletions

View file

@ -60,7 +60,7 @@ ini_set('unserialize_callback_func', 'spl_autoload_call');
/** /**
* Enable modules. Modules are referenced by a relative or absolute path. * Enable modules. Modules are referenced by a relative or absolute path.
*/ */
Kohana::modules([ $modules = [
'application' => APPPATH, // Main application module 'application' => APPPATH, // Main application module
'auth' => $vendor_path.'kohana/auth', // Basic authentication 'auth' => $vendor_path.'kohana/auth', // Basic authentication
'cache' => $vendor_path.'kohana/cache', // Caching with multiple backends 'cache' => $vendor_path.'kohana/cache', // Caching with multiple backends
@ -70,14 +70,19 @@ Kohana::modules([
'minion' => $vendor_path.'kohana/minion', // CLI Tasks 'minion' => $vendor_path.'kohana/minion', // CLI Tasks
'orm' => $vendor_path.'kohana/orm', // Object Relationship Mapping 'orm' => $vendor_path.'kohana/orm', // Object Relationship Mapping
//'unittest' => $vendor_path.'kohana/unittest', // Unit testing //'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 'kostache' => $vendor_path.'zombor/kostache', // Logic-less Mustache views
'email' => $vendor_path.'tscms/email',// Electronic mail class 'email' => $vendor_path.'tscms/email',// Electronic mail class
'debug-toolbar' => MODPATH.'debug-toolbar', // Debug toolbar 'debug-toolbar' => MODPATH.'debug-toolbar', // Debug toolbar
'config-writer' => MODPATH.'config-writer', // Write to PHP configs 'config-writer' => MODPATH.'config-writer', // Write to PHP configs
'migrations' => MODPATH.'migrations', // SQL migrations 'migrations' => MODPATH.'migrations', // SQL migrations
'core' => SYSPATH, // Core system '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 * Set the default language
*/ */

View file

@ -8,10 +8,10 @@
**/ **/
class Task_Password extends Minion_Task class Task_Password extends Minion_Task
{ {
protected $_options = array( protected $_options = [
'user' => 'admin', 'user' => 'admin',
'password' => NULL, 'password' => NULL,
); ];
public function build_validation(Validation $validation) public function build_validation(Validation $validation)
{ {
@ -22,15 +22,18 @@ class Task_Password extends Minion_Task
/** /**
* This is an admin password 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; $writer = new Config_File_Writer;
Kohana::$config->attach($writer); Kohana::$config->attach($writer);
$config = Kohana::$config->load('auth'); $config = Kohana::$config->load('auth');
$hash = hash_hmac($config->get('hash_method'), $params['password'], $config->get('hash_key')); $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); Kohana::$config->detach($writer);
echo __('The password was successfully changed.'); echo __('The password was successfully changed.');
} }

View file

@ -0,0 +1,7 @@
<?php defined('SYSPATH') OR die('No direct script access.');
return [
'trusted_hosts' => [
'localhost',
'courses.reiki42.ru',
],
];