CoreFiles by mySites.guru
RemoveOldFilesCommand.php69 lines, 1,657 bytes, from Joomla_4.0.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha2
md5
7b5f61e416a85abc69d2e54fb7f4a32a
sha1
179cf1c68a9b7c529523e13f2b46f20e13a70e69
sha256
38dbd6fb96b44e4f8a0b696167b4db70dc617e8818d67b5fbc5c22c041516ac2
<?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\Console\AbstractCommand;
use Symfony\Component\Console\Style\SymfonyStyle;

/**
 * Console command for removing files which should have been cleared during an update
 *
 * @since  4.0.0
 */
class RemoveOldFilesCommand 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('Removing Old Files');

		// Import the dependencies
		\JLoader::import('joomla.filesystem.file');
		\JLoader::import('joomla.filesystem.folder');

		// We need the update script
		\JLoader::register('JoomlaInstallerScript', JPATH_ADMINISTRATOR . '/components/com_admin/script.php');

		(new \JoomlaInstallerScript)->deleteUnexistingFiles();

		$symfonyStyle->success('Files removed');

		return 0;
	}

	/**
	 * Initialise the command.
	 *
	 * @return  void
	 *
	 * @since   4.0.0
	 */
	protected function initialise()
	{
		$this->setName('update:joomla:remove-old-files');
		$this->setDescription('Removes old system files');
		$this->setHelp(
<<<EOF
The <info>%command.name%</info> command removes old files which should have been deleted during a Joomla update

<info>php %command.full_name%</info>
EOF
		);
	}
}

No other release has this exact content. See every version of this file.