Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_jobs
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_jobs
Commits
5c3596e1
Commit
5c3596e1
authored
6 years ago
by
Torsten Oppermann
Browse files
Options
Downloads
Patches
Plain Diff
[TASK] Fixing an error with sitemap generation via eid method
parent
90ab140f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!9
Feature entry registration
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Classes/SignalSlot/SitemapSignalSlot.php
+50
-7
50 additions, 7 deletions
Classes/SignalSlot/SitemapSignalSlot.php
with
50 additions
and
7 deletions
Classes/SignalSlot/SitemapSignalSlot.php
+
50
−
7
View file @
5c3596e1
...
...
@@ -28,8 +28,13 @@ namespace SGalinski\SgJobs\SignalSlot;
use
TYPO3\CMS\Core\Database\DatabaseConnection
;
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
use
TYPO3\CMS\Extbase\Configuration\ConfigurationManager
;
use
TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder
;
use
TYPO3\CMS\Extbase\Object\ObjectManager
;
use
TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
;
use
TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
;
use
TYPO3\CMS\Frontend\Page\PageGenerator
;
use
TYPO3\CMS\Frontend\Utility\EidUtility
;
/**
* Signal functions regarding sg_seo sitemap generation
...
...
@@ -47,8 +52,27 @@ class SitemapSignalSlot {
* before the sitemap is generated
*
* @param array $pageList
* @throws \TYPO3\CMS\Core\Error\Http\ServiceUnavailableException
*/
public
function
beforeSitemapGeneration
(
array
&
$pageList
)
{
$objectManager
=
GeneralUtility
::
makeInstance
(
ObjectManager
::
class
);
$request
=
$objectManager
->
get
(
\TYPO3\CMS\Extbase\Mvc\Web\Request
::
class
);
$request
->
setRequestUri
(
GeneralUtility
::
getIndpEnv
(
'TYPO3_REQUEST_URL'
));
$request
->
setBaseUri
(
GeneralUtility
::
getIndpEnv
(
'TYPO3_SITE_URL'
));
/** @var ObjectManager $objectManager */
$objectManager
=
GeneralUtility
::
makeInstance
(
ObjectManager
::
class
);
/** @var ContentObjectRenderer $contentObjectRenderer */
$contentObjectRenderer
=
$objectManager
->
get
(
ContentObjectRenderer
::
class
);
/** @var ConfigurationManager $configurationManager */
$configurationManager
=
$objectManager
->
get
(
ConfigurationManager
::
class
);
$configurationManager
->
setContentObject
(
$contentObjectRenderer
);
$this
->
uriBuilder
=
$objectManager
->
get
(
UriBuilder
::
class
);
$this
->
uriBuilder
->
injectConfigurationManager
(
$configurationManager
);
$this
->
initTSFE
();
/** @var $databaseConnection DatabaseConnection */
$databaseConnection
=
$GLOBALS
[
'TYPO3_DB'
];
...
...
@@ -62,16 +86,10 @@ class SitemapSignalSlot {
foreach
(
$rows
as
$row
)
{
$jobs
=
$this
->
getJobsByPid
(
$row
[
'pages'
]);
$objectManager
=
GeneralUtility
::
makeInstance
(
ObjectManager
::
class
);
$request
=
$objectManager
->
get
(
\TYPO3\CMS\Extbase\Mvc\Web\Request
::
class
);
$request
->
setRequestUri
(
GeneralUtility
::
getIndpEnv
(
'TYPO3_REQUEST_URL'
));
$request
->
setBaseUri
(
GeneralUtility
::
getIndpEnv
(
'TYPO3_SITE_URL'
));
$this
->
uriBuilder
=
$objectManager
->
get
(
UriBuilder
::
class
);
foreach
(
$jobs
as
$job
)
{
$url
=
$this
->
uriBuilder
->
reset
()
->
setTargetPageUid
(
$row
[
'pid'
])
->
setArguments
(
[
'tx_sgjobs_jobapplication'
=>
[
'jobId'
=>
$job
[
'uid'
]]]
)
->
buildFrontendUri
();
)
->
setCreateAbsoluteUri
(
TRUE
)
->
buildFrontendUri
();
$pageList
[]
=
[
'url'
=>
$url
,
...
...
@@ -81,6 +99,31 @@ class SitemapSignalSlot {
}
}
/**
* Initializes TSFE and sets $GLOBALS['TSFE']
*
* @return void
* @throws \RuntimeException
* @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Core\Error\Http\ServiceUnavailableException
*/
private
function
initTSFE
()
{
$GLOBALS
[
'TSFE'
]
=
$tsfe
=
GeneralUtility
::
makeInstance
(
TypoScriptFrontendController
::
class
,
$GLOBALS
[
'TYPO3_CONF_VARS'
],
GeneralUtility
::
_GP
(
'id'
),
''
);
/** @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $tsfe */
$tsfe
->
connectToDB
();
$tsfe
->
initFEuser
();
EidUtility
::
initTCA
();
$tsfe
->
determineId
();
$tsfe
->
initTemplate
();
$tsfe
->
getConfigArray
();
$tsfe
->
settingLanguage
();
// Get linkVars, absRefPrefix, etc
PageGenerator
::
pagegenInit
();
}
/**
* get all jobs stored on specific page ids
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment