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');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.1.1610' );
define ( 'FRIENDICA_VERSION', '3.1.1612' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1159 );

View file

@ -300,6 +300,38 @@ function notification($params) {
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;
$msg = replace_macros($epreamble,array('$itemlink' => $itemlink));
$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
$replace = false;
$i = basename($image);
$i = str_replace(array('.jpg','.png'),array('',''),$i);
$i = str_replace(array('.jpg','.png','.gif'),array('','',''),$i);
$x = strpos($i,'-');
if($x) {
@ -3605,7 +3605,7 @@ function fix_private_photos($s, $uid, $item = null, $cid = 0) {
intval($res),
intval($uid)
);
if(count($r)) {
if($r) {
// 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

View file

@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 3.1.1610\n"
"Project-Id-Version: 3.1.1612\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -53,7 +53,7 @@ msgstr ""
#: ../../mod/message.php:38 ../../mod/message.php:174
#: ../../mod/allfriends.php:9 ../../mod/nogroup.php:25
#: ../../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/suggest.php:56 ../../mod/invite.php:15 ../../mod/invite.php:101
#: ../../mod/dfrn_confirm.php:53 ../../addon/facebook/facebook.php:512
@ -131,7 +131,7 @@ msgid "New photo from this URL"
msgstr ""
#: ../../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:1549 ../../mod/photos.php:1593
#: ../../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/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:1064 ../../mod/admin.php:1151
#: ../../mod/admin.php:1068 ../../mod/admin.php:1155
#: ../../mod/profiles.php:626 ../../mod/invite.php:140
#: ../../addon/fromgplus/fromgplus.php:44
#: ../../addon/facebook/facebook.php:621
@ -277,87 +277,87 @@ msgstr ""
msgid "Event title and start time are required."
msgstr ""
#: ../../mod/events.php:289
#: ../../mod/events.php:291
msgid "l, F j"
msgstr ""
#: ../../mod/events.php:311
#: ../../mod/events.php:313
msgid "Edit event"
msgstr ""
#: ../../mod/events.php:333 ../../include/text.php:1246
#: ../../mod/events.php:335 ../../include/text.php:1258
msgid "link to source"
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
msgid "Events"
msgstr ""
#: ../../mod/events.php:369
#: ../../mod/events.php:371
msgid "Create New Event"
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
msgid "Previous"
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.old/dav/friendica/layout.fnk.php:266
msgid "Next"
msgstr ""
#: ../../mod/events.php:444
#: ../../mod/events.php:446
msgid "hour:minute"
msgstr ""
#: ../../mod/events.php:454
#: ../../mod/events.php:456
msgid "Event details"
msgstr ""
#: ../../mod/events.php:455
#: ../../mod/events.php:457
#, php-format
msgid "Format is %s %s. Starting date and Title are required."
msgstr ""
#: ../../mod/events.php:457
#: ../../mod/events.php:459
msgid "Event Starts:"
msgstr ""
#: ../../mod/events.php:457 ../../mod/events.php:471
#: ../../mod/events.php:459 ../../mod/events.php:473
msgid "Required"
msgstr ""
#: ../../mod/events.php:460
#: ../../mod/events.php:462
msgid "Finish date/time is not known or not relevant"
msgstr ""
#: ../../mod/events.php:462
#: ../../mod/events.php:464
msgid "Event Finishes:"
msgstr ""
#: ../../mod/events.php:465
#: ../../mod/events.php:467
msgid "Adjust for viewer timezone"
msgstr ""
#: ../../mod/events.php:467
#: ../../mod/events.php:469
msgid "Description:"
msgstr ""
#: ../../mod/events.php:469 ../../mod/directory.php:134
#: ../../mod/events.php:471 ../../mod/directory.php:134
#: ../../addon/forumdirectory/forumdirectory.php:156
#: ../../include/event.php:40 ../../include/bb2diaspora.php:415
#: ../../boot.php:1379
msgid "Location:"
msgstr ""
#: ../../mod/events.php:471
#: ../../mod/events.php:473
msgid "Title:"
msgstr ""
#: ../../mod/events.php:473
#: ../../mod/events.php:475
msgid "Share this event"
msgstr ""
@ -395,7 +395,7 @@ msgstr ""
msgid "Remove"
msgstr ""
#: ../../mod/dfrn_poll.php:99 ../../mod/dfrn_poll.php:530
#: ../../mod/dfrn_poll.php:101 ../../mod/dfrn_poll.php:534
#, php-format
msgid "%1$s welcomes %2$s"
msgstr ""
@ -1089,7 +1089,7 @@ msgid "Remove account"
msgstr ""
#: ../../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/mathjax/mathjax.php:36 ../../view/theme/diabook/theme.php:537
#: ../../view/theme/diabook/theme.php:658 ../../include/nav.php:167
@ -1526,7 +1526,7 @@ msgid_plural "%d comments"
msgstr[0] ""
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
msgid "comment"
msgid_plural "comments"
@ -2014,7 +2014,7 @@ msgstr ""
msgid "Update public posts"
msgstr ""
#: ../../mod/contacts.php:409 ../../mod/admin.php:1209
#: ../../mod/contacts.php:409 ../../mod/admin.php:1213
msgid "Update now"
msgstr ""
@ -3327,7 +3327,7 @@ msgstr ""
#: ../../mod/like.php:151 ../../mod/subthread.php:87 ../../mod/tagger.php:62
#: ../../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/conversation.php:254
#: ../../addon.old/communityhome/communityhome.php:163
@ -3365,7 +3365,7 @@ msgstr ""
#: ../../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/display.php:185 ../../include/items.php:3853
#: ../../mod/display.php:184 ../../include/items.php:3853
msgid "Item not found."
msgstr ""
@ -3634,7 +3634,7 @@ msgstr ""
msgid "Plugins"
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"
msgstr ""
@ -3642,7 +3642,7 @@ msgstr ""
msgid "DB updates"
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"
msgstr ""
@ -3687,8 +3687,8 @@ msgid "Message queues"
msgstr ""
#: ../../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:1062 ../../mod/admin.php:1149
#: ../../mod/admin.php:821 ../../mod/admin.php:863 ../../mod/admin.php:1030
#: ../../mod/admin.php:1066 ../../mod/admin.php:1153
msgid "Administration"
msgstr ""
@ -4241,23 +4241,23 @@ msgstr ""
msgid "Plugin %s enabled."
msgstr ""
#: ../../mod/admin.php:799 ../../mod/admin.php:997
#: ../../mod/admin.php:799 ../../mod/admin.php:1001
msgid "Disable"
msgstr ""
#: ../../mod/admin.php:801 ../../mod/admin.php:999
#: ../../mod/admin.php:801 ../../mod/admin.php:1003
msgid "Enable"
msgstr ""
#: ../../mod/admin.php:823 ../../mod/admin.php:1028
#: ../../mod/admin.php:823 ../../mod/admin.php:1032
msgid "Toggle"
msgstr ""
#: ../../mod/admin.php:831 ../../mod/admin.php:1038
#: ../../mod/admin.php:831 ../../mod/admin.php:1042
msgid "Author: "
msgstr ""
#: ../../mod/admin.php:832 ../../mod/admin.php:1039
#: ../../mod/admin.php:832 ../../mod/admin.php:1043
msgid "Maintainer: "
msgstr ""
@ -4265,61 +4265,61 @@ msgstr ""
msgid "No themes found."
msgstr ""
#: ../../mod/admin.php:1020
#: ../../mod/admin.php:1024
msgid "Screenshot"
msgstr ""
#: ../../mod/admin.php:1068
#: ../../mod/admin.php:1072
msgid "[Experimental]"
msgstr ""
#: ../../mod/admin.php:1069
#: ../../mod/admin.php:1073
msgid "[Unsupported]"
msgstr ""
#: ../../mod/admin.php:1096
#: ../../mod/admin.php:1100
msgid "Log settings updated."
msgstr ""
#: ../../mod/admin.php:1152
#: ../../mod/admin.php:1156
msgid "Clear"
msgstr ""
#: ../../mod/admin.php:1158
#: ../../mod/admin.php:1162
msgid "Debugging"
msgstr ""
#: ../../mod/admin.php:1159
#: ../../mod/admin.php:1163
msgid "Log file"
msgstr ""
#: ../../mod/admin.php:1159
#: ../../mod/admin.php:1163
msgid ""
"Must be writable by web server. Relative to your Friendica top-level "
"directory."
msgstr ""
#: ../../mod/admin.php:1160
#: ../../mod/admin.php:1164
msgid "Log level"
msgstr ""
#: ../../mod/admin.php:1210
#: ../../mod/admin.php:1214
msgid "Close"
msgstr ""
#: ../../mod/admin.php:1216
#: ../../mod/admin.php:1220
msgid "FTP Host"
msgstr ""
#: ../../mod/admin.php:1217
#: ../../mod/admin.php:1221
msgid "FTP Path"
msgstr ""
#: ../../mod/admin.php:1218
#: ../../mod/admin.php:1222
msgid "FTP User"
msgstr ""
#: ../../mod/admin.php:1219
#: ../../mod/admin.php:1223
msgid "FTP Password"
msgstr ""
@ -4419,7 +4419,7 @@ msgstr ""
msgid "link"
msgstr ""
#: ../../mod/display.php:178
#: ../../mod/display.php:177
msgid "Item has been removed."
msgstr ""
@ -4909,7 +4909,7 @@ msgid "About:"
msgstr ""
#: ../../mod/directory.php:187
#: ../../addon/forumdirectory/forumdirectory.php:203
#: ../../addon/forumdirectory/forumdirectory.php:201
msgid "No entries (some entries may be hidden)."
msgstr ""
@ -5847,7 +5847,7 @@ msgid "Latest likes"
msgstr ""
#: ../../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
#: ../../addon.old/communityhome/communityhome.php:155
msgid "event"
@ -7350,7 +7350,7 @@ msgstr ""
msgid "Add contact"
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"
msgstr ""
@ -8683,31 +8683,31 @@ msgstr ""
msgid "December"
msgstr ""
#: ../../include/text.php:1066
#: ../../include/text.php:1078
msgid "bytes"
msgstr ""
#: ../../include/text.php:1093 ../../include/text.php:1105
#: ../../include/text.php:1105 ../../include/text.php:1117
msgid "Click to open/close"
msgstr ""
#: ../../include/text.php:1278 ../../include/user.php:237
#: ../../include/text.php:1290 ../../include/user.php:237
msgid "default"
msgstr ""
#: ../../include/text.php:1290
#: ../../include/text.php:1302
msgid "Select an alternate language"
msgstr ""
#: ../../include/text.php:1500
#: ../../include/text.php:1512
msgid "activity"
msgstr ""
#: ../../include/text.php:1503
#: ../../include/text.php:1515
msgid "post"
msgstr ""
#: ../../include/text.php:1658
#: ../../include/text.php:1670
msgid "Item filed"
msgstr ""
@ -9582,7 +9582,7 @@ msgstr ""
msgid "Welcome back "
msgstr ""
#: ../../include/security.php:363
#: ../../include/security.php:366
msgid ""
"The form security token was not correct. This probably happened because the "
"form has been opened for too long (>3 hours) before submitting it."
@ -9740,15 +9740,15 @@ msgstr ""
msgid "Private post"
msgstr ""
#: ../../include/plugin.php:389 ../../include/plugin.php:391
#: ../../include/plugin.php:429 ../../include/plugin.php:431
msgid "Click here to upgrade."
msgstr ""
#: ../../include/plugin.php:397
#: ../../include/plugin.php:437
msgid "This action exceeds the limits set by your subscription plan."
msgstr ""
#: ../../include/plugin.php:402
#: ../../include/plugin.php:442
msgid "This action is not available under your subscription plan."
msgstr ""