From 4cc6fa0e6ca19ad551341772a2cd0389956c0849 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Wed, 8 Jan 2025 14:16:39 +0700 Subject: [PATCH] Removed sitemap ping because is deprecated (#1738) * Removed sitemap ping because is deprecated * Update CHANGELOG.md * Update Sitemap.php * Update main.php * Update config.php * Update sitemap.php * Updated * Update admin_sitemap.tpl * Update admin_sitemap.tpl * Update admin_sitemap.tpl --- CHANGELOG.md | 1 + library/ajax/sitemap.php | 16 -- library/config.php | 6 - library/includes/cron/jobs/sitemap.php | 8 - library/language/source/main.php | 4 - src/Sitemap.php | 31 ---- styles/templates/admin/admin_sitemap.tpl | 212 +++++++++++------------ 7 files changed, 99 insertions(+), 179 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 955993149..0d8182582 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Added `TorrentPier instance hash` generation [\#1726](https://github.com/torrentpier/torrentpier/pull/1726) ([belomaxorka](https://github.com/belomaxorka)) - Added `m4a` extension support in M3U playback [\#1724](https://github.com/torrentpier/torrentpier/pull/1724) ([belomaxorka](https://github.com/belomaxorka)) - Created `VersionHelper.php` [\#1731](https://github.com/torrentpier/torrentpier/pull/1731) ([belomaxorka](https://github.com/belomaxorka)) +- Removed sitemap ping because is deprecated [\#1738](https://github.com/torrentpier/torrentpier/pull/1738) ([belomaxorka](https://github.com/belomaxorka)) - Drop Ocelot announcer support 🫡 [\#1727](https://github.com/torrentpier/torrentpier/pull/1727) ([belomaxorka](https://github.com/belomaxorka)) - Use `DEFAULT_CHARSET` constant instead of hardcoded string [\#1734](https://github.com/torrentpier/torrentpier/pull/1734) ([belomaxorka](https://github.com/belomaxorka)) - Replaced some string functions to `mbstring` alternatives [\#1735](https://github.com/torrentpier/torrentpier/pull/1735) ([belomaxorka](https://github.com/belomaxorka)) diff --git a/library/ajax/sitemap.php b/library/ajax/sitemap.php index acd4a7c45..b0fec3884 100644 --- a/library/ajax/sitemap.php +++ b/library/ajax/sitemap.php @@ -30,22 +30,6 @@ switch ($mode) { } break; - case 'search_update': - if (!is_file(SITEMAP_DIR . '/sitemap.xml')) { - $map->createSitemap(); - } - - $map_link = make_url(hide_bb_path(SITEMAP_DIR . '/sitemap.xml')); - - foreach ($bb_cfg['sitemap_sending'] as $source_name => $source_link) { - if ($map->sendSitemap($source_link, $map_link)) { - $html .= '
' . $lang['SITEMAP_NOTIFY_SEARCH'] . ' ' . $source_name . ' : ' . $lang['SITEMAP_SENT'] . ''; - } else { - $html .= '
' . $lang['SITEMAP_NOTIFY_SEARCH'] . ' ' . $source_name . ' : ' . $lang['SITEMAP_ERROR'] . ' URL: ' . $source_link . $map_link . ''; - } - } - break; - default: $this->ajax_die("Invalid mode: $mode"); } diff --git a/library/config.php b/library/config.php index 136102ea7..41141a661 100644 --- a/library/config.php +++ b/library/config.php @@ -602,12 +602,6 @@ $bb_cfg['user_agreement_url'] = 'info.php?show=user_agreement'; $bb_cfg['copyright_holders_url'] = 'info.php?show=copyright_holders'; $bb_cfg['advert_url'] = 'info.php?show=advert'; -$bb_cfg['sitemap_sending'] = [ - // A list of URLs to which to send a sitemap for indexing by a search robot. - // Syntax: 'Resource name' => 'link to endpoint' - // Sitemap sending is deprecated. See: https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping -]; - // Extensions $bb_cfg['file_id_ext'] = [ 1 => 'gif', diff --git a/library/includes/cron/jobs/sitemap.php b/library/includes/cron/jobs/sitemap.php index 5a2c29508..8b9f39976 100644 --- a/library/includes/cron/jobs/sitemap.php +++ b/library/includes/cron/jobs/sitemap.php @@ -13,11 +13,3 @@ if (!defined('BB_ROOT')) { $map = new TorrentPier\Sitemap(); $map->createSitemap(); - -if (is_file(SITEMAP_DIR . '/sitemap.xml')) { - $map_link = make_url(hide_bb_path(SITEMAP_DIR . '/sitemap.xml')); - - foreach ($bb_cfg['sitemap_sending'] as $source_name => $source_link) { - $map->sendSitemap($source_link, $map_link); - } -} diff --git a/library/language/source/main.php b/library/language/source/main.php index a7aa6556c..4237d8cad 100644 --- a/library/language/source/main.php +++ b/library/language/source/main.php @@ -2997,12 +2997,8 @@ $lang['SITEMAP_ADMIN'] = 'Manage sitemap'; $lang['SITEMAP_CREATED'] = 'Sitemap created'; $lang['SITEMAP_AVAILABLE'] = 'and is available at'; $lang['SITEMAP_NOT_CREATED'] = 'Sitemap is not yet created'; -$lang['SITEMAP_NOTIFY_SEARCH'] = 'Notification of the search engine'; -$lang['SITEMAP_SENT'] = 'send completed'; -$lang['SITEMAP_ERROR'] = 'sending error'; $lang['SITEMAP_OPTIONS'] = 'Options'; $lang['SITEMAP_CREATE'] = 'Create / update the sitemap'; -$lang['SITEMAP_NOTIFY'] = 'Notify search engines about new version of sitemap'; $lang['SITEMAP_WHAT_NEXT'] = 'What to do next?'; $lang['SITEMAP_GOOGLE_1'] = 'Register your site at Google Webmaster using your Google account.'; $lang['SITEMAP_GOOGLE_2'] = 'Add sitemap of site you registered.'; diff --git a/src/Sitemap.php b/src/Sitemap.php index 271d3455d..5e5647468 100644 --- a/src/Sitemap.php +++ b/src/Sitemap.php @@ -178,35 +178,4 @@ class Sitemap return true; } - - - /** - * Отправка карты сайта на указанный URL - * - * @param $url - * @param $map - * - * @return string - */ - public function sendSitemap($url, $map): string - { - $file = $url . urlencode($map); - - if (\function_exists('curl_init')) { - $ch = curl_init(); - - curl_setopt($ch, CURLOPT_URL, $file); - curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 6); - - $data = curl_exec($ch); - curl_close($ch); - - return $data; - } - - return file_get_contents($file); - } } diff --git a/styles/templates/admin/admin_sitemap.tpl b/styles/templates/admin/admin_sitemap.tpl index 20057462f..ec62683f6 100644 --- a/styles/templates/admin/admin_sitemap.tpl +++ b/styles/templates/admin/admin_sitemap.tpl @@ -1,124 +1,108 @@

{L_SITEMAP_ADMIN}

- - - - - - - - - - - - - - - - - - - - - - - - - -
{L_INFORMATION}:
{MESSAGE}
{L_SITEMAP_OPTIONS}: - {L_SITEMAP_CREATE}   - {L_SITEMAP_NOTIFY}
-
-
{L_SITEMAP_WHAT_NEXT}
-

1. {L_SITEMAP_GOOGLE_1}

-

2. {L_SITEMAP_GOOGLE_2}

-

3. {L_SITEMAP_YANDEX_1}

-

4. {L_SITEMAP_YANDEX_2}

-

5. {L_SITEMAP_BING_1}

-

6. {L_SITEMAP_BING_2}

-
{L_SITEMAP_ADD_TITLE}
- {L_SITEMAP_ADD_PAGE}: - -
-

{L_SITEMAP_ADD_EXP_1}

{L_SITEMAP_ADD_EXP_2}

-
-    - -
+ + + + + + + + + + + + + + + + + + + + + + + + + +
{L_INFORMATION}: +
{MESSAGE}
+
{L_SITEMAP_OPTIONS}: + {L_SITEMAP_CREATE} +
{L_SITEMAP_WHAT_NEXT}
+

1. {L_SITEMAP_GOOGLE_1}

+

2. {L_SITEMAP_GOOGLE_2}

+

3. {L_SITEMAP_YANDEX_1}

+

4. {L_SITEMAP_YANDEX_2}

+

5. {L_SITEMAP_BING_1}

+

6. {L_SITEMAP_BING_2}

+
{L_SITEMAP_ADD_TITLE}
+ {L_SITEMAP_ADD_PAGE}: + +
+
+

{L_SITEMAP_ADD_EXP_1}

{L_SITEMAP_ADD_EXP_2}

+
+    + +