function xmlsitemap_get_link_count in XML sitemap 8
Same name and namespace in other branches
- 6.2 xmlsitemap.module \xmlsitemap_get_link_count()
- 7.2 xmlsitemap.module \xmlsitemap_get_link_count()
- 2.x xmlsitemap.module \xmlsitemap_get_link_count()
Get the current number of sitemap links.
@static int $count Current number of sitemap links.
Parameters
bool $reset: If TRUE, update current number of sitemap links.
Return value
int Returns current number of sitemap links.
4 calls to xmlsitemap_get_link_count()
- XmlSitemapSettingsForm::validateForm in src/Form/ XmlSitemapSettingsForm.php 
- Form validation handler.
- XmlSitemapUnitTest::testGetChunkCount in tests/src/ Functional/ XmlSitemapUnitTest.php 
- Tests for xmlsitemap_get_chunk_count().
- xmlsitemap_get_chunk_count in ./xmlsitemap.module 
- Get the current number of sitemap chunks.
- xmlsitemap_get_chunk_size in ./xmlsitemap.module 
- Get the sitemap chunk size.
File
- ./xmlsitemap.module, line 1082 
- xmlsitemap XML sitemap
Code
function xmlsitemap_get_link_count($reset = FALSE) {
  static $count;
  if (!isset($count) || $reset) {
    $count = \Drupal::database()
      ->query("SELECT COUNT(id) FROM {xmlsitemap} WHERE access = 1 AND status = 1")
      ->fetchField();
  }
  return $count;
}