From ab908469ae89cbc7ba3b45b25fd85668e51abaea Mon Sep 17 00:00:00 2001 From: tommy tomson Date: Mon, 30 Apr 2012 02:00:41 +0200 Subject: [PATCH 01/12] close one menu (like the notifications menu) when another one is opened (like it is done when clicking somewhere else) (thx to ^mw) --- js/main.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/js/main.js b/js/main.js index ac238bf6a..6a2632441 100644 --- a/js/main.js +++ b/js/main.js @@ -73,7 +73,16 @@ setupFieldRichtext(); /* popup menus */ + function close_last_popup_menu() { + if(last_popup_menu) { + last_popup_menu.hide(); + last_popup_button.removeClass("selected"); + last_popup_menu = null; + last_popup_button = null; + } + } $('a[rel^=#]').click(function(e){ + close_last_popup_menu(); menu = $( $(this).attr('rel') ); e.preventDefault(); e.stopPropagation(); @@ -90,12 +99,7 @@ return false; }); $('html').click(function() { - if(last_popup_menu) { - last_popup_menu.hide(); - last_popup_button.removeClass("selected"); - last_popup_menu = null; - last_popup_button = null; - } + close_last_popup_menu(); }); // fancyboxes From e3fecb2557ad0ac2f156f9583683f7c9d998e212 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 29 Apr 2012 17:34:54 -0700 Subject: [PATCH 02/12] improved db error logging --- boot.php | 2 +- include/dba.php | 26 +++-- util/messages.po | 253 ++++++++++++++++++++++++++--------------------- 3 files changed, 157 insertions(+), 124 deletions(-) diff --git a/boot.php b/boot.php index 100662a8f..aefc694e6 100644 --- a/boot.php +++ b/boot.php @@ -9,7 +9,7 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '2.3.1326' ); +define ( 'FRIENDICA_VERSION', '2.3.1327' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DB_UPDATE_VERSION', 1140 ); diff --git a/include/dba.php b/include/dba.php index 44a663eac..414f4ae7a 100644 --- a/include/dba.php +++ b/include/dba.php @@ -74,23 +74,29 @@ class dba { if((! $this->db) || (! $this->connected)) return false; + + $this->error = ''; if($this->mysqli) $result = @$this->db->query($sql); else $result = @mysql_query($sql,$this->db); + if($this->mysqli) { + if($this->db->errno) + $this->error = $this->db->error; + } + elseif(mysql_errno($this->db)) + $this->error = mysql_error($this->db); + + if(strlen($this->error)) { + logger('dba: ' . $this->error); + } + if($this->debug) { $mesg = ''; - if($this->mysqli) { - if($this->db->errno) - logger('dba: ' . $this->db->error); - } - elseif(mysql_errno($this->db)) - logger('dba: ' . mysql_error($this->db)); - if($result === false) $mesg = 'false'; elseif($result === true) @@ -102,7 +108,9 @@ class dba { $mesg = mysql_num_rows($result) . ' results' . EOL; } - $str = 'SQL = ' . printable($sql) . EOL . 'SQL returned ' . $mesg . EOL; + $str = 'SQL = ' . printable($sql) . EOL . 'SQL returned ' . $mesg + . (($this->error) ? ' error: ' . $this->error : '') + . EOL; logger('dba: ' . $str ); } @@ -116,7 +124,7 @@ class dba { if($result === false) { logger('dba: ' . printable($sql) . ' returned false.'); if(file_exists('dbfail.out')) - file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n", FILE_APPEND); + file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n" . $this->error . "\n", FILE_APPEND); } if(($result === true) || ($result === false)) diff --git a/util/messages.po b/util/messages.po index f6e149620..535283b0b 100644 --- a/util/messages.po +++ b/util/messages.po @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: 2.3.1326\n" +"Project-Id-Version: 2.3.1327\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-28 10:00-0700\n" +"POT-Creation-Date: 2012-04-29 10:00-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -52,7 +52,7 @@ msgstr "" #: ../../mod/message.php:90 ../../mod/allfriends.php:9 #: ../../mod/nogroup.php:25 ../../mod/wall_upload.php:53 #: ../../mod/follow.php:8 ../../mod/common.php:9 ../../mod/display.php:138 -#: ../../mod/profiles.php:7 ../../mod/profiles.php:329 +#: ../../mod/profiles.php:7 ../../mod/profiles.php:365 #: ../../mod/delegate.php:6 ../../mod/suggest.php:28 ../../mod/invite.php:13 #: ../../mod/invite.php:81 ../../mod/dfrn_confirm.php:53 #: ../../addon/facebook/facebook.php:484 ../../include/items.php:3171 @@ -132,7 +132,7 @@ msgstr "" #: ../../mod/settings.php:744 ../../mod/settings.php:935 #: ../../mod/manage.php:109 ../../mod/group.php:85 ../../mod/admin.php:393 #: ../../mod/admin.php:572 ../../mod/admin.php:708 ../../mod/admin.php:907 -#: ../../mod/admin.php:995 ../../mod/profiles.php:498 ../../mod/invite.php:119 +#: ../../mod/admin.php:995 ../../mod/profiles.php:534 ../../mod/invite.php:119 #: ../../addon/facebook/facebook.php:574 ../../addon/yourls/yourls.php:76 #: ../../addon/ljpost/ljpost.php:93 ../../addon/nsfw/nsfw.php:57 #: ../../addon/planets/planets.php:158 @@ -220,7 +220,7 @@ msgid "link to source" msgstr "" #: ../../mod/events.php:296 ../../view/theme/diabook/theme.php:255 -#: ../../include/nav.php:52 ../../boot.php:1481 +#: ../../include/nav.php:52 ../../boot.php:1487 msgid "Events" msgstr "" @@ -270,7 +270,7 @@ msgid "Description:" msgstr "" #: ../../mod/events.php:395 ../../include/event.php:37 -#: ../../include/bb2diaspora.php:260 ../../boot.php:1083 +#: ../../include/bb2diaspora.php:260 ../../boot.php:1089 msgid "Location:" msgstr "" @@ -330,7 +330,7 @@ msgstr "" #: ../../mod/settings.php:884 ../../mod/settings.php:890 #: ../../mod/settings.php:926 ../../mod/settings.php:927 #: ../../mod/settings.php:928 ../../mod/settings.php:929 -#: ../../mod/register.php:532 ../../mod/profiles.php:475 +#: ../../mod/register.php:532 ../../mod/profiles.php:511 msgid "Yes" msgstr "" @@ -341,7 +341,7 @@ msgstr "" #: ../../mod/settings.php:884 ../../mod/settings.php:890 #: ../../mod/settings.php:926 ../../mod/settings.php:927 #: ../../mod/settings.php:928 ../../mod/settings.php:929 -#: ../../mod/register.php:533 ../../mod/profiles.php:476 +#: ../../mod/register.php:533 ../../mod/profiles.php:512 msgid "No" msgstr "" @@ -545,7 +545,7 @@ msgstr "" #: ../../mod/photos.php:1232 ../../mod/photos.php:1272 #: ../../mod/photos.php:1303 ../../include/conversation.php:554 -#: ../../boot.php:495 +#: ../../boot.php:503 msgid "Comment" msgstr "" @@ -1166,7 +1166,7 @@ msgid "is interested in:" msgstr "" #: ../../mod/match.php:58 ../../mod/suggest.php:59 -#: ../../include/contact_widgets.php:9 ../../boot.php:1027 +#: ../../include/contact_widgets.php:9 ../../boot.php:1033 msgid "Connect" msgstr "" @@ -1648,6 +1648,7 @@ msgstr "" #: ../../addon/facebook/facebook.php:650 #: ../../addon/facebook/facebook.php:1139 #: ../../addon/testdrive/testdrive.php:58 ../../include/items.php:2700 +#: ../../boot.php:683 msgid "Administrator" msgstr "" @@ -1657,7 +1658,7 @@ msgid "" "Password reset failed." msgstr "" -#: ../../mod/lostpass.php:83 ../../boot.php:809 +#: ../../mod/lostpass.php:83 ../../boot.php:815 msgid "Password Reset" msgstr "" @@ -2279,7 +2280,7 @@ msgstr "" msgid "Invalid contact." msgstr "" -#: ../../mod/notes.php:44 ../../boot.php:1486 +#: ../../mod/notes.php:44 ../../boot.php:1492 msgid "Personal Notes" msgstr "" @@ -2530,7 +2531,7 @@ msgstr "" #: ../../mod/profperm.php:103 ../../view/theme/diabook/theme.php:252 #: ../../include/profile_advanced.php:7 ../../include/profile_advanced.php:74 -#: ../../include/nav.php:50 ../../boot.php:1468 +#: ../../include/nav.php:50 ../../boot.php:1474 msgid "Profile" msgstr "" @@ -2702,7 +2703,7 @@ msgstr "" msgid "Choose a nickname: " msgstr "" -#: ../../mod/register.php:567 ../../include/nav.php:81 ../../boot.php:775 +#: ../../mod/register.php:567 ../../include/nav.php:81 ../../boot.php:781 msgid "Register" msgstr "" @@ -2745,7 +2746,7 @@ msgid "Access denied." msgstr "" #: ../../mod/fbrowser.php:23 ../../view/theme/diabook/theme.php:254 -#: ../../include/nav.php:51 ../../boot.php:1473 +#: ../../include/nav.php:51 ../../boot.php:1479 msgid "Photos" msgstr "" @@ -3451,7 +3452,7 @@ msgstr "" msgid "FTP Password" msgstr "" -#: ../../mod/profile.php:21 ../../boot.php:940 +#: ../../mod/profile.php:21 ../../boot.php:946 msgid "Requested profile is not available." msgstr "" @@ -3595,8 +3596,8 @@ msgstr "" msgid "Search This Site" msgstr "" -#: ../../mod/profiles.php:21 ../../mod/profiles.php:339 -#: ../../mod/profiles.php:453 ../../mod/dfrn_confirm.php:62 +#: ../../mod/profiles.php:21 ../../mod/profiles.php:375 +#: ../../mod/profiles.php:489 ../../mod/dfrn_confirm.php:62 msgid "Profile not found." msgstr "" @@ -3604,259 +3605,273 @@ msgstr "" msgid "Profile Name is required." msgstr "" -#: ../../mod/profiles.php:143 +#: ../../mod/profiles.php:145 msgid "Marital Status" msgstr "" -#: ../../mod/profiles.php:144 +#: ../../mod/profiles.php:149 msgid "Romantic Partner" msgstr "" -#: ../../mod/profiles.php:145 +#: ../../mod/profiles.php:153 msgid "Work/Employment" msgstr "" -#: ../../mod/profiles.php:146 +#: ../../mod/profiles.php:156 msgid "Religion" msgstr "" -#: ../../mod/profiles.php:147 +#: ../../mod/profiles.php:160 msgid "Political Views" msgstr "" -#: ../../mod/profiles.php:148 +#: ../../mod/profiles.php:164 msgid "Gender" msgstr "" -#: ../../mod/profiles.php:149 +#: ../../mod/profiles.php:168 msgid "Sexual Preference" msgstr "" -#: ../../mod/profiles.php:150 +#: ../../mod/profiles.php:172 msgid "Homepage" msgstr "" -#: ../../mod/profiles.php:151 +#: ../../mod/profiles.php:176 msgid "Interests" msgstr "" -#: ../../mod/profiles.php:154 +#: ../../mod/profiles.php:181 msgid "Location" msgstr "" -#: ../../mod/profiles.php:225 +#: ../../mod/profiles.php:253 msgid "Profile updated." msgstr "" -#: ../../mod/profiles.php:300 +#: ../../mod/profiles.php:320 +msgid " and " +msgstr "" + +#: ../../mod/profiles.php:328 msgid "public profile" msgstr "" -#: ../../mod/profiles.php:302 +#: ../../mod/profiles.php:331 +#, php-format +msgid "%1$s changed %2$s to %3$s" +msgstr "" + +#: ../../mod/profiles.php:332 +#, php-format +msgid " - Visit %1$s's %2$s" +msgstr "" + +#: ../../mod/profiles.php:335 #, php-format msgid "%1$s has an updated %2$s, changing %3$s." msgstr "" -#: ../../mod/profiles.php:358 +#: ../../mod/profiles.php:394 msgid "Profile deleted." msgstr "" -#: ../../mod/profiles.php:376 ../../mod/profiles.php:410 +#: ../../mod/profiles.php:412 ../../mod/profiles.php:446 msgid "Profile-" msgstr "" -#: ../../mod/profiles.php:395 ../../mod/profiles.php:437 +#: ../../mod/profiles.php:431 ../../mod/profiles.php:473 msgid "New profile created." msgstr "" -#: ../../mod/profiles.php:416 +#: ../../mod/profiles.php:452 msgid "Profile unavailable to clone." msgstr "" -#: ../../mod/profiles.php:474 +#: ../../mod/profiles.php:510 msgid "Hide your contact/friend list from viewers of this profile?" msgstr "" -#: ../../mod/profiles.php:497 +#: ../../mod/profiles.php:533 msgid "Edit Profile Details" msgstr "" -#: ../../mod/profiles.php:499 +#: ../../mod/profiles.php:535 msgid "View this profile" msgstr "" -#: ../../mod/profiles.php:500 +#: ../../mod/profiles.php:536 msgid "Create a new profile using these settings" msgstr "" -#: ../../mod/profiles.php:501 +#: ../../mod/profiles.php:537 msgid "Clone this profile" msgstr "" -#: ../../mod/profiles.php:502 +#: ../../mod/profiles.php:538 msgid "Delete this profile" msgstr "" -#: ../../mod/profiles.php:503 +#: ../../mod/profiles.php:539 msgid "Profile Name:" msgstr "" -#: ../../mod/profiles.php:504 +#: ../../mod/profiles.php:540 msgid "Your Full Name:" msgstr "" -#: ../../mod/profiles.php:505 +#: ../../mod/profiles.php:541 msgid "Title/Description:" msgstr "" -#: ../../mod/profiles.php:506 +#: ../../mod/profiles.php:542 msgid "Your Gender:" msgstr "" -#: ../../mod/profiles.php:507 +#: ../../mod/profiles.php:543 #, php-format msgid "Birthday (%s):" msgstr "" -#: ../../mod/profiles.php:508 +#: ../../mod/profiles.php:544 msgid "Street Address:" msgstr "" -#: ../../mod/profiles.php:509 +#: ../../mod/profiles.php:545 msgid "Locality/City:" msgstr "" -#: ../../mod/profiles.php:510 +#: ../../mod/profiles.php:546 msgid "Postal/Zip Code:" msgstr "" -#: ../../mod/profiles.php:511 +#: ../../mod/profiles.php:547 msgid "Country:" msgstr "" -#: ../../mod/profiles.php:512 +#: ../../mod/profiles.php:548 msgid "Region/State:" msgstr "" -#: ../../mod/profiles.php:513 +#: ../../mod/profiles.php:549 msgid " Marital Status:" msgstr "" -#: ../../mod/profiles.php:514 +#: ../../mod/profiles.php:550 msgid "Who: (if applicable)" msgstr "" -#: ../../mod/profiles.php:515 +#: ../../mod/profiles.php:551 msgid "Examples: cathy123, Cathy Williams, cathy@example.com" msgstr "" -#: ../../mod/profiles.php:516 ../../include/profile_advanced.php:43 +#: ../../mod/profiles.php:552 ../../include/profile_advanced.php:43 msgid "Sexual Preference:" msgstr "" -#: ../../mod/profiles.php:517 +#: ../../mod/profiles.php:553 msgid "Homepage URL:" msgstr "" -#: ../../mod/profiles.php:518 ../../include/profile_advanced.php:49 +#: ../../mod/profiles.php:554 ../../include/profile_advanced.php:49 msgid "Political Views:" msgstr "" -#: ../../mod/profiles.php:519 +#: ../../mod/profiles.php:555 msgid "Religious Views:" msgstr "" -#: ../../mod/profiles.php:520 +#: ../../mod/profiles.php:556 msgid "Public Keywords:" msgstr "" -#: ../../mod/profiles.php:521 +#: ../../mod/profiles.php:557 msgid "Private Keywords:" msgstr "" -#: ../../mod/profiles.php:522 +#: ../../mod/profiles.php:558 msgid "Example: fishing photography software" msgstr "" -#: ../../mod/profiles.php:523 +#: ../../mod/profiles.php:559 msgid "(Used for suggesting potential friends, can be seen by others)" msgstr "" -#: ../../mod/profiles.php:524 +#: ../../mod/profiles.php:560 msgid "(Used for searching profiles, never shown to others)" msgstr "" -#: ../../mod/profiles.php:525 +#: ../../mod/profiles.php:561 msgid "Tell us about yourself..." msgstr "" -#: ../../mod/profiles.php:526 +#: ../../mod/profiles.php:562 msgid "Hobbies/Interests" msgstr "" -#: ../../mod/profiles.php:527 +#: ../../mod/profiles.php:563 msgid "Contact information and Social Networks" msgstr "" -#: ../../mod/profiles.php:528 +#: ../../mod/profiles.php:564 msgid "Musical interests" msgstr "" -#: ../../mod/profiles.php:529 +#: ../../mod/profiles.php:565 msgid "Books, literature" msgstr "" -#: ../../mod/profiles.php:530 +#: ../../mod/profiles.php:566 msgid "Television" msgstr "" -#: ../../mod/profiles.php:531 +#: ../../mod/profiles.php:567 msgid "Film/dance/culture/entertainment" msgstr "" -#: ../../mod/profiles.php:532 +#: ../../mod/profiles.php:568 msgid "Love/romance" msgstr "" -#: ../../mod/profiles.php:533 +#: ../../mod/profiles.php:569 msgid "Work/employment" msgstr "" -#: ../../mod/profiles.php:534 +#: ../../mod/profiles.php:570 msgid "School/education" msgstr "" -#: ../../mod/profiles.php:539 +#: ../../mod/profiles.php:575 msgid "" "This is your public profile.
It may " "be visible to anybody using the internet." msgstr "" -#: ../../mod/profiles.php:549 ../../mod/directory.php:111 +#: ../../mod/profiles.php:585 ../../mod/directory.php:111 msgid "Age: " msgstr "" -#: ../../mod/profiles.php:584 +#: ../../mod/profiles.php:620 msgid "Edit/Manage Profiles" msgstr "" -#: ../../mod/profiles.php:585 ../../boot.php:1049 +#: ../../mod/profiles.php:621 ../../boot.php:1055 msgid "Change profile photo" msgstr "" -#: ../../mod/profiles.php:586 ../../boot.php:1050 +#: ../../mod/profiles.php:622 ../../boot.php:1056 msgid "Create New Profile" msgstr "" -#: ../../mod/profiles.php:597 ../../boot.php:1060 +#: ../../mod/profiles.php:633 ../../boot.php:1066 msgid "Profile Image" msgstr "" -#: ../../mod/profiles.php:599 ../../boot.php:1063 +#: ../../mod/profiles.php:635 ../../boot.php:1069 msgid "visible to everybody" msgstr "" -#: ../../mod/profiles.php:600 ../../boot.php:1064 +#: ../../mod/profiles.php:636 ../../boot.php:1070 msgid "Edit visibility" msgstr "" @@ -4457,7 +4472,7 @@ msgstr "" #: ../../addon/communityhome/communityhome.php:34 #: ../../addon/communityhome/twillingham/communityhome.php:28 #: ../../addon/communityhome/twillingham/communityhome.php:34 -#: ../../include/nav.php:64 ../../boot.php:796 +#: ../../include/nav.php:64 ../../boot.php:802 msgid "Login" msgstr "" @@ -5199,7 +5214,7 @@ msgid "Show More Settings saved." msgstr "" #: ../../addon/showmore/showmore.php:87 ../../include/conversation.php:466 -#: ../../boot.php:496 +#: ../../boot.php:504 msgid "show more" msgstr "" @@ -5503,7 +5518,7 @@ msgstr "" msgid "Set colour scheme" msgstr "" -#: ../../include/profile_advanced.php:17 ../../boot.php:1085 +#: ../../include/profile_advanced.php:17 ../../boot.php:1091 msgid "Gender:" msgstr "" @@ -5524,11 +5539,11 @@ msgstr "" msgid "Age:" msgstr "" -#: ../../include/profile_advanced.php:37 ../../boot.php:1088 +#: ../../include/profile_advanced.php:37 ../../boot.php:1094 msgid "Status:" msgstr "" -#: ../../include/profile_advanced.php:45 ../../boot.php:1090 +#: ../../include/profile_advanced.php:45 ../../boot.php:1096 msgid "Homepage:" msgstr "" @@ -6112,7 +6127,7 @@ msgstr "" msgid "Contacts not in any group" msgstr "" -#: ../../include/nav.php:46 ../../boot.php:795 +#: ../../include/nav.php:46 ../../boot.php:801 msgid "Logout" msgstr "" @@ -6120,7 +6135,7 @@ msgstr "" msgid "End this session" msgstr "" -#: ../../include/nav.php:49 ../../boot.php:1463 +#: ../../include/nav.php:49 ../../boot.php:1469 msgid "Status" msgstr "" @@ -6200,11 +6215,11 @@ msgstr "" msgid "Manage other pages" msgstr "" -#: ../../include/nav.php:138 ../../boot.php:1043 +#: ../../include/nav.php:138 ../../boot.php:1049 msgid "Profiles" msgstr "" -#: ../../include/nav.php:138 ../../boot.php:1043 +#: ../../include/nav.php:138 ../../boot.php:1049 msgid "Manage/edit profiles" msgstr "" @@ -6626,33 +6641,33 @@ msgid "" "form has been opened for too long (>3 hours) before submitting it." msgstr "" -#: ../../include/Contact.php:96 +#: ../../include/Contact.php:111 msgid "stopped following" msgstr "" -#: ../../include/Contact.php:188 ../../include/conversation.php:817 +#: ../../include/Contact.php:203 ../../include/conversation.php:817 msgid "View Status" msgstr "" -#: ../../include/Contact.php:189 ../../include/conversation.php:818 +#: ../../include/Contact.php:204 ../../include/conversation.php:818 msgid "View Profile" msgstr "" -#: ../../include/Contact.php:190 ../../include/conversation.php:819 +#: ../../include/Contact.php:205 ../../include/conversation.php:819 msgid "View Photos" msgstr "" -#: ../../include/Contact.php:191 ../../include/Contact.php:204 +#: ../../include/Contact.php:206 ../../include/Contact.php:219 #: ../../include/conversation.php:820 msgid "Network Posts" msgstr "" -#: ../../include/Contact.php:192 ../../include/Contact.php:204 +#: ../../include/Contact.php:207 ../../include/Contact.php:219 #: ../../include/conversation.php:821 msgid "Edit Contact" msgstr "" -#: ../../include/Contact.php:193 ../../include/Contact.php:204 +#: ../../include/Contact.php:208 ../../include/Contact.php:219 #: ../../include/conversation.php:822 msgid "Send PM" msgstr "" @@ -6879,70 +6894,80 @@ msgstr "" msgid "permissions" msgstr "" -#: ../../boot.php:494 +#: ../../boot.php:502 msgid "Delete this item?" msgstr "" -#: ../../boot.php:497 +#: ../../boot.php:505 msgid "show fewer" msgstr "" -#: ../../boot.php:774 +#: ../../boot.php:678 +#, php-format +msgid "Update %s failed. See error logs." +msgstr "" + +#: ../../boot.php:680 +#, php-format +msgid "Update Error at %s" +msgstr "" + +#: ../../boot.php:780 msgid "Create a New Account" msgstr "" -#: ../../boot.php:798 +#: ../../boot.php:804 msgid "Nickname or Email address: " msgstr "" -#: ../../boot.php:799 +#: ../../boot.php:805 msgid "Password: " msgstr "" -#: ../../boot.php:802 +#: ../../boot.php:808 msgid "Or login using OpenID: " msgstr "" -#: ../../boot.php:808 +#: ../../boot.php:814 msgid "Forgot your password?" msgstr "" -#: ../../boot.php:975 +#: ../../boot.php:981 msgid "Edit profile" msgstr "" -#: ../../boot.php:1035 +#: ../../boot.php:1041 msgid "Message" msgstr "" -#: ../../boot.php:1151 ../../boot.php:1227 +#: ../../boot.php:1157 ../../boot.php:1233 msgid "g A l F d" msgstr "" -#: ../../boot.php:1152 ../../boot.php:1228 +#: ../../boot.php:1158 ../../boot.php:1234 msgid "F d" msgstr "" -#: ../../boot.php:1197 ../../boot.php:1268 +#: ../../boot.php:1203 ../../boot.php:1274 msgid "[today]" msgstr "" -#: ../../boot.php:1209 +#: ../../boot.php:1215 msgid "Birthday Reminders" msgstr "" -#: ../../boot.php:1210 +#: ../../boot.php:1216 msgid "Birthdays this week:" msgstr "" -#: ../../boot.php:1261 +#: ../../boot.php:1267 msgid "[No description]" msgstr "" -#: ../../boot.php:1279 +#: ../../boot.php:1285 msgid "Event Reminders" msgstr "" -#: ../../boot.php:1280 +#: ../../boot.php:1286 msgid "Events this week:" msgstr "" From 0153d86b7f4e2913b1eb985a905f7eb94822b589 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 29 Apr 2012 19:10:07 -0700 Subject: [PATCH 03/12] admin page to manage failed updates --- boot.php | 2 +- mod/admin.php | 66 +++++++++++++++++++++++++++++++++++++++-- view/admin_aside.tpl | 1 + view/failed_updates.tpl | 17 +++++++++++ 4 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 view/failed_updates.tpl diff --git a/boot.php b/boot.php index aefc694e6..733d94b1e 100644 --- a/boot.php +++ b/boot.php @@ -667,7 +667,7 @@ if(! function_exists('check_config')) { // call the specific update $func = 'update_' . $x; - $retval = $func($a); + $retval = $func(); if($retval) { //send the administrator an e-mail $email_tpl = get_intltext_template("update_fail_eml.tpl"); diff --git a/mod/admin.php b/mod/admin.php index 3b6d186d5..b07ef851a 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -61,6 +61,9 @@ function admin_post(&$a){ case 'logs': admin_page_logs_post($a); break; + case 'dbsync': + admin_page_dbsync_post($a); + break; case 'update': admin_page_remoteupdate_post($a); break; @@ -94,7 +97,8 @@ function admin_content(&$a) { 'users' => Array($a->get_baseurl(true)."/admin/users/", t("Users") , "users"), 'plugins'=> Array($a->get_baseurl(true)."/admin/plugins/", t("Plugins") , "plugins"), 'themes' => Array($a->get_baseurl(true)."/admin/themes/", t("Themes") , "themes"), - 'update' => Array($a->get_baseurl(true)."/admin/update/", t("Update") , "update") + 'dbsync' => Array($a->get_baseurl(true)."/admin/dbsync/", t('DB updates'), "dbsync"), + 'update' => Array($a->get_baseurl(true)."/admin/update/", t("Software Update") , "update") ); /* get plugins admin page */ @@ -142,6 +146,9 @@ function admin_content(&$a) { case 'logs': $o = admin_page_logs($a); break; + case 'dbsync': + $o = admin_page_dbsync($a); + break; case 'update': $o = admin_page_remoteupdate($a); break; @@ -435,6 +442,62 @@ function admin_page_site(&$a) { } +function admin_page_dbsync(&$a) { + + $o = ''; + + if($a->argc > 3 && intval($a->argv[3]) && $a->argv[2] === 'mark') { + set_config('database', 'update_' . intval($a->argv[3]), 'success'); + info( t('Update has been marked successful') . EOL); + goaway($a->get_baseurl(true) . '/admin/dbsync'); + } + + if($a->argc > 2 && intval($a->argv[2])) { + require_once('update.php'); + $func = 'update_' . intval($a->argv[2]); + if(function_exists($func)) { + $retval = $func(); + if($retval === UPDATE_FAILED) { + $o .= sprintf( t('Executing %s failed. Check system logs.'), $func); + } + elseif($retval === UPDATE_SUCCESS) { + $o .= sprintf( t('Update %s was successfully applied.', $func)); + set_config('database',$func, 'success'); + } + else + $o .= sprintf( t('Update %s did not return a status. Unknown if it succeeded.'), $func); + } + else + $o .= sprintf( t('Update function %s could not be found.'), $func); + return $o; + } + + $failed = array(); + $r = q("select * from config where `cat` = 'database' "); + if(count($r)) { + foreach($r as $rr) { + $upd = intval(substr($rr['k'],7)); + if($upd < 1139 || $rr['v'] === 'success') + continue; + $failed[] = $upd; + } + } + if(! count($failed)) + return '

' . t('No failed updates.') . '

'; + + $o = replace_macros(get_markup_template('failed_updates.tpl'),array( + '$base' => $a->get_baseurl(true), + '$banner' => t('Failed Updates'), + '$desc' => t('This does not include updates prior to 1139, which did not return a status.'), + '$mark' => t('Mark success (if update was manually applied)'), + '$apply' => t('Attempt to execute this update step automatically'), + '$failed' => $failed + )); + + return $o; + +} + /** * Users admin page * @@ -979,7 +1042,6 @@ readable."); $size = 5000000; $seek = fseek($fp,0-$size,SEEK_END); if($seek === 0) { - fgets($fp); // throw away the first partial line $data = escape_tags(fread($fp,$size)); while(! feof($fp)) $data .= escape_tags(fread($fp,4096)); diff --git a/view/admin_aside.tpl b/view/admin_aside.tpl index a3c98e2ce..f25a1eb4b 100644 --- a/view/admin_aside.tpl +++ b/view/admin_aside.tpl @@ -16,6 +16,7 @@ +