-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsitemap.php
More file actions
38 lines (30 loc) · 934 Bytes
/
Copy pathsitemap.php
File metadata and controls
38 lines (30 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* sitemap.php
*
* @category sitemap.php file to generate sitemap.xml
* @author nirmala.adiba.khanza <nirmala.adiba.khanza@gmail.com>
* @license https://opensource.org/licenses/MIT MIT License
* @version 1.0
*
*/
require __DIR__ . '/lib/main.php';
$sitemap_index_path = __DIR__ . '/sitemap-index.xml';
$sitemap_path = __DIR__ . '/sitemap.xml';
// Delete existing sitemap files
if (file_exists($sitemap_index_path) && file_exists($sitemap_path)) {
if (!unlink($sitemap_index_path)) {
scriptlog_error("Failed to delete $sitemap_index_path");
}
if (!unlink($sitemap_path)) {
scriptlog_error("Failed to delete $sitemap_path");
}
}
// Generate sitemap
if (function_exists('sitemap_generator')) {
if (false === sitemap_generator()) {
scriptlog_error("Problem in generating sitemap");
}
} else {
scriptlog_error("sitemap_generator function not found");
}