FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cakephp-cakeadmin/src/Shell/CainstallShell.php at master · cakemanager/cakephp-cakeadmin · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
cakemanager
/
cakephp-cakeadmin
Public
Notifications
You must be signed in to change notification settings
Fork
16
Star
28
Code
Issues
2
Pull requests
2
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
cakephp-cakeadmin
/
src
/
Shell
/
CainstallShell.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
85 lines (74 loc) · 2.21 KB
Breadcrumbs
cakephp-cakeadmin
/
src
/
Shell
/
CainstallShell.php
Copy path
File metadata and controls
85 lines (74 loc) · 2.21 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* CakeManager (http://cakemanager.org)
* Copyright (c) http://cakemanager.org
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) http://cakemanager.org
* @link http://cakemanager.org CakeManager Project
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace
CakeAdmin
\
Shell
;
use
Cake
\
Console
\
Shell
;
use
Cake
\
Datasource
\
ConnectionManager
;
use
Migrations
\
Migrations
;
/**
* Cainstall shell command.
*/
class
CainstallShell
extends
Shell
{
/**
* main() method.
*
* @return void
*/
public
function
main
()
{
// CakeAdmin Migration
$
this
->
out
(
'
Migrating CakeAdmin Tables...
'
);
$
this
->
migrate
(
'
CakeAdmin
'
);
$
this
->
out
(
'
<info>Migrating CakeAdmin Tables completed!</info>
'
);
$
this
->
hr
();
// Notifier Migration
$
this
->
out
(
'
Migrating Notifier Tables...
'
);
$
this
->
migrate
(
'
Notifier
'
);
$
this
->
out
(
'
<info>Migrating Notifier Tables completed!</info>
'
);
$
this
->
hr
();
// Settings Migration
$
this
->
out
(
'
Migrating Settings Tables...
'
);
$
this
->
migrate
(
'
Settings
'
);
$
this
->
out
(
'
<info>Migrating Settings Tables completed!</info>
'
);
$
this
->
hr
();
$
createAdmin
=
$
this
->
in
(
'
Do you want to create your first administrator?
'
, [
'
Y
'
,
'
n
'
],
'
Y
'
);
if
(
$
createAdmin
===
'
Y
'
) {
$
this
->
out
(
'
Generating a new administrator...
'
);
$
this
->
dispatchShell
(
'
admin
'
);
}
}
/**
* Migrates the given plugin.
*
* @param string $plugin Plugin name.
* @return bool
*/
protected
function
migrate
(
$
plugin
)
{
$
migrations
=
new
Migrations
();
return
$
migrations
->
migrate
([
'
plugin
'
=>
$
plugin
]);
}
/**
* Checks if the table exists.
*
* @param string $table Plugin name.
* @return bool
*/
protected
function
_tableExists
(
$
table
)
{
$
db
= ConnectionManager::
get
(
'
default
'
);
$
tables
=
$
db
->
schemaCollection
()->
listTables
();
return
in_array
(
$
table
,
$
tables
);
}
}
Back
|
FazBrowse Home
|
New Git URL