X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=sitemap.php;h=ae40d7a89a9cf21c93c6749a5e1f7faebc0a7cef;hb=485331f99d5dfdfd7f1dca60853dac292f721b55;hp=41d22771139f713eaa08f3084c28ae2dad671c79;hpb=b9df3424379b086cf5d512e1b00b0f7f36d59a84;p=quix0rs-gnu-social.git diff --git a/sitemap.php b/sitemap.php index 41d2277113..ae40d7a89a 100644 --- a/sitemap.php +++ b/sitemap.php @@ -32,8 +32,7 @@ function index_map() { $index_urls .= url( array( 'url' => $output_url . $file_name, - 'changefreq' => 'daily', - 'priority' => '1', + 'changefreq' => 'daily' ) ); } @@ -100,7 +99,7 @@ function notices_map() { $notice = array( 'url' => $notices->uri, - 'lastmod' => w3cdate($notices->modified), + 'lastmod' => common_date_w3dtf($notices->modified), 'changefreq' => 'daily', 'priority' => '1', ); @@ -207,30 +206,28 @@ function user_map() { function avatar_map() { global $output_paths; - $avatars = DB_DataObject::factory('avatar'); - - $avatars->query('SELECT url, modified FROM avatar'); + $avatars = new Avatar(); + $avatars->whereAdd('original = 1', "OR"); + $avatars->whereAdd('width = ' . AVATAR_MINI_SIZE, 'OR'); + if (!$avatars->find()) { + return 0; + } + $avatar_count = 0; $map_count = 1; while ($avatars->fetch()) { - # We only want the original size and 24px thumbnail version - skip 96px. - if (preg_match('/-96-/', $avatars->url)) { - continue; - } - # Maximum 50,000 URLs per sitemap file. if ($avatar_count == 50000) { $avatar_count = 0; $map_count++; } -w3cdate($avatars->modified); $image = array( - 'url' => $avatars->url, - 'lastmod' => w3cdate($avatars->modified), - 'changefreq' => 'monthly', + 'url' => common_avatar_display_url($avatars), + 'lastmod' => common_date_w3dtf($avatars->modified), + 'changefreq' => 'never', 'priority' => '0.2', ); @@ -346,13 +343,6 @@ function parse_args() { return $paths; } -# Format database timestamps as W3C DTF. -function w3cdate ($timestamp) { - preg_match('/(\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/', $timestamp, $date); - - return date(DATE_W3C, mktime($date[4], $date[5], $date[6], $date[2], $date[3], $date[1])); -} - # Ensure paths end with a "/". function trailing_slash($path) { if (preg_match('/\/$/', $path) == 0) {