Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_seo
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
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_seo
Merge requests
!1
[TASk] Implementation
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
[TASk] Implementation
feature_upgrade_wizard
into
master
Overview
0
Commits
1
Changes
2
Merged
Torsten Oppermann
requested to merge
feature_upgrade_wizard
into
master
6 years ago
Overview
0
Commits
1
Changes
2
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
be889a97
1 commit,
6 years ago
2 files
+
99
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
Classes/Updates/MigrateGoogleSitemapData.php
0 → 100644
+
95
−
0
Options
<?php
namespace
SGalinski\SgSeo\Updates
;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.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 3 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!
***************************************************************/
use
TYPO3\CMS\Install\Updates\AbstractUpdate
;
/**
* Migrate dd_googlesitemap db entries for sg_seo
*/
class
MigrateGoogleSitemapData
extends
AbstractUpdate
{
/**
* @var string
*/
protected
$title
=
'Migrates all db entries of dd_google_sitemap to the according tables of sg_seo'
;
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManager
*/
protected
$objectManager
;
/**
* Checks whether updates are required.
*
* @param string &$description The description for the update
* @return bool Whether an update is required (TRUE) or not (FALSE)
*/
public
function
checkForUpdate
(
&
$description
)
:
bool
{
$description
=
'Set the site_root_id for all the queue entries and templates if not set or pid = 0'
;
$oldRowsFound
=
FALSE
;
$databaseConnection
=
$GLOBALS
[
'TYPO3_DB'
];
$where
=
'tx_sgseo_lastmod = "" AND tx_ddgooglesitemap_lastmod != ""'
;
$result
=
$databaseConnection
->
exec_SELECTquery
(
'*'
,
'pages'
,
$where
);
if
(
$result
->
num_rows
>
0
)
{
$oldRowsFound
=
TRUE
;
}
return
!
(
!
$oldRowsFound
||
$this
->
isWizardDone
());
}
/**
* Performs the accordant updates.
*
* @param array &$dbQueries Queries done in this update
* @param mixed &$customMessages Custom messages
* @return bool Whether everything went smoothly or not
*/
public
function
performUpdate
(
array
&
$dbQueries
,
&
$customMessages
)
:
bool
{
$databaseConnection
=
$GLOBALS
[
'TYPO3_DB'
];
$where
=
'site_root_id = 0'
;
$result
=
$databaseConnection
->
exec_SELECTquery
(
'uid, tx_ddgooglesitemap_lastmod, tx_ddgooglesitemap_priority, tx_ddgooglesitemap_change_frequency'
,
'pages'
,
$where
)
->
fetch_all
();
$dbQueries
[]
=
$databaseConnection
->
debug_lastBuiltQuery
;
/** @var array $result */
foreach
(
$result
as
$row
)
{
$where
=
'uid = '
.
$row
[
0
];
$databaseConnection
->
exec_UPDATEquery
(
'pages'
,
$where
,
[
'tx_sgseo_lastmod'
=>
$row
[
1
],
'tx_sgseo_priority'
=>
$row
[
2
],
'tx_sgseo_change_frequency'
=>
$row
[
3
]]
);
$dbQueries
[]
=
$databaseConnection
->
debug_lastBuiltQuery
;
}
$this
->
markWizardAsDone
();
return
TRUE
;
}
}
Loading