diff --git a/framework/console/Command.php b/framework/console/Command.php index 6f30231..e2ca243 100644 --- a/framework/console/Command.php +++ b/framework/console/Command.php @@ -304,19 +304,35 @@ abstract class Command extends \yii\base\Component * Reads input via the readline PHP extension if that's available, or fgets() if readline is not installed. * * @param string $message to echo out before waiting for user input + * @param string $default the default string to be returned when user does not write anything. + * Defaults to null, means that default string is disabled. * @return mixed line read as a string, or false if input has been closed */ - public function prompt($message) + public function prompt($message, $default = null) { + if($default !== null) { + $message .= " [$default] "; + } + else { + $message .= ' '; + } + if(extension_loaded('readline')) { - $input = readline($message.' '); - readline_add_history($input); - return $input; - } else - { - echo $message.' '; - return trim(fgets(STDIN)); + $input = readline($message); + if($input) { + readline_add_history($input); + } + } else { + echo $message; + $input = fgets(STDIN); + } + if($input === false) { + return false; + } + else { + $input = trim($input); + return ($input==='' && $default!==null) ? $default : $input; } } diff --git a/todo.md b/todo.md index 867d287..13ced6a 100644 --- a/todo.md +++ b/todo.md @@ -1,11 +1,11 @@ - logging * WebTarget * ProfileTarget - * Toolbar ? - base * error/exception handling * Convert all PHP errors into exceptions, remove YII_ENABLE_ERROR_HANDLER and error handler (?) * module + - Module should be able to define its own configuration including routes. Application should be able to overwrite it. * application * http exception * security @@ -14,7 +14,7 @@ * CompareValidator::clientValidateAttribute(): search for "CHtml::activeId" * FileValidator, UniqueValidator, ExistValidator, DateValidator: TBD * consider merging UniqueValidator and ExistValidator and using a NOT property. -- console command support +- console command support [DONE] - built-in console commands + api doc builder * support for markdown syntax @@ -49,6 +49,7 @@ - web: TBD * get/setFlash() should be moved to session component * support optional parameter in URL patterns + * Response object. - gii * move generation API out of gii, provide yiic commands to use it. Use same templates for gii/yiic. * i18n variant of templates @@ -59,5 +60,9 @@ * ability to manage scripts order (store these in a vector?) * http://ryanbigg.com/guides/asset_pipeline.html, http://guides.rubyonrails.org/asset_pipeline.html, use content hash instead of mtime + directory hash. - Requirement checker +- Optional configurable input filtering in request - widgets - * if we're going to supply default ones, these should generate really unique IDs. This will solve a lot of AJAX-nesting problems. \ No newline at end of file + * if we're going to supply default ones, these should generate really unique IDs. This will solve a lot of AJAX-nesting problems. +- Make sure type hinting is used when components are passed to methods +- Decouple controller from application (by passing web application instance to controller and if not passed, using Yii::app())? +- Decouple view renderer from controller so it can be used separately (useful for sending emails from console etc.) \ No newline at end of file diff --git a/upgrade.md b/upgrade.md index 803be7c..42faf82 100644 --- a/upgrade.md +++ b/upgrade.md @@ -10,14 +10,14 @@ for both A and B. General upgrade instructions ---------------------------- +---------------------------- - Make a backup. - Clean up your 'assets' folder. -- Replace 'framework' dir with the new one or point SVN to a fresh - release and update. -- Check if everything is OK, if not — revert from backup and post - issues to Yii issue tracker. +- Replace 'framework' dir with the new one or point Git to a fresh + release tag and checkout. +- Check if everything is OK, if not — revert to previous stable version and post + issues to [Yii issue tracker](https://github.com/yiisoft/yii/issues). Upgrading from v1.1.x