- md5
- 63abf43a6ae3a075a6d6cce35ff0a856
- sha1
- e2ff15447db327a154d66397f720b05c1d79ec20
- sha256
- 5b6f6eb239e5a497fe63000ffcd2bf9ec77913eb18c47536acd6511a8cf4e318
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2019 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\CMS\Component\ComponentHelper;
use Joomla\CMS\Updater\Updater;
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 CheckUpdatesCommand extends AbstractCommand
{
/**
* The default command name
*
* @var string
* @since 4.0.0
*/
protected static $defaultName = 'update:extensions:check';
/**
* 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 4.0.0
*/
protected function doExecute(InputInterface $input, OutputInterface $output): int
{
$symfonyStyle = new SymfonyStyle($input, $output);
$symfonyStyle->title('Fetching Extension Updates');
// Get the update cache time
$component = ComponentHelper::getComponent('com_installer');
$cache_timeout = 3600 * (int) $component->getParams()->get('cachetimeout', 6);
// Find all updates
Updater::getInstance()->findUpdates(0, $cache_timeout);
$symfonyStyle->success('Finished fetching updates');
return 0;
}
/**
* Configure the command.
*
* @return void
*
* @since 4.0.0
*/
protected function configure()
{
$this->setDescription('Checks for pending extension updates');
$this->setHelp(
<<<EOF
The <info>%command.name%</info> command checks for pending extension updates
<info>php %command.full_name%</info>
EOF
);
}
}
The same content is in 4 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha10. See them all, or every version of this file.