Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
S
simple_sitemap
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
simple_sitemap
Commits
f484dc1d
Commit
f484dc1d
authored
Sep 22, 2018
by
Pawel G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove sitemaps from DB when removing variants from configuration
parent
67de3e4b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
src/Plugin/simple_sitemap/SitemapGenerator/SitemapGeneratorBase.php
.../simple_sitemap/SitemapGenerator/SitemapGeneratorBase.php
+5
-4
src/Queue/QueueWorker.php
src/Queue/QueueWorker.php
+1
-1
src/SimplesitemapManager.php
src/SimplesitemapManager.php
+2
-1
No files found.
src/Plugin/simple_sitemap/SitemapGenerator/SitemapGeneratorBase.php
View file @
f484dc1d
...
...
@@ -183,12 +183,13 @@ abstract class SitemapGeneratorBase extends SimplesitemapPluginBase implements S
* @return $this
*/
public
function
remove
(
$mode
=
'all'
)
{
self
::
removeSitemapVariant
(
$this
->
sitemapVariant
,
$mode
);
self
::
removeSitemapVariant
s
(
$this
->
sitemapVariant
,
$mode
);
return
$this
;
}
public
static
function
removeSitemapVariant
(
$variant
=
NULL
,
$mode
=
'all'
)
{
public
static
function
removeSitemapVariants
(
$variants
=
NULL
,
$mode
=
'all'
)
{
$variants
=
is_array
(
$variants
)
||
NULL
===
$variants
?
$variants
:
[
$variants
];
$delete_query
=
\
Drupal
::
database
()
->
delete
(
'simple_sitemap'
);
switch
(
$mode
)
{
...
...
@@ -207,8 +208,8 @@ abstract class SitemapGeneratorBase extends SimplesitemapPluginBase implements S
//todo: throw error
}
if
(
NULL
!==
$variant
)
{
$delete_query
->
condition
(
'type'
,
$variant
);
if
(
NULL
!==
$variant
s
)
{
$delete_query
->
condition
(
'type'
,
$variant
s
,
'IN'
);
}
$delete_query
->
execute
();
...
...
src/Queue/QueueWorker.php
View file @
f484dc1d
...
...
@@ -110,7 +110,7 @@ class QueueWorker {
*/
public
function
deleteQueue
()
{
$this
->
queue
->
deleteQueue
();
SitemapGeneratorBase
::
removeSitemapVariant
(
NULL
,
'unpublished'
);
SitemapGeneratorBase
::
removeSitemapVariant
s
(
NULL
,
'unpublished'
);
//todo should call the remove() method of every plugin instead?
$this
->
variantProcessedNow
=
NULL
;
$this
->
generatorProcessedNow
=
NULL
;
$this
->
results
=
[];
...
...
src/SimplesitemapManager.php
View file @
f484dc1d
...
...
@@ -190,7 +190,8 @@ class SimplesitemapManager {
}
public
function
removeSitemapVariants
(
$variant_names
=
NULL
)
{
// $this->removeSitemap($variant_names); // todo
SitemapGeneratorBase
::
removeSitemapVariants
(
$variant_names
);
//todo should call the remove() method of every plugin instead?
if
(
NULL
===
$variant_names
)
{
foreach
(
$this
->
configFactory
->
listAll
(
'simple_sitemap.variants.'
)
as
$config_name
)
{
$this
->
configFactory
->
getEditable
(
$config_name
)
->
delete
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment