- md5
- b9959c60ef20c287b9e94358b6001a6e
- sha1
- 7e142b94ceb1e268a3b5b580b4e7e4557eeaf52f
- sha256
- 926010ef8106834f51c9f3783795f46b6443fb7cf21475d45c8cd541f1959b9c
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
<?php
/**
* @package Joomla.Administrator
* @subpackage com_postinstall
*
* @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\Component\Postinstall\Administrator\Controller;
defined('_JEXEC') or die;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\Component\Postinstall\Administrator\Helper\PostinstallHelper;
use Joomla\Component\Postinstall\Administrator\Model\MessagesModel;
/**
* Postinstall message controller.
*
* @since 3.2
*/
class MessageController extends BaseController
{
/**
* Resets all post-installation messages of the specified extension.
*
* @return void
*
* @since 3.2
*/
public function reset()
{
/** @var MessagesModel $model */
$model = $this->getModel('Messages', '', array('ignore_request' => true));
$eid = (int) $model->getState('eid', $model->getJoomlaFilesExtensionId());
if (empty($eid))
{
$eid = $model->getJoomlaFilesExtensionId();
}
$model->resetMessages($eid);
$this->setRedirect('index.php?option=com_postinstall&eid=' . $eid);
}
/**
* Unpublishes post-installation message of the specified extension.
*
* @return void
*
* @since 3.2
*/
public function unpublish()
{
$model = $this->getModel('Messages', '', array('ignore_request' => true));
$id = $this->input->get('id');
$eid = (int) $model->getState('eid', $model->getJoomlaFilesExtensionId());
if (empty($eid))
{
$eid = $model->getJoomlaFilesExtensionId();
}
$model->setState('published', 0);
$model->unpublishMessage($id);
$this->setRedirect('index.php?option=com_postinstall&eid=' . $eid);
}
/**
* Executes the action associated with an item.
*
* @return void
*
* @since 3.2
*/
public function action()
{
$model = $this->getModel('Messages', '', array('ignore_request' => true));
$id = $this->input->get('id');
$item = $model->getItem($id);
switch ($item->type)
{
case 'link':
$this->setRedirect($item->action);
return;
break;
case 'action':
$helper = new PostinstallHelper;
$file = $helper->parsePath($item->action_file);
if (File::exists($file))
{
require_once $file;
call_user_func($item->action);
}
break;
case 'message':
default:
break;
}
$this->setRedirect('index.php?option=com_postinstall');
}
/**
* Hides all post-installation messages of the specified extension.
*
* @return void
*
* @since 3.8.7
*/
public function hideAll()
{
/** @var MessagesModel $model */
$model = $this->getModel('Messages', '', array('ignore_request' => true));
$eid = (int) $model->getState('eid', $model->getJoomlaFilesExtensionId(), 'int');
if (empty($eid))
{
$eid = $model->getJoomlaFilesExtensionId();
}
$model->hideMessages($eid);
$this->setRedirect('index.php?option=com_postinstall&eid=' . $eid);
}
}
The same content is in 5 releases, Joomla 4.0.0-alpha8 to 4.0.0-alpha12. See them all, or every version of this file.