Skip to content

Commit

Permalink
small enh. in actionImport
Browse files Browse the repository at this point in the history
  • Loading branch information
zelenin committed Aug 15, 2014
1 parent b958f96 commit ade7f1b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions console/controllers/I18nController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Zelenin\yii\modules\I18n\console\controllers;

use yii\console\Controller;
use Yii;
use yii\console\Controller;
use yii\console\Exception;
use yii\helpers\FileHelper;
use yii\helpers\VarDumper;
Expand All @@ -16,12 +16,16 @@ class I18nController extends Controller
* @param string $sourcePath
* @throws Exception
*/
public function actionImport($sourcePath)
public function actionImport($sourcePath = null)
{
if (!$sourcePath) {
$sourcePath = $this->prompt('Enter a source path');
}
$sourcePath = realpath(Yii::getAlias($sourcePath));
if (!is_dir($sourcePath)) {
throw new Exception('The source path ' . $sourcePath . ' is not a valid directory.');
}

$translationsFiles = FileHelper::findFiles($sourcePath, ['only' => ['*.php']]);

foreach ($translationsFiles as $translationsFile) {
Expand Down

0 comments on commit ade7f1b

Please sign in to comment.