diff --git a/administrator/components/com_patchtester/PatchTester/Controller/AbstractController.php b/administrator/components/com_patchtester/PatchTester/Controller/AbstractController.php index 9de5bd7..6a164e3 100644 --- a/administrator/components/com_patchtester/PatchTester/Controller/AbstractController.php +++ b/administrator/components/com_patchtester/PatchTester/Controller/AbstractController.php @@ -9,6 +9,8 @@ namespace PatchTester\Controller; use Joomla\Application\AbstractApplication; +use Joomla\CMS\Application\CMSApplication; +use Joomla\CMS\Component\ComponentHelper; use Joomla\Registry\Registry; /** @@ -16,7 +18,7 @@ use Joomla\Registry\Registry; * * @since 2.0 * - * @method \JApplicationCms getApplication() getApplication() Get the application object. + * @method CMSApplication getApplication() getApplication() Get the application object. */ abstract class AbstractController extends \JControllerBase { @@ -66,7 +68,7 @@ abstract class AbstractController extends \JControllerBase $state = new Registry; // Load the parameters. - $params = \JComponentHelper::getParams('com_patchtester'); + $params = ComponentHelper::getParams('com_patchtester'); $state->set('github_user', $params->get('org', 'joomla')); $state->set('github_repo', $params->get('repo', 'joomla-cms')); diff --git a/administrator/components/com_patchtester/PatchTester/Controller/ApplyController.php b/administrator/components/com_patchtester/PatchTester/Controller/ApplyController.php index c7d2993..4b0f8b8 100644 --- a/administrator/components/com_patchtester/PatchTester/Controller/ApplyController.php +++ b/administrator/components/com_patchtester/PatchTester/Controller/ApplyController.php @@ -8,6 +8,7 @@ namespace PatchTester\Controller; +use Joomla\CMS\Factory; use PatchTester\Model\PullModel; /** @@ -28,7 +29,7 @@ class ApplyController extends AbstractController { try { - $model = new PullModel(null, \JFactory::getDbo()); + $model = new PullModel(null, Factory::getDbo()); // Initialize the state for the model $model->setState($this->initializeState($model)); diff --git a/administrator/components/com_patchtester/PatchTester/Controller/DisplayController.php b/administrator/components/com_patchtester/PatchTester/Controller/DisplayController.php index f81e5f8..3aac234 100644 --- a/administrator/components/com_patchtester/PatchTester/Controller/DisplayController.php +++ b/administrator/components/com_patchtester/PatchTester/Controller/DisplayController.php @@ -8,6 +8,7 @@ namespace PatchTester\Controller; +use Joomla\CMS\Factory; use Joomla\Registry\Registry; /** @@ -68,17 +69,17 @@ class DisplayController extends AbstractController if (!class_exists($viewClass)) { - throw new \RuntimeException(JText::sprintf('COM_PATCHTESTER_ERROR_VIEW_NOT_FOUND', $view, $format), 500); + throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_VIEW_NOT_FOUND', $view, $format), 500); } } if (!class_exists($modelClass)) { - throw new \RuntimeException(JText::sprintf('COM_PATCHTESTER_ERROR_MODEL_NOT_FOUND', $modelClass), 500); + throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_MODEL_NOT_FOUND', $modelClass), 500); } // Initialize the model class now; need to do it before setting the state to get required data from it - $model = new $modelClass($this->context, null, \JFactory::getDbo()); + $model = new $modelClass($this->context, null, Factory::getDbo()); // Initialize the state for the model $model->setState($this->initializeState($model)); diff --git a/administrator/components/com_patchtester/PatchTester/Controller/FetchController.php b/administrator/components/com_patchtester/PatchTester/Controller/FetchController.php index abd98a4..3b84812 100644 --- a/administrator/components/com_patchtester/PatchTester/Controller/FetchController.php +++ b/administrator/components/com_patchtester/PatchTester/Controller/FetchController.php @@ -8,6 +8,8 @@ namespace PatchTester\Controller; +use Joomla\CMS\Factory; +use Joomla\CMS\Response\JsonResponse; use PatchTester\Model\PullsModel; /** @@ -33,14 +35,14 @@ class FetchController extends AbstractController $this->getApplication()->setHeader('Pragma', 'no-cache'); $this->getApplication()->setHeader('Content-Type', $this->getApplication()->mimeType . '; charset=' . $this->getApplication()->charSet); - $session = \JFactory::getSession(); + $session = Factory::getSession(); try { // Fetch our page from the session $page = $session->get('com_patchtester_fetcher_page', 1); - $model = new PullsModel('com_patchtester.fetch', null, \JFactory::getDbo()); + $model = new PullsModel('com_patchtester.fetch', null, Factory::getDbo()); // Initialize the state for the model $model->setState($this->initializeState($model)); @@ -49,7 +51,7 @@ class FetchController extends AbstractController } catch (\Exception $e) { - $response = new \JResponseJson($e); + $response = new JsonResponse($e); $this->getApplication()->sendHeaders(); echo json_encode($response); @@ -87,7 +89,7 @@ class FetchController extends AbstractController } } - $response = new \JResponseJson($status, $message, false, true); + $response = new JsonResponse($status, $message, false, true); $this->getApplication()->sendHeaders(); echo json_encode($response); diff --git a/administrator/components/com_patchtester/PatchTester/Controller/ResetController.php b/administrator/components/com_patchtester/PatchTester/Controller/ResetController.php index 702dd3d..0a7666c 100644 --- a/administrator/components/com_patchtester/PatchTester/Controller/ResetController.php +++ b/administrator/components/com_patchtester/PatchTester/Controller/ResetController.php @@ -8,6 +8,7 @@ namespace PatchTester\Controller; +use Joomla\CMS\Factory; use PatchTester\Model\PullModel; use PatchTester\Model\PullsModel; use PatchTester\Model\TestsModel; @@ -32,9 +33,9 @@ class ResetController extends AbstractController { $hasErrors = false; - $pullModel = new PullModel(null, \JFactory::getDbo()); - $pullsModel = new PullsModel($this->context, null, \JFactory::getDbo()); - $testsModel = new TestsModel(null, \JFactory::getDbo()); + $pullModel = new PullModel(null, Factory::getDbo()); + $pullsModel = new PullsModel($this->context, null, Factory::getDbo()); + $testsModel = new TestsModel(null, Factory::getDbo()); // Check the applied patches in the database first $appliedPatches = $testsModel->getAppliedPatches(); @@ -113,7 +114,7 @@ class ResetController extends AbstractController if ($hasErrors) { $msg = \JText::sprintf( - 'COM_PATCHTESTER_RESET_HAS_ERRORS', JPATH_COMPONENT . '/backups', \JFactory::getDbo()->replacePrefix('#__patchtester_tests') + 'COM_PATCHTESTER_RESET_HAS_ERRORS', JPATH_COMPONENT . '/backups', Factory::getDbo()->replacePrefix('#__patchtester_tests') ); $type = 'warning'; } diff --git a/administrator/components/com_patchtester/PatchTester/Controller/RevertController.php b/administrator/components/com_patchtester/PatchTester/Controller/RevertController.php index b09b700..820d93c 100644 --- a/administrator/components/com_patchtester/PatchTester/Controller/RevertController.php +++ b/administrator/components/com_patchtester/PatchTester/Controller/RevertController.php @@ -8,6 +8,7 @@ namespace PatchTester\Controller; +use Joomla\CMS\Factory; use PatchTester\Model\PullModel; /** @@ -28,7 +29,7 @@ class RevertController extends AbstractController { try { - $model = new PullModel(null, \JFactory::getDbo()); + $model = new PullModel(null, Factory::getDbo()); // Initialize the state for the model $model->setState($this->initializeState($model)); diff --git a/administrator/components/com_patchtester/PatchTester/Controller/StartfetchController.php b/administrator/components/com_patchtester/PatchTester/Controller/StartfetchController.php index 5234988..c5385b7 100644 --- a/administrator/components/com_patchtester/PatchTester/Controller/StartfetchController.php +++ b/administrator/components/com_patchtester/PatchTester/Controller/StartfetchController.php @@ -8,9 +8,10 @@ namespace PatchTester\Controller; -use PatchTester\GitHub\Exception\UnexpectedResponse; +use Joomla\CMS\Factory; +use Joomla\CMS\Response\JsonResponse; +use Joomla\CMS\Session\Session; use PatchTester\Helper; -use PatchTester\Model\PullsModel; use PatchTester\Model\TestsModel; /** @@ -37,9 +38,9 @@ class StartfetchController extends AbstractController $this->getApplication()->setHeader('Content-Type', $this->getApplication()->mimeType . '; charset=' . $this->getApplication()->charSet); // Check for a valid token. If invalid, send a 403 with the error message. - if (!\JSession::checkToken('request')) + if (!Session::checkToken('request')) { - $response = new \JResponseJson(new \Exception(\JText::_('JINVALID_TOKEN'), 403)); + $response = new JsonResponse(new \Exception(\JText::_('JINVALID_TOKEN'), 403)); $this->getApplication()->sendHeaders(); echo json_encode($response); @@ -55,7 +56,7 @@ class StartfetchController extends AbstractController } catch (\Exception $e) { - $response = new \JResponseJson( + $response = new JsonResponse( new \Exception( \JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), @@ -72,9 +73,9 @@ class StartfetchController extends AbstractController // If over the API limit, we can't build this list if ($rate->resources->core->remaining < 10) { - $response = new \JResponseJson( + $response = new JsonResponse( new \Exception( - \JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', \JFactory::getDate($rate->resources->core->reset)), + \JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', Factory::getDate($rate->resources->core->reset)), 429 ) ); @@ -85,14 +86,14 @@ class StartfetchController extends AbstractController $this->getApplication()->close(1); } - $testsModel = new TestsModel(null, \JFactory::getDbo()); + $testsModel = new TestsModel(null, Factory::getDbo()); try { // Sanity check, ensure there aren't any applied patches if (count($testsModel->getAppliedPatches()) >= 1) { - $response = new \JResponseJson(new \Exception(\JText::_('COM_PATCHTESTER_ERROR_APPLIED_PATCHES'), 500)); + $response = new JsonResponse(new \Exception(\JText::_('COM_PATCHTESTER_ERROR_APPLIED_PATCHES'), 500)); $this->getApplication()->sendHeaders(); echo json_encode($response); @@ -102,7 +103,7 @@ class StartfetchController extends AbstractController } catch (\Exception $e) { - $response = new \JResponseJson($e); + $response = new JsonResponse($e); $this->getApplication()->sendHeaders(); echo json_encode($response); @@ -111,9 +112,9 @@ class StartfetchController extends AbstractController } // We're able to successfully pull data, prepare our environment - \JFactory::getSession()->set('com_patchtester_fetcher_page', 1); + Factory::getSession()->set('com_patchtester_fetcher_page', 1); - $response = new \JResponseJson( + $response = new JsonResponse( array('complete' => false, 'header' => \JText::_('COM_PATCHTESTER_FETCH_PROCESSING', true)), \JText::sprintf('COM_PATCHTESTER_FETCH_PAGE_NUMBER', 1), false, diff --git a/administrator/components/com_patchtester/PatchTester/GitHub/Exception/UnexpectedResponse.php b/administrator/components/com_patchtester/PatchTester/GitHub/Exception/UnexpectedResponse.php index 9faa072..f77c5c2 100644 --- a/administrator/components/com_patchtester/PatchTester/GitHub/Exception/UnexpectedResponse.php +++ b/administrator/components/com_patchtester/PatchTester/GitHub/Exception/UnexpectedResponse.php @@ -8,6 +8,8 @@ namespace PatchTester\GitHub\Exception; +use Joomla\CMS\Http\Response; + /** * Exception representing an unexpected response * @@ -18,7 +20,7 @@ class UnexpectedResponse extends \DomainException /** * The Response object. * - * @var \JHttpResponse + * @var Response * @since 3.0.0 */ private $response; @@ -26,14 +28,14 @@ class UnexpectedResponse extends \DomainException /** * Constructor * - * @param \JHttpResponse $response The Response object. - * @param string $message The Exception message to throw. - * @param integer $code The Exception code. - * @param \Exception $previous The previous exception used for the exception chaining. + * @param Response $response The Response object. + * @param string $message The Exception message to throw. + * @param integer $code The Exception code. + * @param \Exception $previous The previous exception used for the exception chaining. * * @since 3.0.0 */ - public function __construct(\JHttpResponse $response, $message = '', $code = 0, \Exception $previous = null) + public function __construct(Response $response, $message = '', $code = 0, \Exception $previous = null) { parent::__construct($message, $code, $previous); @@ -43,9 +45,9 @@ class UnexpectedResponse extends \DomainException /** * Get the Response object. * - * @return \JHttpResponse + * @return Response * - * @since 3.0.0 + * @since 3.0.0 */ public function getResponse() { diff --git a/administrator/components/com_patchtester/PatchTester/GitHub/GitHub.php b/administrator/components/com_patchtester/PatchTester/GitHub/GitHub.php index c1ca381..55da404 100644 --- a/administrator/components/com_patchtester/PatchTester/GitHub/GitHub.php +++ b/administrator/components/com_patchtester/PatchTester/GitHub/GitHub.php @@ -8,6 +8,10 @@ namespace PatchTester\GitHub; +use Joomla\CMS\Http\Http; +use Joomla\CMS\Http\HttpFactory; +use Joomla\CMS\Http\Response; +use Joomla\CMS\Uri\Uri; use Joomla\Registry\Registry; /** @@ -28,7 +32,7 @@ class GitHub /** * The HTTP client object to use in sending HTTP requests. * - * @var \JHttp + * @var Http * @since 3.0.0 */ protected $client; @@ -37,14 +41,14 @@ class GitHub * Constructor. * * @param Registry $options Connector options. - * @param \JHttp $client The HTTP client object. + * @param Http $client The HTTP client object. * * @since 3.0.0 */ - public function __construct(Registry $options = null, \JHttp $client = null) + public function __construct(Registry $options = null, Http $client = null) { $this->options = $options ?: new Registry; - $this->client = $client ?: \JHttpFactory::getHttp($options); + $this->client = $client ?: HttpFactory::getHttp($options); } /** @@ -63,8 +67,8 @@ class GitHub */ protected function fetchUrl($path, $page = 0, $limit = 0) { - // Get a new JUri object fousing the api url and given path. - $uri = new \JUri($this->options->get('api.url') . $path); + // Get a new Uri object using the API URL and given path. + $uri = new Uri($this->options->get('api.url') . $path); // Only apply basic authentication if an access token is not set if ($this->options->get('gh.token', false) === false) @@ -103,7 +107,7 @@ class GitHub /** * Get the HTTP client for this connector. * - * @return \JHttp + * @return Http * * @since 3.0.0 */ @@ -119,7 +123,7 @@ class GitHub * @param string $repo The name of the GitHub repository. * @param integer $pullId The pull request number. * - * @return \JHttpResponse + * @return Response * * @since 3.0.0 */ @@ -144,7 +148,7 @@ class GitHub * @param string $path The content path. * @param string $ref The name of the commit/branch/tag. Default: the repository’s default branch (usually master) * - * @return \JHttpResponse + * @return Response * * @since 3.0.0 */ @@ -156,7 +160,7 @@ class GitHub if ($ref) { - $url = new \JUri($prepared['url']); + $url = new Uri($prepared['url']); $url->setVar('ref', $ref); $prepared['url'] = (string) $url; @@ -172,7 +176,7 @@ class GitHub * @param string $repo The name of the GitHub repository. * @param integer $pullId The pull request number. * - * @return \JHttpResponse + * @return Response * * @since 3.0.0 */ @@ -194,7 +198,7 @@ class GitHub * @param integer $page The page number from which to get items. * @param integer $limit The number of items on a page. * - * @return \JHttpResponse + * @return Response * * @since 3.0.0 */ @@ -227,7 +231,7 @@ class GitHub * @param string $repo The name of the GitHub repository. * @param integer $pullId The pull request number. * - * @return \JHttpResponse + * @return Response * * @since 3.0.0 */ @@ -244,7 +248,7 @@ class GitHub /** * Get the rate limit for the authenticated user. * - * @return \JHttpResponse + * @return Response * * @since 3.0.0 */ @@ -258,15 +262,15 @@ class GitHub /** * Process the response and return it. * - * @param \JHttpResponse $response The response. - * @param integer $expectedCode The expected response code. + * @param Response $response The response. + * @param integer $expectedCode The expected response code. * - * @return \JHttpResponse + * @return Response * * @since 3.0.0 * @throws Exception\UnexpectedResponse */ - protected function processResponse(\JHttpResponse $response, $expectedCode = 200) + protected function processResponse(Response $response, $expectedCode = 200) { // Validate the response code. if ($response->code != $expectedCode) diff --git a/administrator/components/com_patchtester/PatchTester/Helper.php b/administrator/components/com_patchtester/PatchTester/Helper.php index da6976c..1f90911 100644 --- a/administrator/components/com_patchtester/PatchTester/Helper.php +++ b/administrator/components/com_patchtester/PatchTester/Helper.php @@ -8,6 +8,8 @@ namespace PatchTester; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Factory; use Joomla\Registry\Registry; use PatchTester\GitHub\GitHub; @@ -27,7 +29,7 @@ abstract class Helper */ public static function initializeGithub() { - $params = \JComponentHelper::getParams('com_patchtester'); + $params = ComponentHelper::getParams('com_patchtester'); $options = new Registry; @@ -54,7 +56,7 @@ abstract class Helper // Display a message about the lowered API limit without credentials else { - \JFactory::getApplication()->enqueueMessage(\JText::_('COM_PATCHTESTER_NO_CREDENTIALS'), 'notice'); + Factory::getApplication()->enqueueMessage(\JText::_('COM_PATCHTESTER_NO_CREDENTIALS'), 'notice'); } return new GitHub($options); diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullModel.php index 60b1c90..315f2a8 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullModel.php @@ -8,6 +8,8 @@ namespace PatchTester\Model; +use Joomla\CMS\Factory; +use Joomla\CMS\Version; use PatchTester\GitHub\Exception\UnexpectedResponse; use PatchTester\Helper; @@ -158,7 +160,7 @@ class PullModel extends \JModelDatabase if ($rate->resources->core->remaining == 0) { throw new \RuntimeException( - \JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', \JFactory::getDate($rate->resources->core->reset)) + \JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', Factory::getDate($rate->resources->core->reset)) ); } @@ -309,7 +311,7 @@ class PullModel extends \JModelDatabase $record = (object) array( 'pull_id' => $pull->number, 'data' => json_encode($parsedFiles), - 'patched_by' => \JFactory::getUser()->id, + 'patched_by' => Factory::getUser()->id, 'applied' => 1, 'applied_version' => JVERSION, ); @@ -327,7 +329,7 @@ class PullModel extends \JModelDatabase )->execute(); // Change the media version - $version = new \JVersion; + $version = new Version; $version->refreshMediaVersion(); return true; @@ -445,7 +447,7 @@ class PullModel extends \JModelDatabase } // Change the media version - $version = new \JVersion; + $version = new Version; $version->refreshMediaVersion(); return $this->removeTest($testRecord); diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php index 64d1b8a..aa5a752 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php @@ -8,8 +8,8 @@ namespace PatchTester\Model; +use Joomla\CMS\Pagination\Pagination; use Joomla\Registry\Registry; - use PatchTester\GitHub\Exception\UnexpectedResponse; use PatchTester\Helper; @@ -187,9 +187,9 @@ class PullsModel extends \JModelDatabase } /** - * Method to get a JPagination object for the data set. + * Method to get a Pagination object for the data set. * - * @return \JPagination A JPagination object for the data set. + * @return Pagination A Pagination object for the data set. * * @since 2.0 */ @@ -205,7 +205,7 @@ class PullsModel extends \JModelDatabase } // Create the pagination object and add the object to the internal cache. - $this->cache[$store] = new \JPagination($this->getTotal(), $this->getStart(), (int) $this->getState()->get('list.limit', 20)); + $this->cache[$store] = new Pagination($this->getTotal(), $this->getStart(), (int) $this->getState()->get('list.limit', 20)); return $this->cache[$store]; } diff --git a/administrator/components/com_patchtester/PatchTester/Model/TestsModel.php b/administrator/components/com_patchtester/PatchTester/Model/TestsModel.php index d2b88ab..ec7bdb6 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/TestsModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/TestsModel.php @@ -8,10 +8,6 @@ namespace PatchTester\Model; -use Joomla\Registry\Registry; - -use PatchTester\Helper; - /** * Methods supporting applied pull requests. * diff --git a/administrator/components/com_patchtester/PatchTester/View/Fetch/tmpl/default.php b/administrator/components/com_patchtester/PatchTester/View/Fetch/tmpl/default.php index ffbcde6..ad8ec56 100644 --- a/administrator/components/com_patchtester/PatchTester/View/Fetch/tmpl/default.php +++ b/administrator/components/com_patchtester/PatchTester/View/Fetch/tmpl/default.php @@ -6,6 +6,8 @@ * @license GNU General Public License version 2 or later */ +use Joomla\CMS\Factory; + /** @var \PatchTester\View\DefaultHtmlView $this */ \JHtml::_('jquery.framework'); @@ -20,5 +22,5 @@
- + diff --git a/administrator/components/com_patchtester/PatchTester/View/Pulls/PullsHtmlView.php b/administrator/components/com_patchtester/PatchTester/View/Pulls/PullsHtmlView.php index 8b99b1a..877275d 100644 --- a/administrator/components/com_patchtester/PatchTester/View/Pulls/PullsHtmlView.php +++ b/administrator/components/com_patchtester/PatchTester/View/Pulls/PullsHtmlView.php @@ -8,6 +8,10 @@ namespace PatchTester\View\Pulls; +use Joomla\CMS\Factory; +use Joomla\CMS\Pagination\Pagination; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\Registry\Registry; use PatchTester\TrackerHelper; use PatchTester\View\DefaultHtmlView; @@ -47,7 +51,7 @@ class PullsHtmlView extends DefaultHtmlView /** * Pagination object * - * @var \JPagination + * @var Pagination * @since 2.0 */ protected $pagination; @@ -55,7 +59,7 @@ class PullsHtmlView extends DefaultHtmlView /** * The model state * - * @var \Joomla\Registry\Registry + * @var Registry * @since 2.0 */ protected $state; @@ -111,7 +115,7 @@ class PullsHtmlView extends DefaultHtmlView // Set a warning on 4.0 branch if (version_compare(JVERSION, '4.0', 'ge')) { - \JFactory::getApplication()->enqueueMessage(\JText::_('COM_PATCHTESTER_40_WARNING'), 'warning'); + Factory::getApplication()->enqueueMessage(\JText::_('COM_PATCHTESTER_40_WARNING'), 'warning'); } return parent::render(); @@ -130,7 +134,7 @@ class PullsHtmlView extends DefaultHtmlView if (!count($this->envErrors)) { - $toolbar = \JToolbar::getInstance('toolbar'); + $toolbar = Toolbar::getInstance('toolbar'); $toolbar->appendButton( 'Popup', diff --git a/administrator/components/com_patchtester/patchtester.php b/administrator/components/com_patchtester/patchtester.php index 9d884f2..b1197a4 100644 --- a/administrator/components/com_patchtester/patchtester.php +++ b/administrator/components/com_patchtester/patchtester.php @@ -8,14 +8,16 @@ defined('_JEXEC') or die; +use Joomla\CMS\Factory; + // Access check. -if (!JFactory::getUser()->authorise('core.manage', 'com_patchtester')) +if (!Factory::getUser()->authorise('core.manage', 'com_patchtester')) { throw new RuntimeException(JText::_('JERROR_ALERTNOAUTHOR'), 403); } // Application reference -$app = JFactory::getApplication(); +$app = Factory::getApplication(); // Import our Composer autoloader to load the component classes require_once __DIR__ . '/vendor/autoload.php'; diff --git a/administrator/components/com_patchtester/script.php b/administrator/components/com_patchtester/script.php index 3628f60..254078d 100644 --- a/administrator/components/com_patchtester/script.php +++ b/administrator/components/com_patchtester/script.php @@ -6,12 +6,16 @@ * @license GNU General Public License version 2 or later */ +use Joomla\CMS\Factory; +use Joomla\CMS\Installer\Adapter\ComponentAdapter; +use Joomla\CMS\Installer\InstallerScript; + /** * Installation class to perform additional changes during install/uninstall/update * * @since 2.0 */ -class Com_PatchtesterInstallerScript extends JInstallerScript +class Com_PatchtesterInstallerScript extends InstallerScript { /** * Array of templates with supported overrides @@ -28,7 +32,7 @@ class Com_PatchtesterInstallerScript extends JInstallerScript */ public function __construct() { - $this->minimumJoomla = '3.7'; + $this->minimumJoomla = '3.8'; $this->minimumPhp = JOOMLA_MINIMUM_PHP; $this->deleteFiles = array( @@ -44,7 +48,7 @@ class Com_PatchtesterInstallerScript extends JInstallerScript /** * Function to perform changes during install * - * @param JInstallerAdapterComponent $parent The class calling this method + * @param ComponentAdapter $parent The class calling this method * * @return void * @@ -58,7 +62,7 @@ class Com_PatchtesterInstallerScript extends JInstallerScript /** * Function to perform changes during update * - * @param JInstallerAdapterComponent $parent The class calling this method + * @param ComponentAdapter $parent The class calling this method * * @return void * @@ -72,7 +76,7 @@ class Com_PatchtesterInstallerScript extends JInstallerScript /** * Function to perform changes during uninstall * - * @param JInstallerAdapterComponent $parent The class calling this method + * @param ComponentAdapter $parent The class calling this method * * @return void * @@ -106,15 +110,15 @@ class Com_PatchtesterInstallerScript extends JInstallerScript // If we couldn't remove any overrides, notify the user if (count($errorTemplates) > 0) { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_COULD_NOT_REMOVE_OVERRIDES', implode(', ', $errorTemplates))); + Factory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_COULD_NOT_REMOVE_OVERRIDES', implode(', ', $errorTemplates))); } } /** * Function to perform changes during postflight * - * @param string $type The action being performed - * @param JInstallerAdapterComponent $parent The class calling this method + * @param string $type The action being performed + * @param ComponentAdapter $parent The class calling this method * * @return void * @@ -168,7 +172,7 @@ class Com_PatchtesterInstallerScript extends JInstallerScript // If we couldn't remove any overrides, notify the user if (count($errorTemplates) > 0) { - JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_COULD_NOT_INSTALL_OVERRIDES', implode(', ', $errorTemplates))); + Factory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_COULD_NOT_INSTALL_OVERRIDES', implode(', ', $errorTemplates))); } } } diff --git a/administrator/templates/hathor/html/com_patchtester/pulls/default.php b/administrator/templates/hathor/html/com_patchtester/pulls/default.php index c53b0ac..7e448ad 100644 --- a/administrator/templates/hathor/html/com_patchtester/pulls/default.php +++ b/administrator/templates/hathor/html/com_patchtester/pulls/default.php @@ -6,6 +6,9 @@ * @license GNU General Public License version 2 or later */ +use Joomla\CMS\Factory; +use Joomla\CMS\Uri\Uri; + /** @var \PatchTester\View\Pulls\PullsHtmlView $this */ \JHtml::_('behavior.core'); @@ -20,7 +23,7 @@ $filterBranch = $this->escape($this->state->get('filter.branch')); $filterRtc = $this->escape($this->state->get('filter.rtc')); $colSpan = $this->trackerAlias !== false ? 8 : 7; -\JFactory::getDocument()->addStyleDeclaration( +Factory::getDocument()->addStyleDeclaration( ' .icon-48-patchtester { background-image:url("/media/com_patchtester/images/icon-48-patchtester.png"); } ' @@ -29,7 +32,7 @@ echo \JHtml::_( 'bootstrap.renderModal', 'modal-refresh', array( - 'url' => \JUri::root() . 'administrator/index.php?option=com_patchtester&view=fetch&tmpl=component', + 'url' => Uri::root() . 'administrator/index.php?option=com_patchtester&view=fetch&tmpl=component', 'title' => \JText::_('COM_PATCHTESTER_TOOLBAR_FETCH_DATA'), 'width' => '800px', 'height' => '300px' @@ -41,25 +44,25 @@ echo \JHtml::_(
- + - + - +