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
3c09eadd
Commit
3c09eadd
authored
Jul 11, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added autoload command.
parent
e11ce600
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
5 deletions
+95
-5
build
build/build
+5
-4
AutoloadController.php
build/controllers/AutoloadController.php
+89
-0
LocaleController.php
build/controllers/LocaleController.php
+1
-1
classes.php
framework/yii/classes.php
+0
-0
No files found.
build/build
View file @
3c09eadd
...
...
@@ -13,8 +13,9 @@ defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
require
(
__DIR__
.
'/../framework/yii/Yii.php'
);
$id
=
'yii-build'
;
$basePath
=
__DIR__
;
$application
=
new
yii\console\Application
(
array
(
'id'
=>
$id
,
'basePath'
=>
$basePath
));
$application
=
new
yii\console\Application
(
array
(
'id'
=>
'yii-build'
,
'basePath'
=>
__DIR__
,
'controllerNamespace'
=>
'yii\build\controllers'
,
));
$application
->
run
();
build/controllers/AutoloadController.php
0 → 100644
View file @
3c09eadd
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\build\controllers
;
use
yii\console\Controller
;
use
yii\helpers\FileHelper
;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
AutoloadController
extends
Controller
{
public
$defaultAction
=
'create'
;
/**
* Creates a class map for the core Yii classes.
* @param string $root the root path of Yii framework. Defaults to YII_PATH.
* @param string $mapFile the file to contain the class map. Defaults to YII_PATH . '/classes.php'.
*/
public
function
actionCreate
(
$root
=
null
,
$mapFile
=
null
)
{
if
(
$root
===
null
)
{
$root
=
YII_PATH
;
}
$root
=
FileHelper
::
normalizePath
(
$root
);
if
(
$mapFile
===
null
)
{
$mapFile
=
YII_PATH
.
'/classes.php'
;
}
$options
=
array
(
'filter'
=>
function
(
$path
)
{
if
(
is_file
(
$path
))
{
$file
=
basename
(
$path
);
if
(
$file
[
0
]
<
'A'
||
$file
[
0
]
>
'Z'
)
{
return
false
;
}
}
return
null
;
},
'only'
=>
array
(
'.php'
),
'except'
=>
array
(
'Yii.php'
,
'YiiBase.php'
,
'/debug/'
,
'/console/'
,
'/test/'
,
),
);
$files
=
FileHelper
::
findFiles
(
$root
,
$options
);
$map
=
array
();
foreach
(
$files
as
$file
)
{
if
((
$pos
=
strpos
(
$file
,
$root
))
!==
0
)
{
die
(
"Something wrong:
$file
"
);
}
$path
=
str_replace
(
'\\'
,
'/'
,
substr
(
$file
,
strlen
(
$root
)));
$map
[]
=
"
\t
'yii"
.
substr
(
str_replace
(
'/'
,
'\\'
,
$path
),
0
,
-
4
)
.
"' => YII_PATH . '
$path
',"
;
}
$map
=
implode
(
"
\n
"
,
$map
);
$output
=
<<<EOD
<?php
/**
* Yii core class map.
*
* This file is automatically generated by the "build autoload" command under the "build" folder.
* Do not modify it directly.
*
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
return array(
$map
);
EOD;
if
(
is_file
(
$mapFile
)
&&
file_get_contents
(
$mapFile
)
===
$output
)
{
echo
"Nothing changed."
;
}
else
{
file_put_contents
(
$mapFile
,
$output
);
echo
"Class map saved in
$mapFile
"
;
}
}
}
build/controllers/LocaleController.php
View file @
3c09eadd
...
...
@@ -5,7 +5,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
app
\controllers
;
namespace
yii\build
\controllers
;
use
yii\console\Exception
;
use
yii\console\Controller
;
...
...
framework/yii/classes.php
View file @
3c09eadd
This diff is collapsed.
Click to expand it.
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