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
a2e0d2d0
Commit
a2e0d2d0
authored
Jan 14, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init of advanced application now allows to specify answer for overwriting files …
init of advanced application now allows to specify answer for overwriting files via init --overwrite=n
parent
aa5e82ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
init
apps/advanced/init
+20
-5
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
No files found.
apps/advanced/init
View file @
a2e0d2d0
#!/usr/bin/env php
#!/usr/bin/env php
<?php
<?php
/**
* Yii Application Initialization Tool
*
* In order to run in non-interactive mode:
*
* init --env=dev --overwrite=n
*
* @author Alexander Makarov <sam@rmcreative.ru>
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
$params
=
getParams
();
$params
=
getParams
();
$root
=
str_replace
(
'\\'
,
'/'
,
__DIR__
);
$root
=
str_replace
(
'\\'
,
'/'
,
__DIR__
);
$envs
=
require
(
"
$root
/environments/index.php"
);
$envs
=
require
(
"
$root
/environments/index.php"
);
...
@@ -24,8 +38,7 @@ if (empty($params['env']) || $params['env'] === '1') {
...
@@ -24,8 +38,7 @@ if (empty($params['env']) || $params['env'] === '1') {
if
(
isset
(
$envNames
[
$answer
]))
{
if
(
isset
(
$envNames
[
$answer
]))
{
$envName
=
$envNames
[
$answer
];
$envName
=
$envNames
[
$answer
];
}
}
}
}
else
{
else
{
$envName
=
$params
[
'env'
];
$envName
=
$params
[
'env'
];
}
}
...
@@ -50,7 +63,7 @@ echo "\n Start initialization ...\n\n";
...
@@ -50,7 +63,7 @@ echo "\n Start initialization ...\n\n";
$files
=
getFileList
(
"
$root
/environments/
{
$env
[
'path'
]
}
"
);
$files
=
getFileList
(
"
$root
/environments/
{
$env
[
'path'
]
}
"
);
$all
=
false
;
$all
=
false
;
foreach
(
$files
as
$file
)
{
foreach
(
$files
as
$file
)
{
if
(
!
copyFile
(
$root
,
"environments/
{
$env
[
'path'
]
}
/
$file
"
,
$file
,
$all
))
{
if
(
!
copyFile
(
$root
,
"environments/
{
$env
[
'path'
]
}
/
$file
"
,
$file
,
$all
,
$params
))
{
break
;
break
;
}
}
}
}
...
@@ -91,7 +104,7 @@ function getFileList($root, $basePath = '')
...
@@ -91,7 +104,7 @@ function getFileList($root, $basePath = '')
return
$files
;
return
$files
;
}
}
function
copyFile
(
$root
,
$source
,
$target
,
&
$all
)
function
copyFile
(
$root
,
$source
,
$target
,
&
$all
,
$params
)
{
{
if
(
!
is_file
(
$root
.
'/'
.
$source
))
{
if
(
!
is_file
(
$root
.
'/'
.
$source
))
{
echo
" skip
$target
(
$source
not exist)
\n
"
;
echo
" skip
$target
(
$source
not exist)
\n
"
;
...
@@ -107,7 +120,9 @@ function copyFile($root, $source, $target, &$all)
...
@@ -107,7 +120,9 @@ function copyFile($root, $source, $target, &$all)
}
else
{
}
else
{
echo
" exist
$target
\n
"
;
echo
" exist
$target
\n
"
;
echo
" ...overwrite? [Yes|No|All|Quit] "
;
echo
" ...overwrite? [Yes|No|All|Quit] "
;
$answer
=
trim
(
fgets
(
STDIN
));
$answer
=
!
empty
(
$params
[
'overwrite'
])
?
$params
[
'overwrite'
]
:
trim
(
fgets
(
STDIN
));
if
(
!
strncasecmp
(
$answer
,
'q'
,
1
))
{
if
(
!
strncasecmp
(
$answer
,
'q'
,
1
))
{
return
false
;
return
false
;
}
else
{
}
else
{
...
...
framework/CHANGELOG.md
View file @
a2e0d2d0
...
@@ -70,6 +70,7 @@ Yii Framework 2 Change Log
...
@@ -70,6 +70,7 @@ Yii Framework 2 Change Log
-
Enh: Added support for using array-typed arguments for console commands (qiangxue)
-
Enh: Added support for using array-typed arguments for console commands (qiangxue)
-
Enh: Added support for installing packages conforming to PSR-4 standard (qiangxue)
-
Enh: Added support for installing packages conforming to PSR-4 standard (qiangxue)
-
Enh: Better exception message when class cannot be loaded (samdark)
-
Enh: Better exception message when class cannot be loaded (samdark)
-
Enh:
`init`
of advanced application now allows to specify answer for overwriting files via
`init --overwrite=n`
(samdark)
-
Enh #1839: Added support for getting file extension and basename from uploaded file (anfrantic)
-
Enh #1839: Added support for getting file extension and basename from uploaded file (anfrantic)
-
Chg #1519:
`yii\web\User::loginRequired()`
now returns the
`Response`
object instead of exiting the application (qiangxue)
-
Chg #1519:
`yii\web\User::loginRequired()`
now returns the
`Response`
object instead of exiting the application (qiangxue)
-
Chg #1586:
`QueryBuilder::buildLikeCondition()`
will now escape special characters and use percentage characters by default (qiangxue)
-
Chg #1586:
`QueryBuilder::buildLikeCondition()`
will now escape special characters and use percentage characters by default (qiangxue)
...
...
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