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
Hide 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
}
}
$this
->
getAssetManager
();
// check asset manager configuration
$this
->
getAssetManager
();
// check asset manager configuration
is correct
}
/**
...
...
@@ -420,7 +420,7 @@ class AssetController extends Controller
}
$array
=
var_export
(
$array
,
true
);
$version
=
date
(
'Y-m-d H:i:s'
,
time
());
$b
ytesWritten
=
file_put_contents
(
$bundleFile
,
<<<EOD
$b
undleFileContent
=
<<<EOD
<?php
/**
* This file is generated by the "yii script" command.
...
...
@@ -428,9 +428,8 @@ class AssetController extends Controller
* @version $version
*/
return $array;
EOD
);
if
(
$bytesWritten
<=
0
)
{
EOD;
if
(
!
file_put_contents
(
$bundleFile
,
$bundleFileContent
))
{
throw
new
Exception
(
"Unable to write output bundle configuration at '
{
$bundleFile
}
'."
);
}
echo
"Output bundle configuration created at '
{
$bundleFile
}
'.
\n
"
;
...
...
@@ -498,6 +497,7 @@ EOD
* Combines Java Script files into a single one.
* @param array $inputFiles source file names.
* @param string $outputFile output file name.
* @throws \yii\console\Exception on failure.
*/
public
function
combineJsFiles
(
$inputFiles
,
$outputFile
)
{
...
...
@@ -507,13 +507,16 @@ EOD
.
file_get_contents
(
$file
)
.
"/*** 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.
* @param array $inputFiles source file names.
* @param string $outputFile output file name.
* @throws \yii\console\Exception on failure.
*/
public
function
combineCssFiles
(
$inputFiles
,
$outputFile
)
{
...
...
@@ -523,7 +526,9 @@ EOD
.
$this
->
adjustCssUrl
(
file_get_contents
(
$file
),
dirname
(
$file
),
dirname
(
$outputFile
))
.
"/*** 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
/**
* Creates template of configuration file for [[actionCompress]].
* @param string $configFile output file name.
* @throws \yii\console\Exception on failure.
*/
public
function
actionTemplate
(
$configFile
)
{
...
...
@@ -622,9 +628,8 @@ EOD;
return
;
}
}
$bytesWritten
=
file_put_contents
(
$configFile
,
$template
);
if
(
$bytesWritten
<=
0
)
{
echo
"Error: unable to write file '
{
$configFile
}
'!
\n\n
"
;
if
(
!
file_put_contents
(
$configFile
,
$template
))
{
throw
new
Exception
(
"Unable to write template file '
{
$configFile
}
'."
);
}
else
{
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