FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
phpbb/phpBB/phpbb/console/application.php at master · Gregory-R/phpbb · GitHub
Gregory-R
/
phpbb
Public
forked from
phpbb/phpbb
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
phpbb
/
phpBB
/
phpbb
/
console
/
application.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
153 lines (135 loc) · 3.49 KB
Breadcrumbs
phpbb
/
phpBB
/
phpbb
/
console
/
application.php
Copy path
File metadata and controls
153 lines (135 loc) · 3.49 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace
phpbb
\
console
;
use
Symfony
\
Component
\
Console
\
Input
\
InputDefinition
;
use
Symfony
\
Component
\
Console
\
Shell
;
use
Symfony
\
Component
\
Console
\
Input
\
InputInterface
;
use
Symfony
\
Component
\
Console
\
Input
\
InputOption
;
use
Symfony
\
Component
\
Console
\
Output
\
OutputInterface
;
class
application
extends
\
Symfony
\
Component
\
Console
\Application
{
/**
* @var bool Indicates whether or not we are in a shell
*/
protected
$
in_shell
=
false
;
/**
* @var \phpbb\language\language User object
*/
protected
$
language
;
/**
* @param string $name The name of the application
* @param string $version The version of the application
* @param \phpbb\language\language $language The user which runs the application (used for translation)
*/
public
function
__construct
(
$
name
,
$
version
,
\
phpbb
\
language
\
language
$
language
)
{
$
this
->
language
=
$
language
;
parent
::
__construct
(
$
name
,
$
version
);
}
/**
* {@inheritdoc}
*/
protected
function
getDefaultInputDefinition
()
{
$
input_definition
=
parent
::
getDefaultInputDefinition
();
$
this
->
register_global_options
(
$
input_definition
);
return
$
input_definition
;
}
/**
* Gets the help message.
*
* It's a hack of the default help message to display the --shell
* option only for the application and not for all the commands.
*
* @return string A help message.
*/
public
function
getHelp
()
{
// If we are already in a shell
// we do not want to have the --shell option available
if
(
$
this
->
in_shell
)
{
return
parent
::
getHelp
();
}
try
{
$
definition
=
$
this
->
getDefinition
();
$
definition
->
addOption
(
new
InputOption
(
'
--shell
'
,
'
-s
'
,
InputOption::
VALUE_NONE
,
$
this
->
language
->
lang
(
'
CLI_DESCRIPTION_OPTION_SHELL
'
)
));
}
catch
(
\
LogicException
$
e
)
{
// Do nothing
}
return
parent
::
getHelp
();
}
/**
* Register a set of commands from the container
*
* @param \phpbb\di\service_collection $command_collection The console service collection
*/
public
function
register_container_commands
(
\
phpbb
\
di
\
service_collection
$
command_collection
)
{
foreach
(
$
command_collection
as
$
service_command
)
{
$
this
->
add
(
$
service_command
);
}
}
/**
* {@inheritdoc}
*/
public
function
doRun
(
InputInterface
$
input
,
OutputInterface
$
output
)
{
// Run a shell if the --shell (or -s) option is set and if no command name is specified
// Also, we do not want to have the --shell option available if we are already in a shell
if
(!
$
this
->
in_shell
&&
$
this
->
getCommandName
(
$
input
) ===
null
&&
$
input
->
hasParameterOption
(
array
(
'
--shell
'
,
'
-s
'
)))
{
$
shell
=
new
Shell
(
$
this
);
$
this
->
in_shell
=
true
;
$
shell
->
run
();
return
0
;
}
return
parent
::
doRun
(
$
input
,
$
output
);
}
/**
* Register global options
*
* @param InputDefinition $definition An InputDefinition instance
*/
protected
function
register_global_options
(
InputDefinition
$
definition
)
{
try
{
$
definition
->
addOption
(
new
InputOption
(
'
safe-mode
'
,
null
,
InputOption::
VALUE_NONE
,
$
this
->
language
->
lang
(
'
CLI_DESCRIPTION_OPTION_SAFE_MODE
'
)
));
$
definition
->
addOption
(
new
InputOption
(
'
env
'
,
'
e
'
,
InputOption::
VALUE_REQUIRED
,
$
this
->
language
->
lang
(
'
CLI_DESCRIPTION_OPTION_ENV
'
)
));
}
catch
(
\
LogicException
$
e
)
{
// Do nothing
}
}
}
Back
|
FazBrowse Home
|
New Git URL