CoreFiles by mySites.guru
CheckUpdatesCommand.php70 lines, 1,643 bytes, from Joomla_4.0.0-alpha6-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha5
md5
6fea3f90665937afc69052daadb8b365
sha1
25506419657317e2682223ca01bf6eb854c2c98f
sha256
c5bcdc531f37bd1322411ec125b1eda626dc3ec32f254921df174b33491d839d
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  Copyright (C) 2005 - 2018 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\AbstractCommand;
use Symfony\Component\Console\Style\SymfonyStyle;

/**
 * Console command for checking if there are pending extension updates
 *
 * @since  4.0.0
 */
class CheckUpdatesCommand extends AbstractCommand
{
	/**
	 * Execute the command.
	 *
	 * @return  integer  The exit code for the command.
	 *
	 * @since   4.0.0
	 */
	public function execute(): int
	{
		$symfonyStyle = new SymfonyStyle($this->getApplication()->getConsoleInput(), $this->getApplication()->getConsoleOutput());

		$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;
	}

	/**
	 * Initialise the command.
	 *
	 * @return  void
	 *
	 * @since   4.0.0
	 */
	protected function initialise()
	{
		$this->setName('update:extensions:check');
		$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 3 releases, Joomla 4.0.0-alpha3 to 4.0.0-alpha6. See them all, or every version of this file.