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
1
Merge Requests
1
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
70b764da
Commit
70b764da
authored
Oct 25, 2019
by
gbyte
Committed by
Pawel G
Oct 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#3090249
by gbyte.co: Do not remove irrelevant sitemap instances when rebuilding queue
parent
269ae9a9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
12 deletions
+15
-12
src/Queue/QueueWorker.php
src/Queue/QueueWorker.php
+12
-12
src/Simplesitemap.php
src/Simplesitemap.php
+2
-0
src/SimplesitemapManager.php
src/SimplesitemapManager.php
+1
-0
No files found.
src/Queue/QueueWorker.php
View file @
70b764da
...
...
@@ -125,18 +125,20 @@ class QueueWorker {
* @throws \Drupal\Component\Plugin\Exception\PluginException
*/
public
function
rebuildQueue
(
$variants
=
NULL
)
{
$all_data_sets
=
[];
$sitemap_variants
=
$this
->
manager
->
getSitemapVariants
();
$type_definitions
=
$this
->
manager
->
getSitemapTypes
();
$this
->
deleteQueue
();
$type_definitions
=
$this
->
manager
->
getSitemapTypes
();
$all_data_sets
=
[];
foreach
(
$sitemap_variants
as
$variant_name
=>
$variant_definition
)
{
// Skipping unwanted sitemap variants.
if
(
NULL
!==
$variants
&&
!
in_array
(
$variant_name
,
(
array
)
$variants
))
{
continue
;
}
// Gather variant data of variants chosen for this rebuild.
$sitemap_variants
=
NULL
===
$variants
?
$this
->
manager
->
getSitemapVariants
()
:
array_filter
(
$this
->
manager
->
getSitemapVariants
(),
function
(
$name
)
use
(
$variants
)
{
return
in_array
(
$name
,
(
array
)
$variants
);
},
ARRAY_FILTER_USE_KEY
);
foreach
(
$sitemap_variants
as
$variant_name
=>
$variant_definition
)
{
$type
=
$variant_definition
[
'type'
];
// Adding generate_sitemap operations for all data sets.
...
...
@@ -170,9 +172,7 @@ class QueueWorker {
}
$this
->
getQueuedElementCount
(
TRUE
);
// todo: May not be clean to remove sitemap variants data when queuing elements.
// todo: Add test.
// Remove all sitemap variant instances where no results have been queued.
// Remove all sitemap instances of variants which did not yield any results.
$this
->
manager
->
removeSitemap
(
array_keys
(
array_filter
(
$sitemap_variants
,
function
(
$e
)
{
return
empty
(
$e
[
'data'
]);
})));
return
$this
;
...
...
src/Simplesitemap.php
View file @
70b764da
...
...
@@ -183,6 +183,8 @@ class Simplesitemap {
* true: All existing variants will be set.
*
* @return $this
*
* @todo Check if variants exist and throw exception.
*/
public
function
setVariants
(
$variants
=
NULL
)
{
if
(
NULL
===
$variants
)
{
...
...
src/SimplesitemapManager.php
View file @
70b764da
...
...
@@ -150,6 +150,7 @@ class SimplesitemapManager {
$variants
=
$attach_type_info
?
$this
->
attachSitemapTypeToVariants
(
$variants
,
$sitemap_type
)
:
$variants
;
}
array_multisort
(
array_column
(
$variants
,
"weight"
),
SORT_ASC
,
$variants
);
return
$variants
;
}
...
...
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