summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2010-04-16 19:04:17 +0000
committerfisharebest <fisharebest@gmail.com>2010-04-16 19:04:17 +0000
commit6a0c84572975de36fcb54c4c08f99429a000bb3a (patch)
treed3f8ab9ad862216b2d5178bcb6700954c397253e
parent996bdcce0264b41413d2eec7b1cd998b00b838fe (diff)
downloadwebtrees-6a0c84572975de36fcb54c4c08f99429a000bb3a.tar.gz
webtrees-6a0c84572975de36fcb54c4c08f99429a000bb3a.tar.bz2
webtrees-6a0c84572975de36fcb54c4c08f99429a000bb3a.zip
Remove sync-edits-to-gedcom feature. Webtrees is a database application - https://blueprints.launchpad.net/webtrees/+spec/remove-sync-gedcom-file
-rw-r--r--config_gedcom.php1
-rw-r--r--edit_changes.php3
-rw-r--r--edit_merge.php3
-rw-r--r--editconfig_gedcom.php9
-rw-r--r--gedcheck.php2
-rw-r--r--help_text.php5
-rw-r--r--includes/functions/functions_import.php104
-rw-r--r--uploadgedcom.php3
8 files changed, 3 insertions, 127 deletions
diff --git a/config_gedcom.php b/config_gedcom.php
index 4277f3d804..d25e2b8d64 100644
--- a/config_gedcom.php
+++ b/config_gedcom.php
@@ -79,7 +79,6 @@ $SHOW_REGISTER_CAUTION = true; // -- Show text about following site rules on Lo
$SHOW_GEDCOM_RECORD = true; // -- a true value will provide a link on detail pages that will
// --allow people to view the actual lines from the gedcom file
$ALLOW_EDIT_GEDCOM = true; //-- allow users with canEdit privileges to edit the gedcom
-$SYNC_GEDCOM_FILE = true; //-- synchronize the gedcom file with online edits. when set to false no changes will be written to the gedcom file
$ENABLE_AUTOCOMPLETE = true; //-- Enable Autocomplete for certain input fields
$POSTAL_CODE = true; //-- allow users to choose where to print the postal code. True is after the city name, false is before the city name
$SUBLIST_TRIGGER_I = "200"; // -- Number of names required before Individual lists start sub-listing by first name
diff --git a/edit_changes.php b/edit_changes.php
index 676dab063a..83e3aec43f 100644
--- a/edit_changes.php
+++ b/edit_changes.php
@@ -96,9 +96,6 @@ case 'acceptall':
}
write_changes();
$manual_save = false;
- if ($SYNC_GEDCOM_FILE) {
- write_file();
- }
echo '<b>', i18n::translate('Changes successfully accepted into database'), '</b>';
break;
}
diff --git a/edit_merge.php b/edit_merge.php
index 845c76f5b6..72d250f435 100644
--- a/edit_merge.php
+++ b/edit_merge.php
@@ -237,9 +237,6 @@ if ($action!="choose") {
}
replace_gedrec($gid1, $newgedrec);
- if ($SYNC_GEDCOM_FILE) {
- write_file();
- }
write_changes();
$rec=GedcomRecord::getInstance($gid1);
echo '<br />', i18n::translate('Record %s successfully updated.', $rec->getXrefLink()), '<br />';
diff --git a/editconfig_gedcom.php b/editconfig_gedcom.php
index c954948b60..e11bdaeb11 100644
--- a/editconfig_gedcom.php
+++ b/editconfig_gedcom.php
@@ -399,7 +399,6 @@ if ($action=="update") {
$configtext = preg_replace('/\$SURNAME_LIST_STYLE\s*=\s*.*;/', "\$SURNAME_LIST_STYLE = \"".$_POST["NEW_SURNAME_LIST_STYLE"]."\";", $configtext);
$configtext = preg_replace('/\$SUPPORT_METHOD\s*=\s*".*";/', "\$SUPPORT_METHOD = \"".$_POST["NEW_SUPPORT_METHOD"]."\";", $configtext);
$configtext = preg_replace('/\$SURNAME_TRADITION\s*=\s*.*;/', "\$SURNAME_TRADITION = \"".$_POST["NEW_SURNAME_TRADITION"]."\";", $configtext);
- $configtext = preg_replace('/\$SYNC_GEDCOM_FILE\s*=\s*.*;/', "\$SYNC_GEDCOM_FILE = ".$boolarray[$_POST["NEW_SYNC_GEDCOM_FILE"]].";", $configtext);
$configtext = preg_replace('/\$THUMBNAIL_WIDTH\s*=\s*".*";/', "\$THUMBNAIL_WIDTH = \"".$_POST["NEW_THUMBNAIL_WIDTH"]."\";", $configtext);
$configtext = preg_replace('/\$UNDERLINE_NAME_QUOTES\s*=\s*.*;/', "\$UNDERLINE_NAME_QUOTES = ".$boolarray[$_POST["NEW_UNDERLINE_NAME_QUOTES"]].";", $configtext);
$configtext = preg_replace('/\$USE_RIN\s*=\s*.*;/', "\$USE_RIN = ".$boolarray[$_POST["NEW_USE_RIN"]].";", $configtext);
@@ -1818,14 +1817,6 @@ print "&nbsp;<a href=\"javascript: ".i18n::translate('Edit Options')."\" onclick
</tr>
<tr>
<td class="descriptionbox wrap width20">
- <?php echo i18n::translate('Synchronize edits into GEDCOM file'), help_link('SYNC_GEDCOM_FILE'); ?>
- </td>
- <td class="optionbox">
- <?php echo edit_field_yes_no('NEW_SYNC_GEDCOM_FILE', $SYNC_GEDCOM_FILE, 'tabindex="'.(++$i).'" onfocus="getHelp(\'SYNC_GEDCOM_FILE\');"'); ?>
- </td>
- </tr>
- <tr>
- <td class="descriptionbox wrap width20">
<?php echo i18n::translate('Enable Autocomplete'), help_link('ENABLE_AUTOCOMPLETE'); ?>
</td>
<td class="optionbox">
diff --git a/gedcheck.php b/gedcheck.php
index 1466d4c6ea..0fe0bd8a91 100644
--- a/gedcheck.php
+++ b/gedcheck.php
@@ -131,7 +131,7 @@ if (!isset($_POST['action'])) {
}
// If we're checking a gedcom that is imported into the database, check that the file is synchronised
-if ($ged==WT_GEDCOM && !$SYNC_GEDCOM_FILE) {
+if ($ged==WT_GEDCOM) {
$ged_link='href="javascript:" onclick="window.open(\''.encode_url("export_gedcom.php?export={$ged}").'\', \'_blank\',\'left=50,top=50,width=500,height=500,resizable=1,scrollbars=1\');"';
echo '<div class="error">', i18n::translate('Edits made to the database are not synchronized to the file %s. The file contents may be out-of-date. You can synchronize it with the database now by performing an <b><a "%s">export</a></b>.', $ged, $ged_link), '</div><hr/>';
}
diff --git a/help_text.php b/help_text.php
index 495b2ceb19..27b5f1fe0c 100644
--- a/help_text.php
+++ b/help_text.php
@@ -2880,11 +2880,6 @@ case 'SURNAME_TRADITION':
$text=i18n::translate('When you add new members to a family, <b>webtrees</b> can supply default values for surnames according to regional custom.<br /><br /><ul><li>In the <b>Paternal</b> tradition, all family members share the father\'s surname.</li><li>In the <b>Spanish</b> and <b>Portuguese</b> tradition, children receive a surname from each parent.</li><li>In the <b>Icelandic</b> tradition, children receive their male parent\'s given name as a surname, with a suffix that denotes gender.</li><li>In the <b>Polish</b> tradition, all family members share the father\'s surname. For some surnames, the suffix indicates gender. The suffixes <i>ski</i>, <i>cki</i>, and <i>dzki</i> indicate male, while the corresponding suffixes <i>ska</i>, <i>cka</i>, and <i>dzka</i> indicate female.</li></ul>');
break;
-case 'SYNC_GEDCOM_FILE':
- $title=i18n::translate('Synchronize edits into GEDCOM file');
- $text=i18n::translate('In past versions of <b>webtrees</b> the pending edits were stored in the GEDCOM file and the changed records were then "accepted" into the database. Starting with v4.1 pending changes are no longer stored in the GEDCOM file but in the changes file. <br /><br />Setting this value to true will update the GEDCOM file when changes are accepted into the database. This will keep the GEDCOM file synchronized with the database. For greater compatibility with previous versions the default value of this field is on.<br /><br />You may want to turn it off to conserve memory when accepting changes.');
- break;
-
case 'THEME_DIR':
$title=i18n::translate('Theme directory');
$text=i18n::translate('The directory where your <b>webtrees</b> theme files are kept.<br /><br />You may customize any of the standard themes that come with <b>webtrees</b> to give your site a unique look and feel. See the Theme Customization section of the <a href="readme.txt">readme.txt</a> file for more information.');
diff --git a/includes/functions/functions_import.php b/includes/functions/functions_import.php
index d35c1d065b..fefd2a71f4 100644
--- a/includes/functions/functions_import.php
+++ b/includes/functions/functions_import.php
@@ -1253,56 +1253,6 @@ function read_gedcom_file() {
}
}
-//-------------------------------------------- write_file
-//-- this function writes the $fcontents back to the
-//-- gedcom file
-function write_file() {
- global $fcontents;
-
- if (empty($fcontents)) {
- return;
- }
- if (strpos($fcontents, "0 TRLR")===false) {
- $fcontents.="0 TRLR\n";
- }
- //-- write the gedcom file
- $path=get_gedcom_setting(WT_GED_ID, 'path');
- if (!is_writable($path)) {
- print "ERROR 5: GEDCOM file is not writable. Unable to complete request.\n";
- AddToChangeLog("ERROR 5: GEDCOM file is not writable. Unable to complete request. ->" . WT_USER_NAME ."<-");
- return false;
- }
- //-- only allow one thread to write the file at a time
- $mutex = new Mutex(WT_GEDCOM);
- $mutex->Wait();
- //-- what to do if file changed while waiting
-
- $fp = fopen($path, "wb");
- if ($fp===false) {
- print "ERROR 6: Unable to open GEDCOM file resource. Unable to complete request.\n";
- AddToChangeLog("ERROR 6: Unable to open GEDCOM file resource. Unable to complete request. ->" . WT_USER_NAME ."<-");
- return false;
- }
- $fl = @flock($fp, LOCK_EX);
- if (!$fl) {
- AddToChangeLog("ERROR 7: Unable to obtain file lock. ->" . WT_USER_NAME ."<-");
- }
- $fw = fwrite($fp, $fcontents);
- if ($fw===false) {
- print "ERROR 7: Unable to write to GEDCOM file.\n";
- AddToChangeLog("ERROR 7: Unable to write to GEDCOM file. ->" . WT_USER_NAME ."<-");
- $fl = @flock($fp, LOCK_UN);
- fclose($fp);
- return false;
- }
- $fl = @flock($fp, LOCK_UN);
- fclose($fp);
- //-- always release the mutex
- $mutex->Release();
- $logline = AddToLog($path." updated", 'config');
-
- return true;
-}
/**
* Accpet changed gedcom record into database
*
@@ -1311,7 +1261,7 @@ function write_file() {
* @param string $cid The change id of the record to accept
*/
function accept_changes($cid) {
- global $pgv_changes, $GEDCOM, $TBLPREFIX, $SYNC_GEDCOM_FILE, $fcontents, $manual_save;
+ global $pgv_changes, $GEDCOM, $TBLPREFIX, $fcontents, $manual_save;
if (isset ($pgv_changes[$cid])) {
$changes = $pgv_changes[$cid];
@@ -1328,58 +1278,6 @@ function accept_changes($cid) {
update_record($gedrec, $ged_id, $change["type"]=="delete");
- //-- write the changes back to the gedcom file
- if ($SYNC_GEDCOM_FILE) {
- // TODO: We merge CONC lines on import, so need to add them back on export
- if (!isset($manual_save) || $manual_save==false) {
- //-- only allow one thread to accept changes at a time
- $mutex = new Mutex("accept_changes");
- $mutex->Wait();
- }
-
- if (empty($fcontents)) {
- read_gedcom_file();
- }
- if ($change["type"]=="delete") {
- $pos1=find_newline_string($fcontents, "0 @{$gid}@");
- if ($pos1!==false) {
- $pos2=find_newline_string($fcontents, "0", $pos1+5);
- if ($pos2===false) {
- $fcontents=substr($fcontents, 0, $pos1).'0 TRLR'.WT_EOL;
- AddToLog("Corruption found in GEDCOM $GEDCOM Attempted to correct", 'error');
- } else {
- $fcontents=substr($fcontents, 0, $pos1).substr($fcontents, $pos2);
- }
- } else {
- AddToLog("Corruption found in GEDCOM $GEDCOM Attempted to correct. Deleted gedcom record $gid was not found in the gedcom file.", 'error');
- }
- } elseif ($change["type"]=="append") {
- $pos1=find_newline_string($fcontents, "0 TRLR");
- $fcontents=substr($fcontents, 0, $pos1).reformat_record_export($gedrec).'0 TRLR'.WT_EOL;
- } elseif ($change["type"]=="replace") {
- $pos1=find_newline_string($fcontents, "0 @{$gid}@");
- if ($pos1!==false) {
- $pos2=find_newline_string($fcontents, "0", $pos1+5);
- if ($pos2===false) {
- $fcontents=substr($fcontents, 0, $pos1).'0 TRLR'.WT_EOL;
- AddToLog("Corruption found in GEDCOM $GEDCOM Attempted to correct", 'error');
- } else {
- $fcontents=substr($fcontents, 0, $pos1).reformat_record_export($gedrec).substr($fcontents, $pos2);
- }
- } else {
- //-- attempted to replace a record that doesn't exist
- AddToLog("Corruption found in GEDCOM $GEDCOM Attempted to correct. Replaced gedcom record $gid was not found in the gedcom file.", 'error');
- $pos1=find_newline_string($fcontents, "0 TRLR");
- $fcontents=substr($fcontents, 0, $pos1).reformat_record_export($gedrec).'0 TRLR'.WT_EOL;
- AddToLog("Gedcom record $gid was appended back to the GEDCOM file.", 'edit');
- }
- }
- if (!isset($manual_save) || $manual_save==false) {
- write_file();
- $mutex->Release();
- }
- }
-
unset ($pgv_changes[$cid]);
if (!isset($manual_save) || $manual_save==false) {
write_changes();
diff --git a/uploadgedcom.php b/uploadgedcom.php
index a2a4f2f455..1f812dd698 100644
--- a/uploadgedcom.php
+++ b/uploadgedcom.php
@@ -480,8 +480,7 @@ if ($verify == "verify_gedcom") {
if ($imported) {
print "<span class=error>".i18n::translate('A GEDCOM with this file name has already been imported into the database.')."</span><br /><br />";
- if (!$SYNC_GEDCOM_FILE)
- print "<span class=error>".i18n::translate('This GEDCOM file is <em>not</em> synchronized with the database. It may not contain the latest version of your data. To re-import from the database rather than the file, you should download and re-upload.')."</span><br /><br />";
+ print "<span class=error>".i18n::translate('This GEDCOM file is <em>not</em> synchronized with the database. It may not contain the latest version of your data. To re-import from the database rather than the file, you should download and re-upload.')."</span><br /><br />";
}
if ($bakfile != "") print i18n::translate('A GEDCOM file with the same name has been found. If you choose to continue, the old GEDCOM file will be replaced with the file that you uploaded and the Import process will begin again. If you choose to cancel, the old GEDCOM will remain unchanged.')."</td></tr>";
// NOTE: Check for existing changes