Commit 64b98560 authored by Thomas Löffler's avatar Thomas Löffler

Merge branch '75-use-namespaces-and-new-class-names-in-the-tasks' into 'develop'

Resolve "Use namespaces and new class names in the tasks"

Closes #75

See merge request !91
parents 36a35f33 501bb457
Pipeline #1126 passed with stages
in 3 minutes and 46 seconds
<?php <?php
namespace T3o\TerFe2\Cache;
/******************************************************************* /*******************************************************************
* Copyright notice * Copyright notice
* *
...@@ -26,7 +28,7 @@ ...@@ -26,7 +28,7 @@
/** /**
* Cache for extension files * Cache for extension files
*/ */
class Tx_TerFe2_Cache_FileCache implements \TYPO3\CMS\Core\SingletonInterface class FileCache implements \TYPO3\CMS\Core\SingletonInterface
{ {
/** /**
...@@ -44,9 +46,9 @@ class Tx_TerFe2_Cache_FileCache implements \TYPO3\CMS\Core\SingletonInterface ...@@ -44,9 +46,9 @@ class Tx_TerFe2_Cache_FileCache implements \TYPO3\CMS\Core\SingletonInterface
public function setCacheDirectory($cacheDirectory) public function setCacheDirectory($cacheDirectory)
{ {
if (empty($cacheDirectory)) { if (empty($cacheDirectory)) {
throw new Exception('An empty cache directory is not allowed'); throw new \Exception('An empty cache directory is not allowed');
} }
$this->cacheDirectory = Tx_TerFe2_Utility_File::getAbsoluteDirectory($cacheDirectory); $this->cacheDirectory = \T3o\TerFe2\Utility\File::getAbsoluteDirectory($cacheDirectory);
} }
...@@ -70,7 +72,7 @@ class Tx_TerFe2_Cache_FileCache implements \TYPO3\CMS\Core\SingletonInterface ...@@ -70,7 +72,7 @@ class Tx_TerFe2_Cache_FileCache implements \TYPO3\CMS\Core\SingletonInterface
public function getFile($filename) public function getFile($filename)
{ {
$filename = $this->getFilePath($filename); $filename = $this->getFilePath($filename);
if (Tx_TerFe2_Utility_File::fileExists($filename)) { if (\T3o\TerFe2\Utility\File::fileExists($filename)) {
return $filename; return $filename;
} }
return ''; return '';
...@@ -104,7 +106,7 @@ class Tx_TerFe2_Cache_FileCache implements \TYPO3\CMS\Core\SingletonInterface ...@@ -104,7 +106,7 @@ class Tx_TerFe2_Cache_FileCache implements \TYPO3\CMS\Core\SingletonInterface
return ''; return '';
} }
$filename = $this->getFilePath($filename); $filename = $this->getFilePath($filename);
if (Tx_TerFe2_Utility_File::copyFile($fileUrl, $filename)) { if (\T3o\TerFe2\Utility\File::copyFile($fileUrl, $filename)) {
return $filename; return $filename;
} }
return ''; return '';
...@@ -135,7 +137,7 @@ class Tx_TerFe2_Cache_FileCache implements \TYPO3\CMS\Core\SingletonInterface ...@@ -135,7 +137,7 @@ class Tx_TerFe2_Cache_FileCache implements \TYPO3\CMS\Core\SingletonInterface
public function removeFile($filename) public function removeFile($filename)
{ {
$filename = $this->getFilePath($filename); $filename = $this->getFilePath($filename);
if (!Tx_TerFe2_Utility_File::fileExists($fileUrl)) { if (!\T3o\TerFe2\Utility\File::fileExists($fileUrl)) {
return FALSE; return FALSE;
} }
return unlink($filename); return unlink($filename);
...@@ -169,7 +171,7 @@ class Tx_TerFe2_Cache_FileCache implements \TYPO3\CMS\Core\SingletonInterface ...@@ -169,7 +171,7 @@ class Tx_TerFe2_Cache_FileCache implements \TYPO3\CMS\Core\SingletonInterface
} }
$cacheDirectory = $this->getCacheDirectory(); $cacheDirectory = $this->getCacheDirectory();
if (empty($cacheDirectory)) { if (empty($cacheDirectory)) {
throw new Exception('No cache directory defined'); throw new \Exception('No cache directory defined');
} }
return $cacheDirectory . $filename; return $cacheDirectory . $filename;
} }
......
<?php <?php
namespace T3o\TerFe2\Controller;
/******************************************************************* /*******************************************************************
* Copyright notice * Copyright notice
* *
...@@ -26,18 +28,18 @@ ...@@ -26,18 +28,18 @@
/** /**
* Abstract controller * Abstract controller
*/ */
abstract class Tx_TerFe2_Controller_AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{ {
/** /**
* @var Tx_TerFe2_Security_Role * @var \T3o\TerFe2\Security\Role;
*/ */
protected $securityRole; protected $securityRole;
/** /**
* @param Tx_TerFe2_Security_Role $securityRole * @param \T3o\TerFe2\Security\Role $securityRole
*/ */
public function injectSecurityRole(Tx_TerFe2_Security_Role $securityRole) public function injectSecurityRole(\T3o\TerFe2\Security\Role $securityRole)
{ {
$this->securityRole = $securityRole; $this->securityRole = $securityRole;
} }
...@@ -50,7 +52,7 @@ abstract class Tx_TerFe2_Controller_AbstractController extends \TYPO3\CMS\Extbas ...@@ -50,7 +52,7 @@ abstract class Tx_TerFe2_Controller_AbstractController extends \TYPO3\CMS\Extbas
public function initializeAction() public function initializeAction()
{ {
// Pre-parse settings // Pre-parse settings
$this->settings = Tx_TerFe2_Utility_TypoScript::parse($this->settings); $this->settings = \T3o\TerFe2\Utility\TypoScript::parse($this->settings);
// Initialize the controller // Initialize the controller
$this->initializeController(); $this->initializeController();
......
<?php <?php
namespace T3o\TerFe2\Controller;
/******************************************************************* /*******************************************************************
* Copyright notice * Copyright notice
* *
...@@ -26,7 +28,7 @@ ...@@ -26,7 +28,7 @@
/** /**
* Abstract controller * Abstract controller
*/ */
abstract class Tx_TerFe2_Controller_AbstractTerBasedController extends Tx_TerFe2_Controller_AbstractController abstract class AbstractTerBasedController extends \T3o\TerFe2\Controller\AbstractController
{ {
/** /**
...@@ -35,7 +37,7 @@ abstract class Tx_TerFe2_Controller_AbstractTerBasedController extends Tx_TerFe2 ...@@ -35,7 +37,7 @@ abstract class Tx_TerFe2_Controller_AbstractTerBasedController extends Tx_TerFe2
protected $frontendUser = array(); protected $frontendUser = array();
/** /**
* @var Tx_TerFe2_Service_Ter * @var \T3o\TerFe2\Service\Ter
*/ */
protected $terConnection; protected $terConnection;
...@@ -105,18 +107,18 @@ abstract class Tx_TerFe2_Controller_AbstractTerBasedController extends Tx_TerFe2 ...@@ -105,18 +107,18 @@ abstract class Tx_TerFe2_Controller_AbstractTerBasedController extends Tx_TerFe2
/** /**
* Create a connection to the TER server * Create a connection to the TER server
* *
* @return Tx_TerFe2_Service_Ter The TER connection * @return \T3o\TerFe2\Service\Ter The TER connection
*/ */
protected function getTerConnection() protected function getTerConnection()
{ {
// Check the wsdl uri // Check the wsdl uri
if (empty($this->terSettings['wsdl'])) { if (empty($this->terSettings['wsdl'])) {
throw new Exception('No wsdl set to connect to TER server'); throw new \Exception('No wsdl set to connect to TER server');
} }
// Create connection // Create connection
$wsdl = $this->terSettings['wsdl']; $wsdl = $this->terSettings['wsdl'];
return $this->objectManager->get('Tx_TerFe2_Service_Ter', $wsdl, $this->terAccount['username'], $this->terAccount['password']); return $this->objectManager->get(\T3o\TerFe2\Service\Ter::class, $wsdl, $this->terAccount['username'], $this->terAccount['password']);
} }
} }
<?php <?php
namespace T3o\TerFe2\Controller;
/******************************************************************* /*******************************************************************
* Copyright notice * Copyright notice
* *
...@@ -26,16 +28,16 @@ ...@@ -26,16 +28,16 @@
/** /**
* Controller for the author object * Controller for the author object
*/ */
class Tx_TerFe2_Controller_AuthorController extends Tx_TerFe2_Controller_AbstractController class AuthorController extends \T3o\TerFe2\Controller\AbstractController
{ {
/** /**
* @var Tx_TerFe2_Domain_Repository_AuthorRepository * @var \T3o\TerFe2\Domain\Repository\AuthorRepository
*/ */
protected $authorRepository; protected $authorRepository;
/** /**
* @var Tx_TerFe2_Domain_Repository_ExtensionRepository * @var \T3o\TerFe2\Domain\Repository\ExtensionRepository
*/ */
protected $extensionRepository; protected $extensionRepository;
...@@ -47,8 +49,8 @@ class Tx_TerFe2_Controller_AuthorController extends Tx_TerFe2_Controller_Abstrac ...@@ -47,8 +49,8 @@ class Tx_TerFe2_Controller_AuthorController extends Tx_TerFe2_Controller_Abstrac
*/ */
protected function initializeController() protected function initializeController()
{ {
$this->authorRepository = $this->objectManager->get('Tx_TerFe2_Domain_Repository_AuthorRepository'); $this->authorRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\AuthorRepository::class);
$this->extensionRepository = $this->objectManager->get('Tx_TerFe2_Domain_Repository_ExtensionRepository'); $this->extensionRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\ExtensionRepository::class);
} }
...@@ -66,10 +68,10 @@ class Tx_TerFe2_Controller_AuthorController extends Tx_TerFe2_Controller_Abstrac ...@@ -66,10 +68,10 @@ class Tx_TerFe2_Controller_AuthorController extends Tx_TerFe2_Controller_Abstrac
/** /**
* Action that displays a single author * Action that displays a single author
* *
* @param Tx_TerFe2_Domain_Model_Author $author The author to display * @param \T3o\TerFe2\Domain\Model\Author $author The author to display
* @return void * @return void
*/ */
public function showAction(Tx_TerFe2_Domain_Model_Author $author) public function showAction(\T3o\TerFe2\Domain\Model\Author $author)
{ {
$this->view->assign('author', $author); $this->view->assign('author', $author);
$authorExtensions = $this->extensionRepository->findByAuthor($author); $authorExtensions = $this->extensionRepository->findByAuthor($author);
...@@ -80,11 +82,11 @@ class Tx_TerFe2_Controller_AuthorController extends Tx_TerFe2_Controller_Abstrac ...@@ -80,11 +82,11 @@ class Tx_TerFe2_Controller_AuthorController extends Tx_TerFe2_Controller_Abstrac
/** /**
* Displays a form to edit an existing author * Displays a form to edit an existing author
* *
* @param Tx_TerFe2_Domain_Model_Author $author The author to display * @param \T3o\TerFe2\Domain\Model\Author $author The author to display
* @return void * @return void
* @dontvalidate $author * @dontvalidate $author
*/ */
public function editAction(Tx_TerFe2_Domain_Model_Author $author) public function editAction(\T3o\TerFe2\Domain\Model\Author $author)
{ {
$this->view->assign('author', $author); $this->view->assign('author', $author);
} }
...@@ -93,10 +95,10 @@ class Tx_TerFe2_Controller_AuthorController extends Tx_TerFe2_Controller_Abstrac ...@@ -93,10 +95,10 @@ class Tx_TerFe2_Controller_AuthorController extends Tx_TerFe2_Controller_Abstrac
/** /**
* Updates an existing author * Updates an existing author
* *
* @param Tx_TerFe2_Domain_Model_Author $author Author to update * @param \T3o\TerFe2\Domain\Model\Author $author Author to update
* @return void * @return void
*/ */
public function updateAction(Tx_TerFe2_Domain_Model_Author $author) public function updateAction(\T3o\TerFe2\Domain\Model\Author $author)
{ {
$this->authorRepository->update($author); $this->authorRepository->update($author);
$this->redirectWithMessage($this->translate('msg.author_updated'), 'list'); $this->redirectWithMessage($this->translate('msg.author_updated'), 'list');
......
<?php <?php
namespace T3o\TerFe2\Controller\Eid;
/* /*
* This file is part of the TYPO3 CMS project. * This file is part of the TYPO3 CMS project.
...@@ -14,9 +15,9 @@ ...@@ -14,9 +15,9 @@
*/ */
/** /**
* Class Tx_TerFe2_Controller_Eid_ExtensionController * Class \T3o\TerFe2\Controller\Eid\ExtensionController
*/ */
class Tx_TerFe2_Controller_Eid_ExtensionController class ExtensionController
{ {
/** /**
...@@ -90,5 +91,5 @@ class Tx_TerFe2_Controller_Eid_ExtensionController ...@@ -90,5 +91,5 @@ class Tx_TerFe2_Controller_Eid_ExtensionController
} }
} }
$controller = new Tx_TerFe2_Controller_Eid_ExtensionController(); $controller = new ExtensionController();
$controller->dispatch(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('action')); $controller->dispatch(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('action'));
<?php <?php
namespace T3o\TerFe2\Controller;
/******************************************************************* /*******************************************************************
* Copyright notice * Copyright notice
* *
...@@ -26,36 +28,36 @@ ...@@ -26,36 +28,36 @@
/** /**
* Controller for the extension object * Controller for the extension object
*/ */
class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_AbstractController class ExtensionController extends \T3o\TerFe2\Controller\AbstractController
{ {
/** /**
* @var Tx_TerFe2_Domain_Repository_ExtensionRepository * @var \T3o\TerFe2\Domain\Repository\ExtensionRepository
*/ */
protected $extensionRepository; protected $extensionRepository;
/** /**
* @var Tx_TerFe2_Domain_Repository_TagRepository * @var \T3o\TerFe2\Domain\Repository\TagRepository
*/ */
protected $tagRepository; protected $tagRepository;
/** /**
* @var Tx_TerFe2_Domain_Repository_AuthorRepository * @var \T3o\TerFe2\Domain\Repository\AuthorRepository
*/ */
protected $authorRepository; protected $authorRepository;
/** /**
* @var Tx_TerFe2_Domain_Repository_VersionRepository * @var \T3o\TerFe2\Domain\Repository\VersionRepository
*/ */
protected $versionRepository; protected $versionRepository;
/** /**
* @var Tx_TerFe2_Provider_ProviderManager * @var \T3o\TerFe2\Provider\ProviderManager
*/ */
protected $providerManager; protected $providerManager;
/** /**
* @var Tx_TerFe2_Persistence_Session * @var \T3o\TerFe2\Persistence\Session
*/ */
protected $session; protected $session;
...@@ -81,13 +83,13 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst ...@@ -81,13 +83,13 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
*/ */
protected function initializeController() protected function initializeController()
{ {
$this->extensionRepository = $this->objectManager->get('Tx_TerFe2_Domain_Repository_ExtensionRepository'); $this->extensionRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\ExtensionRepository::class);
$this->tagRepository = $this->objectManager->get('Tx_TerFe2_Domain_Repository_TagRepository'); $this->tagRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\TagRepository::class);
$this->versionRepository = $this->objectManager->get('Tx_TerFe2_Domain_Repository_VersionRepository'); $this->versionRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\VersionRepository::class);
$this->authorRepository = $this->objectManager->get('Tx_TerFe2_Domain_Repository_AuthorRepository'); $this->authorRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\AuthorRepository::class);
$this->ownerRepository = $this->objectManager->get(\TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository::class); $this->ownerRepository = $this->objectManager->get(\TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository::class);
$this->providerManager = $this->objectManager->get('Tx_TerFe2_Provider_ProviderManager'); $this->providerManager = $this->objectManager->get(\T3o\TerFe2\Provider\ProviderManager::class);
$this->session = $this->objectManager->get('Tx_TerFe2_Persistence_Session'); $this->session = $this->objectManager->get(\T3o\TerFe2\Persistence\Session::class);
$this->persistenceManager = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class); $this->persistenceManager = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class);
// Show insecure extensions only for reviewers // Show insecure extensions only for reviewers
...@@ -174,22 +176,22 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst ...@@ -174,22 +176,22 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
/** /**
* Action that displays a single extension * Action that displays a single extension
* *
* @param Tx_TerFe2_Domain_Model_Extension $extension The extension to display * @param \T3o\TerFe2\Domain\Model\Extension $extension The extension to display
* @param string $extensionKey Extension key * @param string $extensionKey Extension key
* @return void * @return void
* *
* @ignorevalidation $extension * @ignorevalidation $extension
*/ */
public function showAction(Tx_TerFe2_Domain_Model_Extension $extension = NULL, $extensionKey = NULL) public function showAction(\T3o\TerFe2\Domain\Model\Extension $extension = NULL, $extensionKey = NULL)
{ {
if (!empty($extensionKey)) { if (!empty($extensionKey)) {
if (!is_string($extensionKey)) { if (!is_string($extensionKey)) {
throw new Exception('No valid extension key given'); throw new \Exception('No valid extension key given');
} }
$extension = $this->extensionRepository->findOneByExtKey($extensionKey); $extension = $this->extensionRepository->findOneByExtKey($extensionKey);
} }
$owner = array(); $owner = array();
if ($extension instanceof Tx_TerFe2_Domain_Model_Extension and $extension->getFrontendUser()) { if ($extension instanceof \T3o\TerFe2\Domain\Model\Extension and $extension->getFrontendUser()) {
$owner = $this->ownerRepository->findOneByUsername($extension->getFrontendUser()); $owner = $this->ownerRepository->findOneByUsername($extension->getFrontendUser());
} }
$versionHistoryCount = (!empty($this->settings['versionHistoryCount']) ? $this->settings['versionHistoryCount'] : 5); $versionHistoryCount = (!empty($this->settings['versionHistoryCount']) ? $this->settings['versionHistoryCount'] : 5);
...@@ -198,7 +200,7 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst ...@@ -198,7 +200,7 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
//$loggedInUser = $this->ownerRepository->findCurrent(); //$loggedInUser = $this->ownerRepository->findCurrent();
if ($extension !== NULL && if ($extension !== NULL &&
$extension instanceof Tx_TerFe2_Domain_Model_Extension && $extension instanceof \T3o\TerFe2\Domain\Model\Extension &&
( (
$this->securityRole->isReviewer() || $this->securityRole->isReviewer() ||
($extension->getLastVersion() && $extension->getLastVersion()->getReviewState() != -1) ($extension->getLastVersion() && $extension->getLastVersion()->getReviewState() != -1)
...@@ -210,8 +212,8 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst ...@@ -210,8 +212,8 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
$this->view->assign('versionHistory', $versionHistory); $this->view->assign('versionHistory', $versionHistory);
$this->view->assign('loggedInUser', $loggedInUser); $this->view->assign('loggedInUser', $loggedInUser);
/** @var Tx_TerFe2_Service_Documentation $documentationService */ /** @var \T3o\TerFe2\Service\Documentation $documentationService */
//$documentationService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_TerFe2_Service_Documentation'); //$documentationService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('\T3o\TerFe2\Service\Documentation');
//$documentationLink = $documentationService->getDocumentationLink($extension->getExtKey(), $extension->getLastVersion()->getVersionString()); //$documentationLink = $documentationService->getDocumentationLink($extension->getExtKey(), $extension->getLastVersion()->getVersionString());
$this->view->assign('documentationLink', $documentationLink); $this->view->assign('documentationLink', $documentationLink);
...@@ -272,11 +274,11 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst ...@@ -272,11 +274,11 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
/** /**
* Displays a form for creating a new extension * Displays a form for creating a new extension
* *
* @param Tx_TerFe2_Domain_Model_Extension $newExtension New extension object * @param \T3o\TerFe2\Domain\Model\Extension $newExtension New extension object
* @return void * @return void
* @dontvalidate $newExtension * @dontvalidate $newExtension
*/ */
public function newAction(Tx_TerFe2_Domain_Model_Extension $newExtension = NULL) public function newAction(\T3o\TerFe2\Domain\Model\Extension $newExtension = NULL)
{ {