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
6c179ef3
Commit
6c179ef3
authored
Jun 03, 2013
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
File creation checks at "AssetController" have been updated to use Exceptions.
parent
5596e50b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
AssetController.php
framework/yii/console/controllers/AssetController.php
+15
-10
No files found.
framework/yii/console/controllers/AssetController.php
View file @
6c179ef3
...
@@ -159,7 +159,7 @@ class AssetController extends Controller
...
@@ -159,7 +159,7 @@ class AssetController extends Controller
}
}
}
}
$this
->
getAssetManager
();
// check asset manager configuration
$this
->
getAssetManager
();
// check asset manager configuration
is correct
}
}
/**
/**
...
@@ -420,7 +420,7 @@ class AssetController extends Controller
...
@@ -420,7 +420,7 @@ class AssetController extends Controller
}
}
$array
=
var_export
(
$array
,
true
);
$array
=
var_export
(
$array
,
true
);
$version
=
date
(
'Y-m-d H:i:s'
,
time
());
$version
=
date
(
'Y-m-d H:i:s'
,
time
());
$b
ytesWritten
=
file_put_contents
(
$bundleFile
,
<<<EOD
$b
undleFileContent
=
<<<EOD
<?php
<?php
/**
/**
* This file is generated by the "yii script" command.
* This file is generated by the "yii script" command.
...
@@ -428,9 +428,8 @@ class AssetController extends Controller
...
@@ -428,9 +428,8 @@ class AssetController extends Controller
* @version $version
* @version $version
*/
*/
return $array;
return $array;
EOD
EOD;
);
if
(
!
file_put_contents
(
$bundleFile
,
$bundleFileContent
))
{
if
(
$bytesWritten
<=
0
)
{
throw
new
Exception
(
"Unable to write output bundle configuration at '
{
$bundleFile
}
'."
);
throw
new
Exception
(
"Unable to write output bundle configuration at '
{
$bundleFile
}
'."
);
}
}
echo
"Output bundle configuration created at '
{
$bundleFile
}
'.
\n
"
;
echo
"Output bundle configuration created at '
{
$bundleFile
}
'.
\n
"
;
...
@@ -498,6 +497,7 @@ EOD
...
@@ -498,6 +497,7 @@ EOD
* Combines Java Script files into a single one.
* Combines Java Script files into a single one.
* @param array $inputFiles source file names.
* @param array $inputFiles source file names.
* @param string $outputFile output file name.
* @param string $outputFile output file name.
* @throws \yii\console\Exception on failure.
*/
*/
public
function
combineJsFiles
(
$inputFiles
,
$outputFile
)
public
function
combineJsFiles
(
$inputFiles
,
$outputFile
)
{
{
...
@@ -507,13 +507,16 @@ EOD
...
@@ -507,13 +507,16 @@ EOD
.
file_get_contents
(
$file
)
.
file_get_contents
(
$file
)
.
"/*** END FILE:
$file
***/
\n
"
;
.
"/*** END FILE:
$file
***/
\n
"
;
}
}
file_put_contents
(
$outputFile
,
$content
);
if
(
!
file_put_contents
(
$outputFile
,
$content
))
{
throw
new
Exception
(
"Unable to write output Java Script file '
{
$outputFile
}
'."
);
}
}
}
/**
/**
* Combines CSS files into a single one.
* Combines CSS files into a single one.
* @param array $inputFiles source file names.
* @param array $inputFiles source file names.
* @param string $outputFile output file name.
* @param string $outputFile output file name.
* @throws \yii\console\Exception on failure.
*/
*/
public
function
combineCssFiles
(
$inputFiles
,
$outputFile
)
public
function
combineCssFiles
(
$inputFiles
,
$outputFile
)
{
{
...
@@ -523,7 +526,9 @@ EOD
...
@@ -523,7 +526,9 @@ EOD
.
$this
->
adjustCssUrl
(
file_get_contents
(
$file
),
dirname
(
$file
),
dirname
(
$outputFile
))
.
$this
->
adjustCssUrl
(
file_get_contents
(
$file
),
dirname
(
$file
),
dirname
(
$outputFile
))
.
"/*** END FILE:
$file
***/
\n
"
;
.
"/*** END FILE:
$file
***/
\n
"
;
}
}
file_put_contents
(
$outputFile
,
$content
);
if
(
!
file_put_contents
(
$outputFile
,
$content
))
{
throw
new
Exception
(
"Unable to write output CSS file '
{
$outputFile
}
'."
);
}
}
}
/**
/**
...
@@ -590,6 +595,7 @@ EOD
...
@@ -590,6 +595,7 @@ EOD
/**
/**
* Creates template of configuration file for [[actionCompress]].
* Creates template of configuration file for [[actionCompress]].
* @param string $configFile output file name.
* @param string $configFile output file name.
* @throws \yii\console\Exception on failure.
*/
*/
public
function
actionTemplate
(
$configFile
)
public
function
actionTemplate
(
$configFile
)
{
{
...
@@ -622,9 +628,8 @@ EOD;
...
@@ -622,9 +628,8 @@ EOD;
return
;
return
;
}
}
}
}
$bytesWritten
=
file_put_contents
(
$configFile
,
$template
);
if
(
!
file_put_contents
(
$configFile
,
$template
))
{
if
(
$bytesWritten
<=
0
)
{
throw
new
Exception
(
"Unable to write template file '
{
$configFile
}
'."
);
echo
"Error: unable to write file '
{
$configFile
}
'!
\n\n
"
;
}
else
{
}
else
{
echo
"Configuration file template created at '
{
$configFile
}
'.
\n\n
"
;
echo
"Configuration file template created at '
{
$configFile
}
'.
\n\n
"
;
}
}
...
...
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