Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
3c9b1578
Commit
3c9b1578
authored
Jun 09, 2013
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exception usage has been added to "yii\console\controllers\MessageController".
parent
a5e903f2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
MessageController.php
framework/yii/console/controllers/MessageController.php
+12
-9
No files found.
framework/yii/console/controllers/MessageController.php
View file @
3c9b1578
...
...
@@ -9,6 +9,8 @@
namespace
yii\console\controllers
;
use
yii\console\Controller
;
use
yii\console\Exception
;
use
yii\helpers\FileHelper
;
/**
* This command extracts messages to be translated from source files.
...
...
@@ -26,6 +28,7 @@ class MessageController extends Controller
*
* @param string $config the path of the configuration file. You can find
* an example in framework/messages/config.php.
* @throws \yii\console\Exception on failure.
*
* The file can be placed anywhere and must be a valid PHP script which
* returns an array of name-value pairs. Each name-value pair represents
...
...
@@ -58,25 +61,25 @@ class MessageController extends Controller
public
function
actionIndex
(
$config
)
{
if
(
!
is_file
(
$config
))
{
$this
->
usageError
(
"the configuration file
{
$config
}
does not exist."
);
throw
new
Exception
(
"the configuration file
{
$config
}
does not exist."
);
}
$config
=
require
_once
(
$config
);
$config
=
require
(
$config
);
$translator
=
'Yii::t'
;
$translator
=
'Yii::t'
;
extract
(
$config
);
if
(
!
isset
(
$sourcePath
,
$messagePath
,
$languages
))
{
$this
->
usageError
(
'The configuration file must specify "sourcePath", "messagePath" and "languages".'
);
throw
new
Exception
(
'The configuration file must specify "sourcePath", "messagePath" and "languages".'
);
}
if
(
!
is_dir
(
$sourcePath
))
{
$this
->
usageError
(
"The source path
$sourcePath
is not a valid directory."
);
throw
new
Exception
(
"The source path
{
$sourcePath
}
is not a valid directory."
);
}
if
(
!
is_dir
(
$messagePath
))
{
$this
->
usageError
(
"The message path
$messagePath
is not a valid directory."
);
throw
new
Exception
(
"The message path
{
$messagePath
}
is not a valid directory."
);
}
if
(
empty
(
$languages
))
{
$this
->
usageError
(
"Languages cannot be empty."
);
throw
new
Exception
(
"Languages cannot be empty."
);
}
if
(
!
isset
(
$overwrite
))
{
...
...
@@ -96,7 +99,7 @@ class MessageController extends Controller
if
(
isset
(
$exclude
))
{
$options
[
'exclude'
]
=
$exclude
;
}
$files
=
C
FileHelper
::
findFiles
(
realpath
(
$sourcePath
),
$options
);
$files
=
FileHelper
::
findFiles
(
realpath
(
$sourcePath
),
$options
);
$messages
=
array
();
foreach
(
$files
as
$file
)
{
...
...
@@ -209,7 +212,7 @@ class MessageController extends Controller
/**
* Message translations.
*
* This file is automatically generated by 'yii
message
' command.
* This file is automatically generated by 'yii
{$this->id}
' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment