Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
extensions.typo3.org
extensions.typo3.org
Commits
178923ce
Commit
178923ce
authored
Apr 14, 2017
by
Jens Jacobsen
Browse files
[TASK] Cleanup extension tables and models
Removing category, experience, media and search tables.
parent
030ff7b9
Pipeline
#323
passed with stages
in 1 minute and 39 seconds
Changes
50
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
html/typo3conf/ext/ter_fe2/Classes/Controller/CategoryController.php
deleted
100755 → 0
View file @
030ff7b9
<?php
/*******************************************************************
* Copyright notice
*
* (c) 2011 Kai Vogel <kai.vogel@speedprogs.de>, Speedprogs.de
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
******************************************************************/
/**
* Controller for the category object
*/
class
Tx_TerFe2_Controller_CategoryController
extends
Tx_TerFe2_Controller_AbstractController
{
/**
* @var Tx_TerFe2_Domain_Repository_CategoryRepository
*/
protected
$categoryRepository
;
/**
* @var Tx_TerFe2_Domain_Repository_ExtensionRepository
*/
protected
$extensionRepository
;
/**
* Initializes the controller
*
* @return void
*/
protected
function
initializeController
()
{
$this
->
categoryRepository
=
$this
->
objectManager
->
get
(
'Tx_TerFe2_Domain_Repository_CategoryRepository'
);
$this
->
extensionRepository
=
$this
->
objectManager
->
get
(
'Tx_TerFe2_Domain_Repository_ExtensionRepository'
);
}
/**
* List action, displays all categories
*
* @return void
*/
public
function
listAction
()
{
$this
->
view
->
assign
(
'categories'
,
$this
->
categoryRepository
->
findAll
());
}
/**
* Action that displays a single category
*
* @param Tx_TerFe2_Domain_Model_Category $category The category to display
* @return void
*/
public
function
showAction
(
Tx_TerFe2_Domain_Model_Category
$category
)
{
$this
->
view
->
assign
(
'category'
,
$category
);
$categoryExtensions
=
$this
->
extensionRepository
->
findByCategory
(
$category
);
$this
->
view
->
assign
(
'categoryExtensions'
,
$categoryExtensions
);
}
/**
* Displays a form for creating a new category
*
* @param Tx_TerFe2_Domain_Model_Category $newCategory New category object
* @return void
* @dontvalidate $newCategory
*/
public
function
newAction
(
Tx_TerFe2_Domain_Model_Category
$newCategory
=
NULL
)
{
$this
->
view
->
assign
(
'newCategory'
,
$newCategory
);
}
/**
* Creates a new category
*
* @param Tx_TerFe2_Domain_Model_Category $newCategory New category object
* @return void
*/
public
function
createAction
(
Tx_TerFe2_Domain_Model_Category
$newCategory
)
{
$this
->
categoryRepository
->
add
(
$newCategory
);
$this
->
redirectWithMessage
(
$this
->
translate
(
'msg.category_created'
),
'list'
);
}
/**
* Displays a form to edit an existing category
*
* @param Tx_TerFe2_Domain_Model_Category $category The category to display
* @return void
* @dontvalidate $category
*/
public
function
editAction
(
Tx_TerFe2_Domain_Model_Category
$category
)
{
$this
->
view
->
assign
(
'category'
,
$category
);
}
/**
* Updates an existing category
*
* @param Tx_TerFe2_Domain_Model_Category $category Category to update
* @return void
*/
public
function
updateAction
(
Tx_TerFe2_Domain_Model_Category
$category
)
{
$this
->
categoryRepository
->
update
(
$category
);
$this
->
redirectWithMessage
(
$this
->
translate
(
'msg.category_updated'
),
'list'
);
}
/**
* Deletes an existing category
*
* @param Tx_TerFe2_Domain_Model_Category $category The category to delete
* @return void
*/
public
function
deleteAction
(
Tx_TerFe2_Domain_Model_Category
$category
)
{
$this
->
categoryRepository
->
remove
(
$category
);
$this
->
redirectWithMessage
(
$this
->
translate
(
'msg.category_deleted'
),
'list'
);
}
}
html/typo3conf/ext/ter_fe2/Classes/Controller/ExtensionController.php
View file @
178923ce
...
...
@@ -34,11 +34,6 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
*/
protected
$extensionRepository
;
/**
* @var Tx_TerFe2_Domain_Repository_CategoryRepository
*/
protected
$categoryRepository
;
/**
* @var Tx_TerFe2_Domain_Repository_TagRepository
*/
...
...
@@ -87,7 +82,6 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
protected
function
initializeController
()
{
$this
->
extensionRepository
=
$this
->
objectManager
->
get
(
'Tx_TerFe2_Domain_Repository_ExtensionRepository'
);
$this
->
categoryRepository
=
$this
->
objectManager
->
get
(
'Tx_TerFe2_Domain_Repository_CategoryRepository'
);
$this
->
tagRepository
=
$this
->
objectManager
->
get
(
'Tx_TerFe2_Domain_Repository_TagRepository'
);
$this
->
versionRepository
=
$this
->
objectManager
->
get
(
'Tx_TerFe2_Domain_Repository_VersionRepository'
);
$this
->
authorRepository
=
$this
->
objectManager
->
get
(
'Tx_TerFe2_Domain_Repository_AuthorRepository'
);
...
...
@@ -133,12 +127,6 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
$this
->
view
->
assign
(
'extensions'
,
$this
->
extensionRepository
->
findAll
());
}
// Get all categories
if
(
!
empty
(
$this
->
settings
[
'show'
][
'categoryOverview'
]))
{
$categories
=
$this
->
categoryRepository
->
findAll
();
$this
->
view
->
assign
(
'categories'
,
$categories
);
}
// Get all tags
if
(
!
empty
(
$this
->
settings
[
'show'
][
'tagOverview'
]))
{
$tags
=
$this
->
tagRepository
->
findAll
();
...
...
@@ -272,8 +260,6 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
$url
.
=
'&tags='
;
// adds hidden tag
$url
.
=
'&hidden=0'
;
// adds category
$url
.
=
'&category=software'
;
$this
->
view
->
assign
(
'flattrUrl'
,
$url
);
}
...
...
@@ -293,7 +279,6 @@ class Tx_TerFe2_Controller_ExtensionController extends Tx_TerFe2_Controller_Abst
public
function
newAction
(
Tx_TerFe2_Domain_Model_Extension
$newExtension
=
NULL
)
{
$this
->
view
->
assign
(
'newExtension'
,
$newExtension
);
$this
->
view
->
assign
(
'categories'
,
$this
->
categoryRepository
->
findAll
());
$this
->
view
->
assign
(
'tags'
,
$this
->
tagRepository
->
findAll
());
}
...
...
html/typo3conf/ext/ter_fe2/Classes/Controller/MediaController.php
deleted
100755 → 0
View file @
030ff7b9
<?php
/*******************************************************************
* Copyright notice
*
* (c) 2011 Kai Vogel <kai.vogel@speedprogs.de>, Speedprogs.de
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
******************************************************************/
/**
* Controller for the media object
*/
class
Tx_TerFe2_Controller_MediaController
extends
Tx_TerFe2_Controller_AbstractController
{
/**
* @var Tx_TerFe2_Domain_Repository_MediaRepository
*/
protected
$mediaRepository
;
/**
* @var Tx_TerFe2_Domain_Repository_ExtensionRepository
*/
protected
$extensionRepository
;
/**
* Initializes the controller
*
* @return void
*/
protected
function
initializeController
()
{
$this
->
mediaRepository
=
$this
->
objectManager
->
get
(
'Tx_TerFe2_Domain_Repository_MediaRepository'
);
}
/**
* List action, displays all media
*
* @return void
*/
public
function
listAction
()
{
$this
->
view
->
assign
(
'media'
,
$this
->
mediaRepository
->
findAll
());
}
/**
* Action that displays a single media
*
* @param Tx_TerFe2_Domain_Model_Category $media The media to display
* @return void
*/
public
function
showAction
(
Tx_TerFe2_Domain_Model_Media
$media
)
{
$this
->
view
->
assign
(
'media'
,
$media
);
}
/**
* Displays a form for creating a new media
*
* @param Tx_TerFe2_Domain_Model_Extension $extension The extension to add the new media
* @param Tx_TerFe2_Domain_Model_Media $newMedia New media object
* @return void
* @dontvalidate $newMedia
*/
public
function
newAction
(
Tx_TerFe2_Domain_Model_Extension
$extension
,
Tx_TerFe2_Domain_Model_Media
$newMedia
=
NULL
)
{
$this
->
view
->
assign
(
'newMedia'
,
$newMedia
);
$this
->
view
->
assign
(
'extension'
,
$extension
);
}
/**
* Creates a new media
*
* @param Tx_TerFe2_Domain_Model_Media $newMedia New media object
* @param Tx_TerFe2_Domain_Model_Extension $extension The extension to add the new media
* @return void
*/
public
function
createAction
(
Tx_TerFe2_Domain_Model_Media
$newMedia
,
Tx_TerFe2_Domain_Model_Extension
$extension
)
{
if
(
$media
=
$this
->
mediaRepository
->
findByTitle
(
$newMedia
->
getTitle
())
->
getFirst
())
{
$extension
->
addMedia
(
$media
);
}
else
{
$this
->
mediaRepository
->
add
(
$newMedia
);
$extension
->
addMedia
(
$newMedia
);
}
$actionParameters
=
array
(
'extension'
=>
$extension
);
$this
->
redirectWithMessage
(
$this
->
translate
(
'msg.media_created'
),
'show'
,
''
,
\
TYPO3\CMS\Core\Messaging\FlashMessage
::
OK
,
'Extension'
,
NULL
,
$actionParameters
);
}
/**
* Displays a form to edit an existing media
*
* @param Tx_TerFe2_Domain_Model_Media $media The media to display
* @return void
* @dontvalidate $media
*/
public
function
editAction
(
Tx_TerFe2_Domain_Model_Media
$media
)
{
$this
->
view
->
assign
(
'media'
,
$media
);
}
/**
* Updates an existing media
*
* @param Tx_TerFe2_Domain_Model_Media $media Media to update
* @return void
*/
public
function
updateAction
(
Tx_TerFe2_Domain_Model_Media
$media
)
{
$this
->
mediaRepository
->
update
(
$media
);
// TODO: Update extension too
$this
->
redirectWithMessage
(
$this
->
translate
(
'msg.media_updated'
),
'list'
);
}
/**
* Deletes an existing media
*
* @param Tx_TerFe2_Domain_Model_Media $media The media to delete
* @return void
*/
public
function
deleteAction
(
Tx_TerFe2_Domain_Model_Media
$media
)
{
$this
->
mediaRepository
->
remove
(
$media
);
// TODO: Remove from extension too
$this
->
redirectWithMessage
(
$this
->
translate
(
'msg.media_deleted'
),
'list'
);
}
}
html/typo3conf/ext/ter_fe2/Classes/Controller/RegisterkeyController.php
View file @
178923ce
...
...
@@ -41,11 +41,6 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
*/
protected
$versionRepository
;
/**
* @var Tx_TerFe2_Domain_Repository_CategoryRepository
*/
protected
$categoryRepository
;
/**
* @var Tx_TerFe2_Domain_Repository_UserRepository
*/
...
...
@@ -60,7 +55,6 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
{
$this
->
extensionRepository
=
$this
->
objectManager
->
get
(
'Tx_TerFe2_Domain_Repository_ExtensionRepository'
);
$this
->
versionRepository
=
$this
->
objectManager
->
get
(
'Tx_TerFe2_Domain_Repository_VersionRepository'
);
$this
->
categoryRepository
=
$this
->
objectManager
->
get
(
'Tx_TerFe2_Domain_Repository_CategoryRepository'
);
$this
->
userRepository
=
$this
->
objectManager
->
get
(
Tx_TerFe2_Domain_Repository_UserRepository
::
class
);
}
...
...
@@ -73,9 +67,6 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
*/
public
function
indexAction
(
$uploaded
=
FALSE
)
{
// get categories for register key
// $categories = $this->categoryRepository->findAll();
// $this->view->assign('categories', $categories);
// get extensions by user if a user is logged in
if
(
!
empty
(
$this
->
frontendUser
))
{
$extensions
=
$this
->
extensionRepository
->
findByFrontendUser
(
$this
->
frontendUser
[
'username'
]);
...
...
@@ -92,7 +83,7 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
* @param string $extensionKey Extension key
* @return void
*/
public
function
createAction
(
$extensionKey
/* , $categories */
)
public
function
createAction
(
$extensionKey
)
{
// Remove spaces from extensionKey if there are some
...
...
@@ -113,16 +104,6 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
$extension
->
setExtKey
(
$extensionKey
);
$extension
->
setFrontendUser
(
$this
->
frontendUser
[
'username'
]);
// Add categories
// foreach ($categories as $category) {
// if (isset($category['__identity']) && is_numeric($category['__identity'])) {
// $myCat = $this->categoryRepository->findByUid((int) $category['__identity']);
// if ($myCat != NULL) {
// $extension->addCategory($myCat);
// }
// }
// }
$this
->
extensionRepository
->
add
(
$extension
);
$this
->
addFlashMessage
(
''
,
$this
->
translate
(
'registerkey.key_registered'
),
\
TYPO3\CMS\Core\Messaging\FlashMessage
::
OK
...
...
@@ -287,21 +268,6 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
// check if the extension belongs to the current user
if
(
$this
->
securityRole
->
isReviewer
()
or
$extension
->
getFrontendUser
()
==
$this
->
userRepository
->
findCurrent
())
{
// Remove categories that are already set
$setCategories
=
$extension
->
getCategories
();
// Get all categories
$categories
=
$this
->
categoryRepository
->
findAll
();
$categoryArray
=
array
();
foreach
(
$categories
as
$key
=>
$category
)
{
$categoryArray
[]
=
array
(
'object'
=>
$category
,
'isChecked'
=>
$setCategories
->
contains
(
$category
),
);
}
$this
->
view
->
assign
(
'categories'
,
$categoryArray
);
$this
->
view
->
assign
(
'extension'
,
$extension
);
$this
->
view
->
assign
(
'loggedIn'
,
$this
->
userRepository
->
findCurrent
());
}
else
{
...
...
@@ -314,10 +280,9 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
* Update an existing extension
*
* @param Tx_TerFe2_Domain_Model_Extension $extension Extension to modify
* @param mixed $categories Categories to add / remove
* @return void
*/
public
function
updateAction
(
Tx_TerFe2_Domain_Model_Extension
$extension
,
$categories
)
public
function
updateAction
(
Tx_TerFe2_Domain_Model_Extension
$extension
)
{
// check if the extension belongs to the current user
...
...
@@ -336,7 +301,6 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
if
(
$this
->
terConnection
->
checkExtensionKey
(
$extension
->
getExtKey
(),
$error
))
{
$error
=
''
;
if
(
$this
->
terConnection
->
assignExtensionKey
(
$extension
->
getExtKey
(),
$this
->
frontendUser
[
'username'
],
$error
))
{
// Update categories
$this
->
extensionRepository
->
update
(
$extension
);
$this
->
addFlashMessage
(
$this
->
translate
(
'registerkey.key_updated'
,
''
,
\
TYPO3\CMS\Core\Messaging\FlashMessage
::
OK
));
$this
->
redirect
(
'index'
,
'Registerkey'
);
...
...
@@ -349,12 +313,6 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
$this
->
resolveWSErrorMessage
(
$error
.
'.message'
),
$this
->
resolveWSErrorMessage
(
$error
.
'.title'
),
\
TYPO3\CMS\Core\Messaging\FlashMessage
::
ERROR
);
}
}
else
{
// Update categories
$extension
=
$this
->
updateCategories
(
$extension
,
$categories
);
$this
->
extensionRepository
->
update
(
$extension
);
$this
->
addFlashMessage
(
$this
->
translate
(
'registerkey.key_updated'
,
''
,
\
TYPO3\CMS\Core\Messaging\FlashMessage
::
OK
));
$this
->
redirect
(
'index'
,
'Registerkey'
);
}
$this
->
redirect
(
'edit'
,
'Registerkey'
,
NULL
,
array
(
'extension'
=>
$extension
));
...
...
@@ -364,31 +322,6 @@ class Tx_TerFe2_Controller_RegisterkeyController extends Tx_TerFe2_Controller_Ab
}
}
/**
* Update the categories of an existing extension
*
* @param Tx_TerFe2_Domain_Model_Extension $extension
* @param mixed $categories Categories to update
* @return Tx_TerFe2_Domain_Model_Extension
*/
protected
function
updateCategories
(
Tx_TerFe2_Domain_Model_Extension
$extension
,
$categories
)
{
// Remove all categories
$extension
->
removeAllCategories
();
// Add selected categories
foreach
(
$categories
as
$category
)
{
if
(
isset
(
$category
[
'__identity'
])
&&
is_numeric
(
$category
[
'__identity'
]))
{
$myCat
=
$this
->
categoryRepository
->
findByUid
((
int
)
$category
[
'__identity'
]);
if
(
$myCat
!=
NULL
)
{
$extension
->
addCategory
(
$myCat
);
}
}
}
return
$extension
;
}
/**
* Transfer an extension key to another user
...
...
html/typo3conf/ext/ter_fe2/Classes/Domain/Model/Category.php
deleted
100644 → 0
View file @
030ff7b9
<?php
/*******************************************************************
* Copyright notice
*
* (c) 2011 Thomas Loeffler <loeffler@spooner-web.de>, Spooner Web
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
******************************************************************/
/**
* Frontend category of the extension
*/
class
Tx_TerFe2_Domain_Model_Category
extends
Tx_TerFe2_Domain_Model_AbstractValueObject
{
/**
* Title of the category
* @var string
* @validate NotEmpty
*/
protected
$title
;
/**
* Description of the category
* @var string
*/
protected
$description
;
/**
* Setter for title
*
* @param string $title Title of the category
* @return void
*/
public
function
setTitle
(
$title
)
{
$this
->
title
=
$title
;
}
/**
* Getter for title
*
* @return string Title of the category
*/
public
function
getTitle
()
{
return
$this
->
title
;
}
/**
* Setter for description
*
* @param string $description Description of the category
* @return void
*/
public
function
setDescription
(
$description
)
{
$this
->
description
=
$description
;
}
/**
* Getter for description
*
* @return string Description of the category
*/
public
function
getDescription
()
{
return
$this
->
description
;
}
}
html/typo3conf/ext/ter_fe2/Classes/Domain/Model/Experience.php
deleted
100644 → 0
View file @
030ff7b9
<?php
/*******************************************************************
* Copyright notice
*
* (c) 2011 Thomas Loeffler <loeffler@spooner-web.de>, Spooner Web
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of