diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-07-17 12:02:57 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-07-17 12:02:57 -0400 |
commit | 3b2a2c1c6a0c235fb2dd4a1ce66fcf7f80f2ddc1 (patch) | |
tree | b5b8570f25888b975e7e93758fe4b3b94b7e91a1 | |
parent | d57063abebdcd0c63cd314ab02adc6d00a077223 (diff) |
restrict avatars to certain sizes in SQL
darcs-hash:20080717160257-84dde-8c4f78582ef0d590102c078a045826951ffcbb28.gz
-rw-r--r-- | sitemap.php | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sitemap.php b/sitemap.php index 876c25251..9bbeae8a8 100644 --- a/sitemap.php +++ b/sitemap.php @@ -206,20 +206,19 @@ 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; |