-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[4.0] [GSoC 2018] CLI Update Project #21452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3a2818b
d3cc35e
56a8fe7
00df438
f830ea0
2a39145
131f669
f62bebb
ecfe7e5
39bb8a9
9703aa6
96a6836
62816fd
1f91105
237192f
59ba1a0
01da3ed
ade3411
0c0daca
a6810f1
3f05391
c628ad2
385563f
c29852f
d97b3cb
be064f9
dce2143
7b5e121
0aeda6d
0716701
a0aba35
e3029db
a4e491e
8beba78
0da0fc0
5aec189
06e9861
cb50252
e024804
4ef2c6b
5f2c9b2
1d7fedc
42c2700
f7cce83
36a7f12
0be7d89
69aaf77
2a5ab94
14a0e85
fa23711
c174dc5
f23fc0c
77b3490
43ffbfb
7ae5010
f0a82f0
4291c6d
4321b59
a915115
8ff5c17
4b98344
26f70d5
c46a316
ea8c239
9a41943
4cce91f
90d137e
5bbbf0d
317ce2d
1458ca6
ee3576c
4907b06
d6fefd3
86219cd
6f8c159
f44d366
1605298
ad2a45f
96f344d
8f15bea
68d986c
0dc5d17
b2522e2
e9f0490
5cdabc6
3163bf0
236e19f
2d349e5
99e6f9f
5fa88fd
2d6ce67
6c7cff6
0fda256
b010394
b16f652
77e69c3
5fd7922
450a25a
5b4b6b2
4aa323e
6e8e92b
e4b135f
568dc6d
ee254f1
1306b13
ddb6be8
198f02b
fad7076
8746c78
80adb6f
19f0607
0568130
bcce1e8
1e94b70
d12ddc3
b8ac39c
3fbc8e9
f67df4e
3d444b1
21b0f4d
c7a594b
afc30d5
2f80bf0
d90e459
c3eb623
017f09d
4e5713e
3810902
5945a1f
ae81926
c5116ae
adee795
21cc87e
27e6782
ee41ac8
49aea85
5751aca
022c893
6778df7
a895d7d
02c39d4
f63b3da
f098e2c
b911346
84c8e27
b23fdfb
8eee306
b2da127
7d35c0d
9ece943
9be7e20
a49b93c
61ab309
93e9d0b
96775fa
44d2fd0
e03f5cc
70dc274
004392d
a299d35
298c1b2
f2b593e
5701c90
cb6f264
4a73fd5
a959f8f
8a61284
5412272
292a3f0
dabed3f
e2897a6
fb0196b
ed9b8b6
60eef28
6bc0cc5
c8aa176
6f94953
4860b9e
6b61ec7
fabdf75
1c2f9f7
0a93ade
68bbb4c
5ea1435
556702c
7f17e79
31753c7
e0a6680
fc827e0
b7e8ab4
fea9214
eb3103d
631073e
07c696c
53f913b
8f265d9
a071a6b
ea1b823
4e455ea
960c108
56d00b0
c990bbc
3ddb19c
8bf850c
3a4254a
bda5ffb
9560bf9
b033cb9
097d2a1
a97eb0d
08ba64d
a87f70f
683b7fd
8e00fce
d422c87
bdc0a1a
90aebf7
c1267f8
ddee242
879e108
4b46a35
dba0069
e80940d
256c196
5bfc934
8af02f6
b566179
8f89eee
e3b964d
bcc0036
b4c8532
e89d80b
07f7d73
595716a
f56754b
5606ff9
502e426
5753337
2dae8a4
d626612
767a5ac
ab9cb42
15b3be6
535ce86
d1e9f0d
7e174eb
dcfc62a
ee5066a
f6ec9d9
3f9ada1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,16 @@ | |
| || (filesize(JPATH_CONFIGURATION . '/configuration.php') < 10) | ||
| || (file_exists(JPATH_INSTALLATION . '/index.php') && (false === (new Version)->isInDevelopmentState()))) | ||
| { | ||
| if (file_exists(JPATH_INSTALLATION . '/index.php')) | ||
| // Prevents the script from falling back to $_SERVER['REQUEST_URI'] as it will throw an error in CLI mode. | ||
| if (php_sapi_name() === 'cli') | ||
| { | ||
| // This is been defined because some core scripts needs it defined. | ||
bosunski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| define('JDEBUG', false); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
|
||
| // We pass control back to the calling script - joomla.php to allow commands like core:install to run | ||
| return; | ||
| } | ||
| elseif (file_exists(JPATH_INSTALLATION . '/index.php')) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code Style Suggestion: You dont need elseif when your return in the first if block |
||
| { | ||
| header('Location: ' . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'index.php')) . 'installation/index.php'); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
|
|
||
| use Joomla\CMS\Factory; | ||
| use Joomla\CMS\Form\FormField; | ||
| use Joomla\CMS\Installation\Helper\DatabaseHelper; | ||
|
|
||
| /** | ||
| * Database Prefix field. | ||
|
|
@@ -45,36 +46,17 @@ protected function getInput() | |
| $disabled = (string) $this->element['disabled'] === 'true' ? ' disabled="disabled"' : ''; | ||
|
|
||
| // Make sure somebody doesn't put in a too large prefix size value. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check needs to be here instead of the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if ($size > 10) | ||
| if ($size > 15) | ||
| { | ||
| $size = 10; | ||
| $size = 15; | ||
| } | ||
|
|
||
| // If a prefix is already set, use it instead. | ||
| $session = Factory::getSession()->get('setup.options', array()); | ||
|
|
||
| if (empty($session['db_prefix'])) | ||
| { | ||
| // Create the random prefix. | ||
| $prefix = ''; | ||
| $chars = range('a', 'z'); | ||
| $numbers = range(0, 9); | ||
|
|
||
| // We want the fist character to be a random letter. | ||
| shuffle($chars); | ||
| $prefix .= $chars[0]; | ||
|
|
||
| // Next we combine the numbers and characters to get the other characters. | ||
| $symbols = array_merge($numbers, $chars); | ||
| shuffle($symbols); | ||
|
|
||
| for ($i = 0, $j = $size - 1; $i < $j; ++$i) | ||
| { | ||
| $prefix .= $symbols[$i]; | ||
| } | ||
|
|
||
| // Add in the underscore. | ||
| $prefix .= '_'; | ||
| $prefix = DatabaseHelper::getPrefix(); | ||
| } | ||
| else | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| use Joomla\CMS\Extension\ExtensionManagerTrait; | ||
| use Joomla\CMS\Factory; | ||
| use Joomla\CMS\Plugin\PluginHelper; | ||
| use Joomla\CMS\Version; | ||
| use Joomla\Console\Application; | ||
| use Joomla\DI\Container; | ||
| use Joomla\DI\ContainerAwareTrait; | ||
|
|
@@ -22,6 +23,8 @@ | |
| use Joomla\Event\DispatcherInterface; | ||
| use Joomla\Registry\Registry; | ||
| use Joomla\Session\SessionInterface; | ||
| use Symfony\Component\Console\Input\InputInterface; | ||
| use Symfony\Component\Console\Output\OutputInterface; | ||
| use Symfony\Component\Console\Style\SymfonyStyle; | ||
|
|
||
| /** | ||
|
|
@@ -57,6 +60,14 @@ class ConsoleApplication extends Application implements DispatcherAwareInterface | |
| */ | ||
| private $session; | ||
|
|
||
| /** | ||
| * The client identifier. | ||
| * | ||
| * @var integer | ||
| * @since 4.0 | ||
| */ | ||
| protected $clientId = 4; | ||
|
|
||
| /** | ||
| * Class constructor. | ||
| * | ||
|
|
@@ -163,8 +174,11 @@ public function execute() | |
| $this->createExtensionNamespaceMap(); | ||
|
|
||
| // Import CMS plugin groups to be able to subscribe to events | ||
| PluginHelper::importPlugin('system'); | ||
| PluginHelper::importPlugin('console'); | ||
| if (file_exists(JPATH_CONFIGURATION . '/configuration.php')) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A comment indicating why this check is necessary should be left. And I would suggest this check should not be necessary, the plugin helper should deal with issues stemming from the database connection being unavailable if really necessary.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment still needs to be addressed. |
||
| { | ||
| PluginHelper::importPlugin('system'); | ||
| PluginHelper::importPlugin('console'); | ||
| } | ||
|
|
||
| parent::execute(); | ||
| } | ||
|
|
@@ -307,6 +321,31 @@ public function setSession(SessionInterface $session): self | |
| return $this; | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Flush the media version to refresh versionable assets | ||
| * | ||
| * @return void | ||
| * | ||
| * @since 4.0 | ||
| */ | ||
| public function flushAssets() | ||
| { | ||
| (new Version)->refreshMediaVersion(); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the client id of the current running application. | ||
| * | ||
| * @return integer A client identifier. | ||
| * | ||
| * @since 4.0 | ||
| */ | ||
| public function getClientId() | ||
| { | ||
| return $this->clientId; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the application \JMenu object. | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is still required before registering the namespace and trying to do something. For stable releases, the
installationdirectory is removed from a site after Joomla has been installed. Therefore, altering the behavior based on the active SAPI must still account for the production filesystem structure and issue appropriate warnings if not available.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this and also I have this check for the installation directory, I think that is already accounted for, if I'm correct? @mbabker