Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "w+" mode for opening/creating the unoconv lock file #49

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CRM/Civioffice/DocumentRendererType/LocalUnoconv.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ protected function lock()
{
$lock_file_path = $this->unoconv_lock_file_path;
if ($lock_file_path) {
$this->unoconv_lock_file = fopen($lock_file_path, "r+");
$this->unoconv_lock_file = fopen($lock_file_path, "w+");
if (!flock($this->unoconv_lock_file, LOCK_EX)) {
throw new Exception(E::ts("CiviOffice: Could not acquire unoconv lock."));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</div>

<div class="crm-section">
<div class="help">{ts}We strongly recommend creating a system-wide lock file on this server to synchronise access. (It may only run one unoconv process at the same time.) You can create such a file doing this in the server console:<br><code>touch /some/accessible/path/unoconv.lock && chmod 777 /some/accessible/path/unoconv.lock</code><br>Please note: This path needs to be equal in every civicrm environment on this server. Otherwise, locking is only active for this very civicrm instance!{/ts}</div>
<div class="help">{ts}We strongly recommend creating a system-wide lock file on this server to synchronise access. (It may only run one unoconv process at the same time.) Such a file is created automatically at the location shown below. Please note: This path needs to be equal in every civicrm environment on this server. Otherwise, locking is only active for this very civicrm instance!{/ts}</div>
<div class="label">{$form.unoconv_lock_file_path.label}</div>
<div class="content">{$form.unoconv_lock_file_path.html}</div>
<div class="clear"></div>
Expand Down
Loading