Skip to content

Commit

Permalink
Simplify ping response check: do not parse response body.
Browse files Browse the repository at this point in the history
  • Loading branch information
chesio committed Jan 29, 2020
1 parent 66aa4c5 commit 15dda66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ At the moment the same as of legacy plugin.
* Remove survey nag and related functionality.
* Removed optional usage tracking via Google Analytics.
* Remove functionality that depended on Subversion (SVN) being used for code versioning.
* Simplify ping response check: do not parse response body.
* Integrate with [GitHub Updater](https://github.com/afragen/github-updater) - the plugin can only be updated from GitHub, never from WordPress.org Plugin Directory.
4 changes: 1 addition & 3 deletions sitemap-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -1877,15 +1877,13 @@ protected function ExecutePing($pingUrl, $updateStatus = true) {
$pings["google"] = array(
"name" => "Google",
"url" => "https://www.google.com/ping?sitemap=%s",
"check" => "Your Sitemap has been successfully added to our list of Sitemaps to crawl."
);
}

if ($this->GetOption("b_pingmsn")) {
$pings["bing"] = array(
"name" => "Bing",
"url" => "https://www.bing.com/ping?sitemap=%s",
"check" => "Thanks for submitting your Sitemap."
);
}

Expand All @@ -1895,7 +1893,7 @@ protected function ExecutePing($pingUrl, $updateStatus = true) {

$pingres = $this->RemoteOpen($url);

if ($pingres === null || $pingres === false || strpos($pingres, $service["check"]) === false) {
if (!$pingres) {
$status->EndPing($serviceId, false);
trigger_error("Failed to ping $serviceId: " . htmlspecialchars(strip_tags($pingres)), E_USER_NOTICE);
} else {
Expand Down

0 comments on commit 15dda66

Please sign in to comment.