Commit 44a75bbd authored by gbyte.co's avatar gbyte.co

Several fixes

parent c8f9b450
......@@ -131,7 +131,7 @@ function simple_sitemap_entity_form_submit($form, FormStateInterface &$form_stat
// Regenerate sitemaps according to user setting.
if ($values['simple_sitemap_regenerate_now']) {
$generator->generateSitemap();
$generator->rebuildQueue()->generateSitemap();
}
}
}
......
......@@ -212,7 +212,7 @@ class FormHelper {
$form_fragment['simple_sitemap_regenerate_now'] = [
'#type' => 'checkbox',
'#title' => $this->t('Regenerate sitemap after hitting <em>Save</em>'),
'#description' => $this->t('This setting will regenerate the whole sitemap including the above changes.'),
'#description' => $this->t('This setting will regenerate all sitemaps including the above changes.'),
'#default_value' => FALSE,
];
if ($this->generator->getSetting('cron_generate')) {
......
......@@ -99,7 +99,7 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase {
// Regenerate sitemaps according to user setting.
if ($form_state->getValue('simple_sitemap_regenerate_now')) {
$this->generator->generateSitemap();
$this->generator->rebuildQueue()->generateSitemap();
}
}
......
......@@ -58,11 +58,13 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase {
$total_count = $queue_worker->getOriginalElementCount();
$index_progress = [
'#theme' => 'progress_bar',
'#percent' => $total_count ? (int) (100 * $indexed_count / $total_count) : 100,
'#percent' => $total_count ? (100 * $indexed_count / $total_count) : 100,
'#message' => t('@indexed out of @total items have been indexed.', ['@indexed' => $indexed_count, '@total' => $total_count]),
];
$form['simple_sitemap_settings']['progress'] = [
'#markup' => render($index_progress),
'#prefix' => '<div class="simple-sitemap-progress clearfix">',
'#suffix' => '</div>',
];
$form['simple_sitemap_settings']['settings'] = [
......@@ -222,7 +224,7 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase {
// Regenerate sitemaps according to user setting.
if ($form_state->getValue('simple_sitemap_regenerate_now')) {
$this->generator->generateSitemap();
$this->generator->rebuildQueue()->generateSitemap();
}
}
......
......@@ -90,7 +90,7 @@ class SimplesitemapVariantsForm extends SimplesitemapFormBase {
// Regenerate sitemaps according to user setting.
if ($form_state->getValue('simple_sitemap_regenerate_now')) {
$this->generator->generateSitemap();
$this->generator->rebuildQueue()->generateSitemap();
}
}
......
......@@ -104,6 +104,11 @@ class QueueWorker {
$this->lock = $lock;
}
/**
* @return $this
*
* @todo Should remove all unpublished variants from db.
*/
public function deleteQueue() {
$this->elementQueue->deleteQueue();
$this->variantProcessedNow = NULL;
......
......@@ -295,6 +295,8 @@ class Simplesitemap {
/**
* @param string $from
* @param null $variants
* @return $this
* @throws \Drupal\Component\Plugin\Exception\PluginException
*/
public function generateSitemap($from = 'form', $variants = NULL) {
switch($from) {
......@@ -308,10 +310,14 @@ class Simplesitemap {
$this->queueWorker->generateSitemap($variants);
break;
}
return $this;
}
public function rebuildQueue($variants = NULL) {
$this->queueWorker->rebuildQueue($variants);
return $this;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment