Skip to content

Commit

Permalink
fixes #939 sitemap error handling and messages
Browse files Browse the repository at this point in the history
sitemap was being created when visiting the sitemap page, makes no sense
when there is a refresh button, only refreshes if it doesn't exist now
  • Loading branch information
tablatronix committed Oct 14, 2014
1 parent 055b11c commit 1169e1a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion admin/inc/template_functions.php
Expand Up @@ -1373,7 +1373,7 @@ function generate_sitemap() {

$status = XMLsave($xml, $file);
exec_action('sitemap-aftersave');
#sitemap successfully created - did not ping
#sitemap successfully created
return $status;
}
else return true;
Expand Down
6 changes: 2 additions & 4 deletions admin/lang/en_US.php
Expand Up @@ -200,10 +200,9 @@
/*
* For: sitemap.php
*/
"SITEMAP_CREATED" => "Sitemap Created! We also successfully pinged 4 search engines of the update",
"SITEMAP_ERRORPING" => "Sitemap Created, however there was an error pinging one or more of the search engines",
"SITEMAP_ERROR" => "Your sitemap could not be generated",
"SITEMAP_WAIT" => "<b>Please Wait:</b> Creating website sitemap",
"SITEMAP_REFRESHED" => "Your sitemap has been refreshed",
"SITEMAP_CREATED" => "Your sitemap has been created",

/*
* For: theme.php
Expand Down Expand Up @@ -534,7 +533,6 @@
"AUTOSAVE_NOTIFY" => 'Page autosaved at %s', //edit.php
"MENU_MANAGER" => '<em>M</em>enu Manager', //edit.php
"GET_PLUGINS_LINK" => 'Download <em>M</em>ore Plugins',
"SITEMAP_REFRESHED" => "Your sitemap has been refreshed", //edit.php
"LOG_FILE_EMPTY" => "This log file is empty", //log.php
"SHARE" => "Share", //footer.php
"NO_PARENT" => "No Parent", //edit.php
Expand Down
12 changes: 4 additions & 8 deletions admin/sitemap.php
Expand Up @@ -14,20 +14,16 @@
login_cookie_check();

exec_action('load-sitemap');
$sitemapfile = '../'.GSSITEMAPFILE;

$sitemap = generate_sitemap();
if ($sitemap !== true) {
$error = $sitemap;
} else {
if (isset($_GET['refresh'])) {
$success = i18n_r('SITEMAP_REFRESHED');
}
if(!file_exists($sitemapfile) || isset($_GET['refresh'])){
if(generate_sitemap() === true) $success = i18n_r('SITEMAP_REFRESHED');
else $error = i18n_r('SITEMAP_ERROR');
}

$pagetitle = strip_tags(i18n_r('SIDE_VIEW_SITEMAP'));
get_template('header');

$sitemapfile = '../'.GSSITEMAPFILE;
?>

<?php include('template/include-nav.php'); ?>
Expand Down

3 comments on commit 1169e1a

@cnb
Copy link
Contributor

@cnb cnb commented on 1169e1a Oct 14, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather create a new string instead of reusing "SITEMAP_CREATED" (that could be removed)

Possible issues if you keep it:

  • translators not noticing it has changed (a lot) - we usually check for new strings
  • users with a lang file that hasn't been updated (e.g. 3.2 lang file with GS 3.4) will see the old -misleading- text.

@tablatronix
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, it was really a fallback, it will never be seen unless someone deletes sitemap, but I guess plugins might use it also.

@tablatronix
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually didnt even use it, lol

Please sign in to comment.