mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Implemented 'Mirror exclude'
SVN revision: 1184
This commit is contained in:
parent
36c754d75d
commit
2d91668c65
@ -44,7 +44,7 @@
|
|||||||
GenerateDebugInformation="TRUE"
|
GenerateDebugInformation="TRUE"
|
||||||
ProgramDatabaseFile=".\Debug/elogd.pdb"
|
ProgramDatabaseFile=".\Debug/elogd.pdb"
|
||||||
SubSystem="1"
|
SubSystem="1"
|
||||||
StackReserveSize="1048576"
|
StackReserveSize="4000000"
|
||||||
TargetMachine="1"/>
|
TargetMachine="1"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"
|
Name="VCMIDLTool"
|
||||||
|
|||||||
@ -1920,7 +1920,14 @@ the administrator.<br><br>
|
|||||||
|
|
||||||
If one wants to try out mirroring without causing any harm, one can turn on this flag.
|
If one wants to try out mirroring without causing any harm, one can turn on this flag.
|
||||||
During synchronization, entries are compared and necessary transfers are displayed,
|
During synchronization, entries are compared and necessary transfers are displayed,
|
||||||
but not executed. Default is <b><code>0</code></b>.
|
but not executed. Default is <b><code>0</code></b>.<br><br>
|
||||||
|
|
||||||
|
<li><b><code>Mirror exclude = 0 | 1</code></b><br><br>
|
||||||
|
|
||||||
|
By default, all logbooks are mirrored. Individual logbooks might be excluded from
|
||||||
|
mirroring by putting <b><code>Mirror exclude = 1</code></b> in their individual logbook
|
||||||
|
section of the configuration file (<B>Not</B> the [global] section).
|
||||||
|
Default is <b><code>0</code></b>.
|
||||||
|
|
||||||
</UL>
|
</UL>
|
||||||
</OL><p>
|
</OL><p>
|
||||||
|
|||||||
21
src/elogd.c
21
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.545 2005/01/25 20:49:18 ritt
|
||||||
|
Implemented 'Mirror exclude'
|
||||||
|
|
||||||
Revision 1.544 2005/01/25 16:31:40 ritt
|
Revision 1.544 2005/01/25 16:31:40 ritt
|
||||||
Switched from GIF to PNG
|
Switched from GIF to PNG
|
||||||
|
|
||||||
@ -4165,7 +4168,7 @@ INT el_retrieve(LOGBOOK * lbs,
|
|||||||
{
|
{
|
||||||
int i, index, size, fh;
|
int i, index, size, fh;
|
||||||
char str[NAME_LENGTH], file_name[256], *p;
|
char str[NAME_LENGTH], file_name[256], *p;
|
||||||
char message[TEXT_SIZE + 1000], attachment_all[64 * MAX_ATTACHMENTS];
|
char *message, attachment_all[64 * MAX_ATTACHMENTS];
|
||||||
|
|
||||||
if (message_id == 0)
|
if (message_id == 0)
|
||||||
/* open most recent message */
|
/* open most recent message */
|
||||||
@ -4190,9 +4193,12 @@ INT el_retrieve(LOGBOOK * lbs,
|
|||||||
text, textsize, in_reply_to, reply_to, attachment, encoding, locked_by);
|
text, textsize, in_reply_to, reply_to, attachment, encoding, locked_by);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message = malloc(TEXT_SIZE + 1000);
|
||||||
|
|
||||||
lseek(fh, lbs->el_index[index].offset, SEEK_SET);
|
lseek(fh, lbs->el_index[index].offset, SEEK_SET);
|
||||||
i = read(fh, message, sizeof(message) - 1);
|
i = read(fh, message, TEXT_SIZE + 1000 - 1);
|
||||||
if (i <= 0) {
|
if (i <= 0) {
|
||||||
|
free(message);
|
||||||
close(fh);
|
close(fh);
|
||||||
return EL_FILE_ERROR;
|
return EL_FILE_ERROR;
|
||||||
}
|
}
|
||||||
@ -4201,6 +4207,7 @@ INT el_retrieve(LOGBOOK * lbs,
|
|||||||
close(fh);
|
close(fh);
|
||||||
|
|
||||||
if (strncmp(message, "$@MID@$:", 8) != 0) {
|
if (strncmp(message, "$@MID@$:", 8) != 0) {
|
||||||
|
free(message);
|
||||||
/* file might have been edited, rebuild index */
|
/* file might have been edited, rebuild index */
|
||||||
el_build_index(lbs, TRUE);
|
el_build_index(lbs, TRUE);
|
||||||
return el_retrieve(lbs, message_id, date, attr_list, attrib, n_attr,
|
return el_retrieve(lbs, message_id, date, attr_list, attrib, n_attr,
|
||||||
@ -4208,8 +4215,10 @@ INT el_retrieve(LOGBOOK * lbs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check for correct ID */
|
/* check for correct ID */
|
||||||
if (atoi(message + 8) != message_id)
|
if (atoi(message + 8) != message_id) {
|
||||||
|
free(message);
|
||||||
return EL_FILE_ERROR;
|
return EL_FILE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
/* decode message size */
|
/* decode message size */
|
||||||
p = strstr(message + 8, "$@MID@$:");
|
p = strstr(message + 8, "$@MID@$:");
|
||||||
@ -4285,6 +4294,7 @@ INT el_retrieve(LOGBOOK * lbs,
|
|||||||
if ((int) strlen(p) >= *textsize) {
|
if ((int) strlen(p) >= *textsize) {
|
||||||
strlcpy(text, p, *textsize);
|
strlcpy(text, p, *textsize);
|
||||||
show_error("Entry too long to display. Please increase TEXT_SIZE and recompile elogd.");
|
show_error("Entry too long to display. Please increase TEXT_SIZE and recompile elogd.");
|
||||||
|
free(message);
|
||||||
return EL_FILE_ERROR;
|
return EL_FILE_ERROR;
|
||||||
} else {
|
} else {
|
||||||
strlcpy(text, p, *textsize);
|
strlcpy(text, p, *textsize);
|
||||||
@ -4304,6 +4314,7 @@ INT el_retrieve(LOGBOOK * lbs,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(message);
|
||||||
return EL_SUCCESS;
|
return EL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13162,6 +13173,10 @@ void synchronize(LOGBOOK * lbs, int mode)
|
|||||||
&& !strieq(lb_list[i].top_group, getcfg_topgroup()))
|
&& !strieq(lb_list[i].top_group, getcfg_topgroup()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* skip if excluded */
|
||||||
|
if (getcfg(lb_list[i].name, "Mirror exclude", str, sizeof(str)) && atoi(str) == 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* if called by cron, set user name and password */
|
/* if called by cron, set user name and password */
|
||||||
if (mode == SYNC_CRON && getcfg(lb_list[i].name, "mirror user", str, sizeof(str))) {
|
if (mode == SYNC_CRON && getcfg(lb_list[i].name, "mirror user", str, sizeof(str))) {
|
||||||
if (get_user_line(lb_list[i].name, str, pwd, NULL, NULL, NULL) == EL_SUCCESS) {
|
if (get_user_line(lb_list[i].name, str, pwd, NULL, NULL, NULL) == EL_SUCCESS) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user