当前位置: 首页>>代码示例>>PHP>>正文


PHP Minion_CLI::read方法代码示例

本文整理汇总了PHP中Minion_CLI::read方法的典型用法代码示例。如果您正苦于以下问题:PHP Minion_CLI::read方法的具体用法?PHP Minion_CLI::read怎么用?PHP Minion_CLI::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Minion_CLI的用法示例。


在下文中一共展示了Minion_CLI::read方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute(array $options)
 {
     if ($options['force'] === NULL or 'yes' === Minion_CLI::read('This will destroy all data in the current database. Are you sure? [yes/NO]')) {
         Minion_CLI::write('Dropping Tables', 'green');
         $migrations = new Migrations(array('log' => 'Minion_CLI::write'));
         $migrations->clear_all();
         Minion_Task::factory('db:migrate')->execute($options);
     } else {
         Minion_CLI::write('Nothing done', 'brown');
     }
 }
开发者ID:roissard,项目名称:timestamped-migrations,代码行数:11,代码来源:recreate.php

示例2: execute

 public function execute(array $options)
 {
     $db = $this->db_params($options['database']);
     $file = $options['file'] ? $options['file'] : Kohana::$config->load("migrations.path") . DIRECTORY_SEPARATOR . 'schema.sql';
     if ($options['force'] === NULL or 'yes' === Minion_CLI::read("This will destroy database " . $db['database'] . " Are you sure? [yes/NO]")) {
         $command = strtr("mysql -u:username -p:password :database < :file ", array(':username' => $db['username'], ':password' => $db['password'], ':database' => $db['database'], ':file' => $file));
         Minion_CLI::write('Loading data from ' . Debug::path($file) . ' to ' . $db['database'], 'green');
         system($command);
     } else {
         Minion_CLI::write('Nothing done', 'brown');
     }
 }
开发者ID:roissard,项目名称:timestamped-migrations,代码行数:12,代码来源:load.php

示例3: _execute

 protected function _execute(array $params)
 {
     if ($params['db_driver'] === NULL) {
         $params['db_driver'] = Minion_CLI::read(__('Please enter database driver (:types)', array(':types' => implode(', ', array_keys($this->_installer->database_drivers())))));
     }
     if ($params['locale'] === NULL) {
         $params['locale'] = Minion_CLI::read(__('Please enter locale (:types)', array(':types' => implode(', ', array_keys(I18n::available_langs())))));
     }
     if ($params['db_name'] === NULL) {
         $params['db_name'] = Minion_CLI::read(__('Please enter database name'));
     }
     if ($params['timezone'] === NULL) {
         $answer = Minion_CLI::read(__('Select current timezone automaticly (:current)', array(':current' => date_default_timezone_get())), array('y', 'n'));
         if ($answer == 'y') {
             $params['timezone'] = date_default_timezone_get();
         } else {
             $params['timezone'] = Minion_CLI::read(__('Please enter current timezone (:site)', array(':site' => 'http://www.php.net/manual/en/timezones.php')), DateTimeZone::listIdentifiers());
         }
     }
     if ($params['cache_type'] === NULL) {
         $params['cache_type'] = Minion_CLI::read(__('Please enter cache type (:types)', array(':types' => implode(', ', array_keys($this->_installer->cache_types())))));
     }
     if ($params['session_type'] === NULL) {
         $session_types = Kohana::$config->load('installer')->get('session_types', array());
         $params['session_type'] = Minion_CLI::read(__('Please enter session type (:types)', array(':types' => implode(', ', array_keys($this->_installer->session_types())))));
     }
     if ($params['password'] !== NULL) {
         unset($params['password_generate']);
         $params['password_field'] = $params['password_confirm'] = $params['password'];
     }
     try {
         $this->_installer->install($params);
         Observer::notify('after_install', $params);
         Cache::clear_file();
         Minion_CLI::write('==============================================');
         Minion_CLI::write(__('KodiCMS installed successfully'));
         Minion_CLI::write('==============================================');
         $install_data = Session::instance()->get_once('install_data');
         Minion_CLI::write(__('Login: :login', array(':login' => Arr::get($install_data, 'username'))));
         Minion_CLI::write(__('Password: :password', array(':password' => Arr::get($install_data, 'password_field'))));
     } catch (Exception $e) {
         Minion_CLI::write(__(':text | :file [:line]', array(':text' => $e->getMessage(), ':file' => $e->getFile(), ':line' => $e->getLine())));
     }
 }
开发者ID:ortodesign,项目名称:cms,代码行数:44,代码来源:install.php

示例4: _execute

 protected function _execute(array $params)
 {
     if ($params['type'] === NULL) {
         $params['type'] = Minion_CLI::read(__('Please enter cache type foe clear (:types)', array(':types' => implode(', ', array('all', 'file', 'routes', 'profiler', CACHE_TYPE)))));
     }
     switch ($params['type']) {
         case 'file':
             Cache::clear_file();
             break;
         case 'routes':
             Cache::clear_routes();
             break;
         case 'profiler':
             Cache::clear_profiler();
             break;
         case CACHE_TYPE:
             Cache::instance()->delete_all();
             break;
         default:
             Cache::clear_all();
             break;
     }
     Minion_CLI::write('============ Cache ' . $params['type'] . ' cleared ==========');
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:24,代码来源:clear.php

示例5: wait

 /**
  * Waits a certain number of seconds, optionally showing a wait message and
  * waiting for a key press.
  *
  * @author     Fuel Development Team
  * @license    MIT License
  * @copyright  2010 - 2011 Fuel Development Team
  * @link       http://fuelphp.com
  * @param int $seconds number of seconds
  * @param bool $countdown show a countdown or not
  */
 public static function wait($seconds = 0, $countdown = false)
 {
     if ($countdown === true) {
         $time = $seconds;
         while ($time > 0) {
             fwrite(STDOUT, $time . '... ');
             sleep(1);
             $time--;
         }
         Minion_CLI::write();
     } else {
         if ($seconds > 0) {
             sleep($seconds);
         } else {
             Minion_CLI::write(Minion_CLI::$wait_msg);
             Minion_CLI::read();
         }
     }
 }
开发者ID:chernogolov,项目名称:blank,代码行数:30,代码来源:CLI.php

示例6: read

 /**
  * Reads input from the user. This can have either 1 or 2 arguments.
  *
  * Usage:
  *
  * // Waits for any key press
  * Minion_CLI::read();
  *
  * // Takes any input
  * $color = Minion_CLI::read('What is your favorite color?');
  *
  * // Will only accept the options in the array
  * $ready = Minion_CLI::read('Are you ready?', array('y','n'));
  *
  * @param  string $text    text to show user before waiting for input
  * @param  array  $options array of options the user is shown
  *
  * @return string  the user input
  */
 public static function read($text = '', array $options = null)
 {
     // If a question has been asked with the read
     $options_output = '';
     if (!empty($options)) {
         $options_output = ' [ ' . implode(', ', $options) . ' ]';
     }
     fwrite(STDOUT, $text . $options_output . ': ');
     // Read the input from keyboard.
     $input = trim(fgets(STDIN));
     // If options are provided and the choice is not in the array, tell them to try again
     if (!empty($options) && !in_array($input, $options)) {
         Minion_CLI::write('This is not a valid option. Please try again.');
         $input = Minion_CLI::read($text, $options);
     }
     // Read the input
     return $input;
 }
开发者ID:s4urp8n,项目名称:kohana-admin,代码行数:37,代码来源:CLI.php


注:本文中的Minion_CLI::read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。