-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[4.0] CLI commands #28666
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
Merged
Merged
[4.0] CLI commands #28666
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
d8c2d30
CheckJoomlaUpdatesCommand
alikon 91d47ef
SetConfigurationCommand
alikon 4bc89af
GetConfigurationCommand
alikon 31134b5
ExtensionsListCommand
alikon ff7e5d0
SiteUpCommand
alikon 890b85f
SiteDownCommand
alikon d57330f
add commands
alikon 8d8c4de
add commands
alikon 66afb10
database group connection encryption options
alikon ea2478b
help fix
alikon a8a4c20
full rewrite
alikon e2560ca
cleaning a bit
alikon 979b1ad
cleaning a bit
alikon 8013453
cleaning a bit
alikon c6e52d7
cleaning a bit
alikon f14694a
Update libraries/src/Console/GetConfigurationCommand.php
alikon 81fc024
ExtensionRemoveCommand
alikon 890bf68
ExtensionInstallCommand
alikon 3cc9715
version for flush assets
alikon a0225c3
add extension commands
alikon 57e8fad
add extension commands
alikon 4f06acb
Merge remote-tracking branch 'upstream/4.0-dev' into patch-105
richard67 f650771
PHPCS
richard67 57e59c4
move check-updates to core group commands
alikon 7ad60dd
UpdateCoreCommand
alikon 7c9643d
add update core command
alikon cb139e0
UpdateCoreCommand
alikon 97d446e
fix Notice
alikon 5913b9b
force_ssl missed
alikon 953c70f
fixed notices when site:down site:up
alikon 61e5202
prevent merge for old session data
alikon 500d5c2
sanitize boolean
alikon dda1b9c
Fix help text of GetConfigurationCommand
richard67 2e3459e
Merge pull request #68 from richard67/4.0-dev-alikon-patch-105-mod-2
alikon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| <?php | ||
| /** | ||
| * Joomla! Content Management System | ||
| * | ||
| * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. | ||
| * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
| */ | ||
|
|
||
| namespace Joomla\CMS\Console; | ||
|
|
||
| defined('JPATH_PLATFORM') or die; | ||
|
|
||
| use Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel; | ||
| use Joomla\Console\Command\AbstractCommand; | ||
| use Symfony\Component\Console\Input\InputInterface; | ||
| use Symfony\Component\Console\Output\OutputInterface; | ||
| use Symfony\Component\Console\Style\SymfonyStyle; | ||
|
|
||
| /** | ||
| * Console command for checking if there are pending extension updates | ||
| * | ||
| * @since 4.0.0 | ||
| */ | ||
| class CheckJoomlaUpdatesCommand extends AbstractCommand | ||
| { | ||
| /** | ||
| * The default command name | ||
| * | ||
| * @var string | ||
| * @since 4.0 | ||
| */ | ||
| protected static $defaultName = 'core:check-updates'; | ||
|
|
||
| /** | ||
| * Stores the Update Information | ||
| * @var UpdateModel | ||
| * @since 4.0 | ||
| */ | ||
| private $updateInfo; | ||
|
|
||
| /** | ||
| * Initialise the command. | ||
| * | ||
| * @return void | ||
| * | ||
| * @since 4.0.0 | ||
| */ | ||
| protected function configure(): void | ||
| { | ||
| $help = <<<'EOF' | ||
| The <info>%command.name%</info> Checks for Joomla updates. | ||
|
|
||
| <info>php %command.full_name%</info> | ||
| EOF; | ||
| $this->setDescription('Checks for Joomla updates'); | ||
| $this->setHelp($help); | ||
| } | ||
|
|
||
| /** | ||
| * Retrieves Update Information | ||
| * | ||
| * @return mixed | ||
| * | ||
| * @since 4.0 | ||
| */ | ||
| private function getUpdateInformationFromModel() | ||
| { | ||
| $app = $this->getApplication(); | ||
| $updatemodel = $app->bootComponent('com_joomlaupdate')->getMVCFactory($app)->createModel('Update', 'Administrator'); | ||
| $updatemodel->purge(); | ||
| $updatemodel->refreshUpdates(true); | ||
|
|
||
| return $updatemodel; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the Update Information | ||
| * | ||
| * @return mixed | ||
| * | ||
| * @since 4.0 | ||
| */ | ||
| public function getUpdateInfo() | ||
| { | ||
| if (!$this->updateInfo) | ||
| { | ||
| $this->setUpdateInfo(); | ||
| } | ||
|
|
||
| return $this->updateInfo; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the Update Information | ||
| * | ||
| * @param null $info stores update Information | ||
| * | ||
| * @return void | ||
| * | ||
| * @since 4.0 | ||
| */ | ||
| public function setUpdateInfo($info = null): void | ||
| { | ||
| if (!$info) | ||
| { | ||
| $this->updateInfo = $this->getUpdateInformationFromModel(); | ||
| } | ||
| else | ||
| { | ||
| $this->updateInfo = $info; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Internal function to execute the command. | ||
| * | ||
| * @param InputInterface $input The input to inject into the command. | ||
| * @param OutputInterface $output The output to inject into the command. | ||
| * | ||
| * @return integer The command exit code | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| protected function doExecute(InputInterface $input, OutputInterface $output): int | ||
| { | ||
| $symfonyStyle = new SymfonyStyle($input, $output); | ||
|
|
||
| $model = $this->getUpdateInfo(); | ||
| $data = $model->getUpdateInformation(); | ||
| $symfonyStyle->title('Joomla! Updates'); | ||
|
|
||
| if (!$data['hasUpdate']) | ||
| { | ||
| $symfonyStyle->success('You already have the latest Joomla version ' . $data['latest']); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| $symfonyStyle->note('New Joomla Version ' . $data['latest'] . ' is available.'); | ||
|
|
||
| if (!isset($data['object']->downloadurl->_data)) | ||
| { | ||
| $symfonyStyle->warning('We cannot find an update URL'); | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
We might need to add this into the
CMSApplicationInterface(and if so add it into theCliApplication)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.
as usual i've done a dirty hack
probably you are right
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.
Is this solved, or is it still open?