CoreFiles by mySites.guru
DatabaseController.php70 lines, 1,729 bytes, from Joomla_4.0.0-alpha5-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha3
md5
fa49020e4715f76fbebaee582eab9703
sha1
a57f404467dab2b94a84b034b0bff45b7cc800e1
sha256
5a99059056cdac74427f7e539d0552a1b6a5d57508d2fbf60a5ab0584f19d158
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_installer
 *
 * @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\Component\Installer\Administrator\Controller;

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\Component\Installer\Administrator\Model\DatabaseModel;

/**
 * Installer Database Controller
 *
 * @since  2.5
 */
class DatabaseController extends BaseController
{
	/**
	 * Tries to fix missing database updates
	 *
	 * @return  void
	 *
	 * @throws  \Exception
	 *
	 * @since   2.5
	 * @todo    Purge updates has to be replaced with an events system
	 */
	public function fix()
	{
		// Check for request forgeries
		Session::checkToken() or die(Text::_('JINVALID_TOKEN'));

		// Get items to fix the database.
		$cid = $this->input->get('cid', array(), 'array');

		if (!is_array($cid) || count($cid) < 1)
		{
			$this->app->getLogger()->warning(
				Text::_(
					'COM_INSTALLER_ERROR_NO_EXTENSIONS_SELECTED'
				), array('category' => 'jerror')
			);
		}
		else
		{
			// Get the model
			/** @var DatabaseModel $model */
			$model = $this->getModel('Database');
			$model->fix($cid);

			$updateModel = $this->app->bootComponent('com_joomlaupdate')
				->getMVCFactory()->createModel('Update', 'Administrator', ['ignore_request' => true]);
			$updateModel->purge();

			// Refresh versionable assets cache
			$this->app->flushAssets();
		}

		$this->setRedirect(Route::_('index.php?option=com_installer&view=database', false));
	}
}

The same content is in 2 releases, Joomla 4.0.0-alpha5 to 4.0.0-alpha6. See them all, or every version of this file.