Skip to content

Commit 0103d60

Browse files
committed
Refresh Bibledit kernel
bibledit/cloud#965
1 parent 9538e65 commit 0103d60

54 files changed

Lines changed: 301 additions & 635 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package.iss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
88
AppId={{C414BE13-5F10-48B7-AF92-9E4E7265D720}
99
AppName=Bibledit
10-
AppVersion=5.1.019
10+
AppVersion=5.1.020
1111
AppPublisher=Teus Benschop
1212
AppPublisherURL=https://bibledit.org
1313
AppSupportURL=https://bibledit.org
@@ -19,7 +19,7 @@ DisableDirPage=yes
1919
DefaultGroupName=Bibledit
2020
LicenseFile=COPYING
2121
; OutputDir=C:\bibledit-windows-packager
22-
OutputBaseFilename=bibledit-5.1.019
22+
OutputBaseFilename=bibledit-5.1.020
2323
Compression=lzma
2424
SolidCompression=yes
2525
; Create a log file in the user's TEMP directory detailing file installation and [Run] actions taken during the installation process.

server/bb/import.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ std::string bible_import (Webserver_Request& webserver_request)
8787
filter_url_file_put_contents (datafile, data);
8888
success_message = translate("Import has started.");
8989
view.set_variable ("journal", journal_logic_see_journal_for_progress ());
90-
tasks_logic_queue (IMPORTBIBLE, { datafile, bible, std::to_string (book), std::to_string (chapter) });
90+
tasks_logic_queue (task::import_bible, { datafile, bible, std::to_string (book), std::to_string (chapter) });
9191
} else {
9292
error_message = translate("Please supply valid Unicode UTF-8 text.");
9393
}
@@ -106,7 +106,7 @@ std::string bible_import (Webserver_Request& webserver_request)
106106
filter_url_file_put_contents (datafile, data);
107107
success_message = translate("Import has started.");
108108
view.set_variable ("journal", journal_logic_see_journal_for_progress ());
109-
tasks_logic_queue (IMPORTBIBLE, { datafile, bible, std::to_string (book), std::to_string (chapter) });
109+
tasks_logic_queue (task::import_bible, { datafile, bible, std::to_string (book), std::to_string (chapter) });
110110
} else {
111111
error_message = translate ("Nothing was uploaded");
112112
}

server/bb/settings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ std::string bible_settings (Webserver_Request& webserver_request)
191191
const std::string resource = webserver_request.post["add"];
192192
if (!resource.empty ()) {
193193
if (write_access) {
194-
tasks_logic_queue (IMPORTRESOURCE, { bible, resource });
194+
tasks_logic_queue (task::import_resource, { bible, resource });
195195
success_message = translate ("The resource will be imported into the Bible.") + " " + translate ("The journal shows the progress.");
196196
}
197197
}

server/bootstrap/bootstrap.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
192192
#include <filter/date.h>
193193
#include <filter/string.h>
194194
#include <journal/logic.h>
195-
#include <nmt/index.h>
196195
#include <editor/id.h>
197196
#include <editor/style.h>
198197
#include <edit/update.h>
@@ -1130,11 +1129,6 @@ void bootstrap_index (Webserver_Request& webserver_request)
11301129
return;
11311130
}
11321131

1133-
if ((url == nmt_index_url ()) && browser_request_security_okay (webserver_request) && nmt_index_acl (webserver_request)) {
1134-
webserver_request.reply = nmt_index (webserver_request);
1135-
return;
1136-
}
1137-
11381132
if ((url == edit_update_url ()) && browser_request_security_okay (webserver_request) && edit_update_acl (webserver_request)) {
11391133
webserver_request.reply = edit_update (webserver_request);
11401134
return;

server/changes/logic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
void changes_logic_start ()
4646
{
47-
tasks_logic_queue (GENERATECHANGES);
47+
tasks_logic_queue (task::generate_changes);
4848
}
4949

5050

server/changes/manage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ std::string changes_manage (Webserver_Request& webserver_request)
7272
const int jobId = database_jobs.get_new_id ();
7373
database_jobs.set_level (jobId, Filter_Roles::manager ());
7474
database_jobs.set_start (jobId, translate ("Clearing change notifications."));
75-
tasks_logic_queue (DELETECHANGES, {std::to_string (jobId), username});
75+
tasks_logic_queue (task::delete_changes, {std::to_string (jobId), username});
7676
redirect_browser (webserver_request, jobs_index_url () + "?id=" + std::to_string (jobId));
7777
return std::string();
7878
}

server/changes/modifications.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,21 @@ void changes_process_identifiers (Webserver_Request& webserver_request,
137137
}
138138

139139

140+
// This mutex ensures that only one single process can generate the changes modifications at any time.
141+
std::timed_mutex mutex;
142+
143+
140144
void changes_modifications ()
141145
{
146+
// Ensure only one process at any time generates the changes,
147+
// even if multiple order to generate then were given by the user.
148+
std::unique_lock<std::timed_mutex> lock (mutex, std::defer_lock);
149+
if (!lock.try_lock_for(std::chrono::milliseconds(200))) {
150+
Database_Logs::log ("Change notifications: Skipping just now because another process is already generating them", Filter_Roles::translator ());
151+
return;
152+
}
153+
154+
142155
Database_Logs::log ("Change notifications: Generating", Filter_Roles::translator ());
143156

144157

@@ -192,7 +205,6 @@ void changes_modifications ()
192205
// At the same time, produce change statistics per user.
193206

194207
std::vector <std::string> users = database::modifications::getUserUsernames ();
195-
if (!users.empty ()) Database_Logs::log ("Change notifications: Per user", Filter_Roles::translator ());
196208
for (const auto& user : users) {
197209

198210
// Total changes made by this user.
@@ -213,7 +225,9 @@ void changes_modifications ()
213225
// Go through the chapters in that book.
214226
const std::vector <int> chapters = database::modifications::getUserChapters (user, bible, book);
215227
for (auto chapter : chapters) {
216-
228+
229+
Database_Logs::log ("Change notifications: User " + user + " - Bible " + bible + " " + filter_passage_display (book, chapter, ""), Filter_Roles::translator ());
230+
217231
// Get the sets of identifiers for that chapter, and set some variables.
218232
const std::vector <database::modifications::id_bundle> IdSets = database::modifications::getUserIdentifiers (user, bible, book, chapter);
219233
int reference_new_id {0};

server/checks/logic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ void checks_logic_start_all ()
3535

3636
void checks_logic_start (const std::string& bible)
3737
{
38-
tasks_logic_queue (CHECKBIBLE, {bible});
38+
tasks_logic_queue (task::check_bible, {bible});
3939
}

server/checks/run.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ void checks_run (std::string bible)
256256
}
257257

258258

259-
// Add a link to the online checking results. Todo test this.
259+
// Add a link to the online checking results.
260260
if (!emailBody.empty ()) {
261261
const std::string siteUrl = config::logic::site_url (webserver_request);
262262
std::stringstream body1 {};

server/collaboration/settings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ std::string collaboration_settings (Webserver_Request& webserver_request)
7171
int jobId = database_jobs.get_new_id ();
7272
database_jobs.set_level (jobId, Filter_Roles::admin ());
7373
database_jobs.set_start (jobId, collaboration_link_header ());
74-
tasks_logic_queue (LINKGITREPOSITORY, {object, std::to_string (jobId), source});
74+
tasks_logic_queue (task::link_git_repository, {object, std::to_string (jobId), source});
7575
redirect_browser (webserver_request, jobs_index_url () + "?id=" + std::to_string (jobId));
7676
return std::string();
7777
}

0 commit comments

Comments
 (0)