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
2f639ab3
Commit
2f639ab3
authored
6 years ago
by
Stefan Galinski
Browse files
Options
Downloads
Patches
Plain Diff
[BUGFIX] Fix the complete broken code
parent
5c3596e1
No related branches found
Branches containing commit
Tags
1.6.3
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
+24
-56
24 additions, 56 deletions
Classes/SignalSlot/SitemapSignalSlot.php
with
24 additions
and
56 deletions
Classes/SignalSlot/SitemapSignalSlot.php
+
24
−
56
View file @
2f639ab3
...
...
@@ -26,21 +26,17 @@ namespace SGalinski\SgJobs\SignalSlot;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use
TYPO3\CMS\Core\Database\
Database
Connection
;
use
TYPO3\CMS\Core\Database\Connection
Pool
;
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
*/
class
SitemapSignalSlot
{
const
PLUGIN_NAME
=
'sgjobs_jobapplication'
;
/**
...
...
@@ -49,7 +45,7 @@ class SitemapSignalSlot {
protected
$uriBuilder
;
/**
*
b
efore the sitemap is generated
*
B
efore the sitemap is generated
*
* @param array $pageList
* @throws \TYPO3\CMS\Core\Error\Http\ServiceUnavailableException
...
...
@@ -60,28 +56,27 @@ class SitemapSignalSlot {
$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'
];
// find sites where job detail plugin is added
$rows
=
$databaseConnection
->
exec_SELECTgetRows
(
'pid, pages'
,
'tt_content'
,
'CType = "list" and list_type = "'
.
self
::
PLUGIN_NAME
.
'" and hidden = 0 and deleted = 0'
);
$queryBuilder
=
GeneralUtility
::
makeInstance
(
ConnectionPool
::
class
)
->
getQueryBuilderForTable
(
'pages'
);
$databaseResource
=
$queryBuilder
->
select
(
'pid'
,
'pages'
)
->
from
(
'tt_content'
)
->
where
(
$queryBuilder
->
expr
()
->
andX
(
$queryBuilder
->
expr
()
->
eq
(
'CType'
,
$queryBuilder
->
createNamedParameter
(
'list'
)),
$queryBuilder
->
expr
()
->
eq
(
'list_type'
,
$queryBuilder
->
createNamedParameter
(
self
::
PLUGIN_NAME
))
)
)
->
execute
();
$rows
=
$databaseResource
->
fetchAll
();
foreach
(
$rows
as
$row
)
{
$jobs
=
$this
->
getJobsByPid
(
$row
[
'pages'
]);
...
...
@@ -100,45 +95,18 @@ class SitemapSignalSlot {
}
/**
*
Initializes TSFE and sets $GLOBALS['TSFE']
*
Get all jobs stored on specific page ids
*
* @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
*
* @param string $pid
* @param string $pageList
* @return array|null
*/
private
function
getJobsByPid
(
$pid
)
{
/** @var $databaseConnection DatabaseConnection */
$databaseConnection
=
$GLOBALS
[
'TYPO3_DB'
];
$rows
=
$databaseConnection
->
exec_SELECTgetRows
(
'*'
,
'tx_sgjobs_domain_model_job'
,
'pid IN ('
.
$pid
.
')'
);
return
$rows
;
private
function
getJobsByPid
(
$pageList
)
{
$queryBuilder
=
GeneralUtility
::
makeInstance
(
ConnectionPool
::
class
)
->
getQueryBuilderForTable
(
'pages'
);
$databaseResource
=
$queryBuilder
->
select
(
'*'
)
->
from
(
'tx_sgjobs_domain_model_job'
)
->
where
(
$queryBuilder
->
expr
()
->
in
(
'pid'
,
$queryBuilder
->
createNamedParameter
(
$pageList
)))
->
execute
();
return
$databaseResource
->
fetchAll
();
}
}
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