add .gif to fix_private_photos checking, try another tactic to reduce notification duplication - check for duplicates after storage rather than before. This tactic worked out well to reduce item duplication.

This commit is contained in:
friendica 2013-02-07 23:43:55 -08:00
parent a0e18a0ff8
commit 6242f9a147
4 changed files with 103 additions and 71 deletions

View file

@ -12,7 +12,7 @@ require_once('library/Mobile_Detect/Mobile_Detect.php');
require_once('include/features.php'); require_once('include/features.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.1.1610' ); define ( 'FRIENDICA_VERSION', '3.1.1612' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1159 ); define ( 'DB_UPDATE_VERSION', 1159 );

View file

@ -300,6 +300,38 @@ function notification($params) {
return; return;
} }
// we seem to have a lot of duplicate comment notifications due to race conditions, mostly from forums
// After we've stored everything, look again to see if there are any duplicates and if so remove them
$p = null;
$p = q("select id from notify where ( type = %d or type = %d ) and link = '%s' and uid = %d order by id",
intval(NOTIFY_TAGSELF),
intval(NOTIFY_COMMENT),
dbesc($params['link']),
intval($params['uid'])
);
if($p && (count($p) > 1)) {
for ($d = 1; $d < count($p); $d ++) {
q("delete from notify where id = %d limit 1",
intval($p[$d]['id'])
);
}
// only continue on if we stored the first one
if($notify_id != $p[0]['id']) {
pop_lang();
return;
}
}
$itemlink = $a->get_baseurl() . '/notify/view/' . $notify_id; $itemlink = $a->get_baseurl() . '/notify/view/' . $notify_id;
$msg = replace_macros($epreamble,array('$itemlink' => $itemlink)); $msg = replace_macros($epreamble,array('$itemlink' => $itemlink));
$r = q("update notify set msg = '%s' where id = %d and uid = %d limit 1", $r = q("update notify set msg = '%s' where id = %d and uid = %d limit 1",

View file

@ -3594,7 +3594,7 @@ function fix_private_photos($s, $uid, $item = null, $cid = 0) {
// Only embed locally hosted photos // Only embed locally hosted photos
$replace = false; $replace = false;
$i = basename($image); $i = basename($image);
$i = str_replace(array('.jpg','.png'),array('',''),$i); $i = str_replace(array('.jpg','.png','.gif'),array('','',''),$i);
$x = strpos($i,'-'); $x = strpos($i,'-');
if($x) { if($x) {
@ -3605,7 +3605,7 @@ function fix_private_photos($s, $uid, $item = null, $cid = 0) {
intval($res), intval($res),
intval($uid) intval($uid)
); );
if(count($r)) { if($r) {
// Check to see if we should replace this photo link with an embedded image // Check to see if we should replace this photo link with an embedded image
// 1. No need to do so if the photo is public // 1. No need to do so if the photo is public

View file

@ -6,9 +6,9 @@
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 3.1.1610\n" "Project-Id-Version: 3.1.1612\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-05 10:00-0800\n" "POT-Creation-Date: 2013-02-07 10:00-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -53,7 +53,7 @@ msgstr ""
#: ../../mod/message.php:38 ../../mod/message.php:174 #: ../../mod/message.php:38 ../../mod/message.php:174
#: ../../mod/allfriends.php:9 ../../mod/nogroup.php:25 #: ../../mod/allfriends.php:9 ../../mod/nogroup.php:25
#: ../../mod/wall_upload.php:66 ../../mod/follow.php:9 #: ../../mod/wall_upload.php:66 ../../mod/follow.php:9
#: ../../mod/display.php:181 ../../mod/profiles.php:146 #: ../../mod/display.php:180 ../../mod/profiles.php:146
#: ../../mod/profiles.php:567 ../../mod/delegate.php:6 #: ../../mod/profiles.php:567 ../../mod/delegate.php:6
#: ../../mod/suggest.php:56 ../../mod/invite.php:15 ../../mod/invite.php:101 #: ../../mod/suggest.php:56 ../../mod/invite.php:15 ../../mod/invite.php:101
#: ../../mod/dfrn_confirm.php:53 ../../addon/facebook/facebook.php:512 #: ../../mod/dfrn_confirm.php:53 ../../addon/facebook/facebook.php:512
@ -131,7 +131,7 @@ msgid "New photo from this URL"
msgstr "" msgstr ""
#: ../../mod/crepair.php:166 ../../mod/fsuggest.php:107 #: ../../mod/crepair.php:166 ../../mod/fsuggest.php:107
#: ../../mod/events.php:476 ../../mod/photos.php:1075 #: ../../mod/events.php:478 ../../mod/photos.php:1075
#: ../../mod/photos.php:1196 ../../mod/photos.php:1498 #: ../../mod/photos.php:1196 ../../mod/photos.php:1498
#: ../../mod/photos.php:1549 ../../mod/photos.php:1593 #: ../../mod/photos.php:1549 ../../mod/photos.php:1593
#: ../../mod/photos.php:1676 ../../mod/install.php:248 #: ../../mod/photos.php:1676 ../../mod/install.php:248
@ -142,7 +142,7 @@ msgstr ""
#: ../../mod/settings.php:1037 ../../mod/manage.php:110 ../../mod/group.php:87 #: ../../mod/settings.php:1037 ../../mod/manage.php:110 ../../mod/group.php:87
#: ../../mod/mood.php:137 ../../mod/message.php:335 ../../mod/message.php:564 #: ../../mod/mood.php:137 ../../mod/message.php:335 ../../mod/message.php:564
#: ../../mod/admin.php:461 ../../mod/admin.php:728 ../../mod/admin.php:865 #: ../../mod/admin.php:461 ../../mod/admin.php:728 ../../mod/admin.php:865
#: ../../mod/admin.php:1064 ../../mod/admin.php:1151 #: ../../mod/admin.php:1068 ../../mod/admin.php:1155
#: ../../mod/profiles.php:626 ../../mod/invite.php:140 #: ../../mod/profiles.php:626 ../../mod/invite.php:140
#: ../../addon/fromgplus/fromgplus.php:44 #: ../../addon/fromgplus/fromgplus.php:44
#: ../../addon/facebook/facebook.php:621 #: ../../addon/facebook/facebook.php:621
@ -277,87 +277,87 @@ msgstr ""
msgid "Event title and start time are required." msgid "Event title and start time are required."
msgstr "" msgstr ""
#: ../../mod/events.php:289 #: ../../mod/events.php:291
msgid "l, F j" msgid "l, F j"
msgstr "" msgstr ""
#: ../../mod/events.php:311 #: ../../mod/events.php:313
msgid "Edit event" msgid "Edit event"
msgstr "" msgstr ""
#: ../../mod/events.php:333 ../../include/text.php:1246 #: ../../mod/events.php:335 ../../include/text.php:1258
msgid "link to source" msgid "link to source"
msgstr "" msgstr ""
#: ../../mod/events.php:368 ../../view/theme/diabook/theme.php:91 #: ../../mod/events.php:370 ../../view/theme/diabook/theme.php:91
#: ../../include/nav.php:79 ../../boot.php:1857 #: ../../include/nav.php:79 ../../boot.php:1857
msgid "Events" msgid "Events"
msgstr "" msgstr ""
#: ../../mod/events.php:369 #: ../../mod/events.php:371
msgid "Create New Event" msgid "Create New Event"
msgstr "" msgstr ""
#: ../../mod/events.php:370 ../../addon/dav/friendica/layout.fnk.php:263 #: ../../mod/events.php:372 ../../addon/dav/friendica/layout.fnk.php:263
#: ../../addon.old/dav/friendica/layout.fnk.php:263 #: ../../addon.old/dav/friendica/layout.fnk.php:263
msgid "Previous" msgid "Previous"
msgstr "" msgstr ""
#: ../../mod/events.php:371 ../../mod/install.php:207 #: ../../mod/events.php:373 ../../mod/install.php:207
#: ../../addon/dav/friendica/layout.fnk.php:266 #: ../../addon/dav/friendica/layout.fnk.php:266
#: ../../addon.old/dav/friendica/layout.fnk.php:266 #: ../../addon.old/dav/friendica/layout.fnk.php:266
msgid "Next" msgid "Next"
msgstr "" msgstr ""
#: ../../mod/events.php:444 #: ../../mod/events.php:446
msgid "hour:minute" msgid "hour:minute"
msgstr "" msgstr ""
#: ../../mod/events.php:454 #: ../../mod/events.php:456
msgid "Event details" msgid "Event details"
msgstr "" msgstr ""
#: ../../mod/events.php:455 #: ../../mod/events.php:457
#, php-format #, php-format
msgid "Format is %s %s. Starting date and Title are required." msgid "Format is %s %s. Starting date and Title are required."
msgstr "" msgstr ""
#: ../../mod/events.php:457 #: ../../mod/events.php:459
msgid "Event Starts:" msgid "Event Starts:"
msgstr "" msgstr ""
#: ../../mod/events.php:457 ../../mod/events.php:471 #: ../../mod/events.php:459 ../../mod/events.php:473
msgid "Required" msgid "Required"
msgstr "" msgstr ""
#: ../../mod/events.php:460 #: ../../mod/events.php:462
msgid "Finish date/time is not known or not relevant" msgid "Finish date/time is not known or not relevant"
msgstr "" msgstr ""
#: ../../mod/events.php:462 #: ../../mod/events.php:464
msgid "Event Finishes:" msgid "Event Finishes:"
msgstr "" msgstr ""
#: ../../mod/events.php:465 #: ../../mod/events.php:467
msgid "Adjust for viewer timezone" msgid "Adjust for viewer timezone"
msgstr "" msgstr ""
#: ../../mod/events.php:467 #: ../../mod/events.php:469
msgid "Description:" msgid "Description:"
msgstr "" msgstr ""
#: ../../mod/events.php:469 ../../mod/directory.php:134 #: ../../mod/events.php:471 ../../mod/directory.php:134
#: ../../addon/forumdirectory/forumdirectory.php:156 #: ../../addon/forumdirectory/forumdirectory.php:156
#: ../../include/event.php:40 ../../include/bb2diaspora.php:415 #: ../../include/event.php:40 ../../include/bb2diaspora.php:415
#: ../../boot.php:1379 #: ../../boot.php:1379
msgid "Location:" msgid "Location:"
msgstr "" msgstr ""
#: ../../mod/events.php:471 #: ../../mod/events.php:473
msgid "Title:" msgid "Title:"
msgstr "" msgstr ""
#: ../../mod/events.php:473 #: ../../mod/events.php:475
msgid "Share this event" msgid "Share this event"
msgstr "" msgstr ""
@ -395,7 +395,7 @@ msgstr ""
msgid "Remove" msgid "Remove"
msgstr "" msgstr ""
#: ../../mod/dfrn_poll.php:99 ../../mod/dfrn_poll.php:530 #: ../../mod/dfrn_poll.php:101 ../../mod/dfrn_poll.php:534
#, php-format #, php-format
msgid "%1$s welcomes %2$s" msgid "%1$s welcomes %2$s"
msgstr "" msgstr ""
@ -1089,7 +1089,7 @@ msgid "Remove account"
msgstr "" msgstr ""
#: ../../mod/uexport.php:48 ../../mod/settings.php:74 #: ../../mod/uexport.php:48 ../../mod/settings.php:74
#: ../../mod/newmember.php:22 ../../mod/admin.php:824 ../../mod/admin.php:1029 #: ../../mod/newmember.php:22 ../../mod/admin.php:824 ../../mod/admin.php:1033
#: ../../addon/dav/friendica/layout.fnk.php:225 #: ../../addon/dav/friendica/layout.fnk.php:225
#: ../../addon/mathjax/mathjax.php:36 ../../view/theme/diabook/theme.php:537 #: ../../addon/mathjax/mathjax.php:36 ../../view/theme/diabook/theme.php:537
#: ../../view/theme/diabook/theme.php:658 ../../include/nav.php:167 #: ../../view/theme/diabook/theme.php:658 ../../include/nav.php:167
@ -1526,7 +1526,7 @@ msgid_plural "%d comments"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: ../../mod/content.php:605 ../../include/text.php:1502 #: ../../mod/content.php:605 ../../include/text.php:1514
#: ../../object/Item.php:315 ../../object/Item.php:328 #: ../../object/Item.php:315 ../../object/Item.php:328
msgid "comment" msgid "comment"
msgid_plural "comments" msgid_plural "comments"
@ -2014,7 +2014,7 @@ msgstr ""
msgid "Update public posts" msgid "Update public posts"
msgstr "" msgstr ""
#: ../../mod/contacts.php:409 ../../mod/admin.php:1209 #: ../../mod/contacts.php:409 ../../mod/admin.php:1213
msgid "Update now" msgid "Update now"
msgstr "" msgstr ""
@ -3327,7 +3327,7 @@ msgstr ""
#: ../../mod/like.php:151 ../../mod/subthread.php:87 ../../mod/tagger.php:62 #: ../../mod/like.php:151 ../../mod/subthread.php:87 ../../mod/tagger.php:62
#: ../../addon/communityhome/communityhome.php:171 #: ../../addon/communityhome/communityhome.php:171
#: ../../view/theme/diabook/theme.php:464 ../../include/text.php:1498 #: ../../view/theme/diabook/theme.php:464 ../../include/text.php:1510
#: ../../include/diaspora.php:1860 ../../include/conversation.php:126 #: ../../include/diaspora.php:1860 ../../include/conversation.php:126
#: ../../include/conversation.php:254 #: ../../include/conversation.php:254
#: ../../addon.old/communityhome/communityhome.php:163 #: ../../addon.old/communityhome/communityhome.php:163
@ -3365,7 +3365,7 @@ msgstr ""
#: ../../mod/notice.php:15 ../../mod/viewsrc.php:15 ../../mod/admin.php:159 #: ../../mod/notice.php:15 ../../mod/viewsrc.php:15 ../../mod/admin.php:159
#: ../../mod/admin.php:773 ../../mod/admin.php:972 ../../mod/display.php:51 #: ../../mod/admin.php:773 ../../mod/admin.php:972 ../../mod/display.php:51
#: ../../mod/display.php:185 ../../include/items.php:3853 #: ../../mod/display.php:184 ../../include/items.php:3853
msgid "Item not found." msgid "Item not found."
msgstr "" msgstr ""
@ -3634,7 +3634,7 @@ msgstr ""
msgid "Plugins" msgid "Plugins"
msgstr "" msgstr ""
#: ../../mod/admin.php:99 ../../mod/admin.php:1027 ../../mod/admin.php:1063 #: ../../mod/admin.php:99 ../../mod/admin.php:1031 ../../mod/admin.php:1067
msgid "Themes" msgid "Themes"
msgstr "" msgstr ""
@ -3642,7 +3642,7 @@ msgstr ""
msgid "DB updates" msgid "DB updates"
msgstr "" msgstr ""
#: ../../mod/admin.php:115 ../../mod/admin.php:122 ../../mod/admin.php:1150 #: ../../mod/admin.php:115 ../../mod/admin.php:122 ../../mod/admin.php:1154
msgid "Logs" msgid "Logs"
msgstr "" msgstr ""
@ -3687,8 +3687,8 @@ msgid "Message queues"
msgstr "" msgstr ""
#: ../../mod/admin.php:212 ../../mod/admin.php:459 ../../mod/admin.php:726 #: ../../mod/admin.php:212 ../../mod/admin.php:459 ../../mod/admin.php:726
#: ../../mod/admin.php:821 ../../mod/admin.php:863 ../../mod/admin.php:1026 #: ../../mod/admin.php:821 ../../mod/admin.php:863 ../../mod/admin.php:1030
#: ../../mod/admin.php:1062 ../../mod/admin.php:1149 #: ../../mod/admin.php:1066 ../../mod/admin.php:1153
msgid "Administration" msgid "Administration"
msgstr "" msgstr ""
@ -4241,23 +4241,23 @@ msgstr ""
msgid "Plugin %s enabled." msgid "Plugin %s enabled."
msgstr "" msgstr ""
#: ../../mod/admin.php:799 ../../mod/admin.php:997 #: ../../mod/admin.php:799 ../../mod/admin.php:1001
msgid "Disable" msgid "Disable"
msgstr "" msgstr ""
#: ../../mod/admin.php:801 ../../mod/admin.php:999 #: ../../mod/admin.php:801 ../../mod/admin.php:1003
msgid "Enable" msgid "Enable"
msgstr "" msgstr ""
#: ../../mod/admin.php:823 ../../mod/admin.php:1028 #: ../../mod/admin.php:823 ../../mod/admin.php:1032
msgid "Toggle" msgid "Toggle"
msgstr "" msgstr ""
#: ../../mod/admin.php:831 ../../mod/admin.php:1038 #: ../../mod/admin.php:831 ../../mod/admin.php:1042
msgid "Author: " msgid "Author: "
msgstr "" msgstr ""
#: ../../mod/admin.php:832 ../../mod/admin.php:1039 #: ../../mod/admin.php:832 ../../mod/admin.php:1043
msgid "Maintainer: " msgid "Maintainer: "
msgstr "" msgstr ""
@ -4265,61 +4265,61 @@ msgstr ""
msgid "No themes found." msgid "No themes found."
msgstr "" msgstr ""
#: ../../mod/admin.php:1020 #: ../../mod/admin.php:1024
msgid "Screenshot" msgid "Screenshot"
msgstr "" msgstr ""
#: ../../mod/admin.php:1068 #: ../../mod/admin.php:1072
msgid "[Experimental]" msgid "[Experimental]"
msgstr "" msgstr ""
#: ../../mod/admin.php:1069 #: ../../mod/admin.php:1073
msgid "[Unsupported]" msgid "[Unsupported]"
msgstr "" msgstr ""
#: ../../mod/admin.php:1096 #: ../../mod/admin.php:1100
msgid "Log settings updated." msgid "Log settings updated."
msgstr "" msgstr ""
#: ../../mod/admin.php:1152 #: ../../mod/admin.php:1156
msgid "Clear" msgid "Clear"
msgstr "" msgstr ""
#: ../../mod/admin.php:1158 #: ../../mod/admin.php:1162
msgid "Debugging" msgid "Debugging"
msgstr "" msgstr ""
#: ../../mod/admin.php:1159 #: ../../mod/admin.php:1163
msgid "Log file" msgid "Log file"
msgstr "" msgstr ""
#: ../../mod/admin.php:1159 #: ../../mod/admin.php:1163
msgid "" msgid ""
"Must be writable by web server. Relative to your Friendica top-level " "Must be writable by web server. Relative to your Friendica top-level "
"directory." "directory."
msgstr "" msgstr ""
#: ../../mod/admin.php:1160 #: ../../mod/admin.php:1164
msgid "Log level" msgid "Log level"
msgstr "" msgstr ""
#: ../../mod/admin.php:1210 #: ../../mod/admin.php:1214
msgid "Close" msgid "Close"
msgstr "" msgstr ""
#: ../../mod/admin.php:1216 #: ../../mod/admin.php:1220
msgid "FTP Host" msgid "FTP Host"
msgstr "" msgstr ""
#: ../../mod/admin.php:1217 #: ../../mod/admin.php:1221
msgid "FTP Path" msgid "FTP Path"
msgstr "" msgstr ""
#: ../../mod/admin.php:1218 #: ../../mod/admin.php:1222
msgid "FTP User" msgid "FTP User"
msgstr "" msgstr ""
#: ../../mod/admin.php:1219 #: ../../mod/admin.php:1223
msgid "FTP Password" msgid "FTP Password"
msgstr "" msgstr ""
@ -4419,7 +4419,7 @@ msgstr ""
msgid "link" msgid "link"
msgstr "" msgstr ""
#: ../../mod/display.php:178 #: ../../mod/display.php:177
msgid "Item has been removed." msgid "Item has been removed."
msgstr "" msgstr ""
@ -4909,7 +4909,7 @@ msgid "About:"
msgstr "" msgstr ""
#: ../../mod/directory.php:187 #: ../../mod/directory.php:187
#: ../../addon/forumdirectory/forumdirectory.php:203 #: ../../addon/forumdirectory/forumdirectory.php:201
msgid "No entries (some entries may be hidden)." msgid "No entries (some entries may be hidden)."
msgstr "" msgstr ""
@ -5847,7 +5847,7 @@ msgid "Latest likes"
msgstr "" msgstr ""
#: ../../addon/communityhome/communityhome.php:163 #: ../../addon/communityhome/communityhome.php:163
#: ../../view/theme/diabook/theme.php:456 ../../include/text.php:1496 #: ../../view/theme/diabook/theme.php:456 ../../include/text.php:1508
#: ../../include/conversation.php:118 ../../include/conversation.php:246 #: ../../include/conversation.php:118 ../../include/conversation.php:246
#: ../../addon.old/communityhome/communityhome.php:155 #: ../../addon.old/communityhome/communityhome.php:155
msgid "event" msgid "event"
@ -7350,7 +7350,7 @@ msgstr ""
msgid "Add contact" msgid "Add contact"
msgstr "" msgstr ""
#: ../../addon/viewsrc/viewsrc.php:37 ../../addon.old/viewsrc/viewsrc.php:37 #: ../../addon/viewsrc/viewsrc.php:39 ../../addon.old/viewsrc/viewsrc.php:37
msgid "View Source" msgid "View Source"
msgstr "" msgstr ""
@ -8683,31 +8683,31 @@ msgstr ""
msgid "December" msgid "December"
msgstr "" msgstr ""
#: ../../include/text.php:1066 #: ../../include/text.php:1078
msgid "bytes" msgid "bytes"
msgstr "" msgstr ""
#: ../../include/text.php:1093 ../../include/text.php:1105 #: ../../include/text.php:1105 ../../include/text.php:1117
msgid "Click to open/close" msgid "Click to open/close"
msgstr "" msgstr ""
#: ../../include/text.php:1278 ../../include/user.php:237 #: ../../include/text.php:1290 ../../include/user.php:237
msgid "default" msgid "default"
msgstr "" msgstr ""
#: ../../include/text.php:1290 #: ../../include/text.php:1302
msgid "Select an alternate language" msgid "Select an alternate language"
msgstr "" msgstr ""
#: ../../include/text.php:1500 #: ../../include/text.php:1512
msgid "activity" msgid "activity"
msgstr "" msgstr ""
#: ../../include/text.php:1503 #: ../../include/text.php:1515
msgid "post" msgid "post"
msgstr "" msgstr ""
#: ../../include/text.php:1658 #: ../../include/text.php:1670
msgid "Item filed" msgid "Item filed"
msgstr "" msgstr ""
@ -9582,7 +9582,7 @@ msgstr ""
msgid "Welcome back " msgid "Welcome back "
msgstr "" msgstr ""
#: ../../include/security.php:363 #: ../../include/security.php:366
msgid "" msgid ""
"The form security token was not correct. This probably happened because the " "The form security token was not correct. This probably happened because the "
"form has been opened for too long (>3 hours) before submitting it." "form has been opened for too long (>3 hours) before submitting it."
@ -9740,15 +9740,15 @@ msgstr ""
msgid "Private post" msgid "Private post"
msgstr "" msgstr ""
#: ../../include/plugin.php:389 ../../include/plugin.php:391 #: ../../include/plugin.php:429 ../../include/plugin.php:431
msgid "Click here to upgrade." msgid "Click here to upgrade."
msgstr "" msgstr ""
#: ../../include/plugin.php:397 #: ../../include/plugin.php:437
msgid "This action exceeds the limits set by your subscription plan." msgid "This action exceeds the limits set by your subscription plan."
msgstr "" msgstr ""
#: ../../include/plugin.php:402 #: ../../include/plugin.php:442
msgid "This action is not available under your subscription plan." msgid "This action is not available under your subscription plan."
msgstr "" msgstr ""