documentserver_community icon indicating copy to clipboard operation
documentserver_community copied to clipboard

File are not saved on file system but are only editable in onlyoffice

Open phaser32 opened this issue 3 years ago • 25 comments

Hello, unfortunately we realized that Onlyoffice allows editing of documents, BUT the documents are not saved correctly on Nextcloud and always show the first version loaded. This is a serious problem which in my opinion needs to be solved because onlyoffice becomes practically useless in this way. We should find a way to force saving the file on the file system as well. I've done some research and this seems to be a problem that has been dragging on for years. I also carried out any test using nextcloud versions 24 and 25 but always getting the exact same result. In various posts I have seen someone suggesting to run the occ documentserver:flush command This actually works, BUT you should have it run every time you save a file. I'm currently working with nextcloud 23 (apparently the most stable) onlyoffice 7.4.8 and Community Document Server 0.1.13. If anyone has any suggestions on this I would be very grateful. Alessandro

phaser32 avatar Dec 01 '22 08:12 phaser32

this is a very old issue, but still not fixed. That's one of the reasons, Nextcloud switched to five minutes cron schedule. But if changes happens more often, this could lead to data loss.

This is one of the reasons Nextcloud GmbH officially supports more Collabora than OnlyOffice due to lack of stability.

Just now - i'm going to open two other issues on OnlyOffice/DocumentServer

Githopp192 avatar Dec 01 '22 09:12 Githopp192

Thank You for reply, but since the occ documentserver:flush command correctly updates all files modified with OnlyOffice is it possible to schedule this command somehow? This would solve the problem permanently and permanently. Thanks to anyone who could figure out a solution. Alessandro

phaser32 avatar Dec 01 '22 11:12 phaser32

i think, nc cron.php should do the job. check if it runs every 5 min.

Other way could be .. trigger you flush cmd via cron-job (linux crontab), according to your whish (could be every minutes for example)

Githopp192 avatar Dec 01 '22 11:12 Githopp192

Thank you very much Githopp192 for your attention, but unfortunately I don't have the skills to compose the command. Could you be so kind as to give me more detailed information on which command to put as a cron job.

phaser32 avatar Dec 01 '22 11:12 phaser32

check this one:

https://opensource.com/article/17/11/how-use-cron-linux

Githopp192 avatar Dec 01 '22 11:12 Githopp192

command of course is: occ documentserver:flush

Githopp192 avatar Dec 01 '22 11:12 Githopp192

Do You mean something like that:

          • /usr/local/bin/[user]/public_html/[INSTALLATION FOLDER NEXTCLOUD]/cron.php occ documentserver:flush

phaser32 avatar Dec 01 '22 11:12 phaser32

yes , but i think you need to run occ as you apache user:

sudo -u //php ....../nextcloud/occ documentserver:flush

Githopp192 avatar Dec 01 '22 11:12 Githopp192

sorry .. did eat my cmd:

as example: sudo -u apache /bin/php /whre you nextcloud dir is/nextcloud/occ documentserver:flush

Githopp192 avatar Dec 01 '22 11:12 Githopp192

sorry .. did eat my cmd:

as example: sudo -u apache /bin/php /whre you nextcloud dir is/nextcloud/occ documentserver:flush

Githopp192 avatar Dec 01 '22 11:12 Githopp192

#minute Hour Day of Month Month Day of Week Command

(0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat)

#----------------------------------------------------------------------------

Githopp192 avatar Dec 01 '22 11:12 Githopp192

I tried it but I receive this error:

/bin/bash: - : invalid option Usage: /bin/bash [GNU long option] [option] ... /bin/bash [GNU long option] [option] script-file ... GNU long options: --debug --debugger --dump-po-strings --dump-strings --help --init-file --login --noediting --noprofile --norc --posix --protected --rcfile --rpm-requires --restricted --verbose --version Shell options: -irsD or -c command or -O shopt_option (invocation only) -abefhkmnptuvxBCHP or -o option

phaser32 avatar Dec 01 '22 11:12 phaser32

Mike, I'm so sorry. I finally solved the problem and all this thanks to you. Your suggestion was correct, but I'm on shared hosting so the command in the cron shouldn't be this: /usr/local/bin/php -q /home/[USER]/public_html/www/[NEXTCLOUD INSTALLATION FOLDER]/occ documentserver:flush I hope this will help others who are having the same problem. YOU MAKE MY DAY!!! Thank You so much Warm regards Ale

phaser32 avatar Dec 01 '22 17:12 phaser32

Ale, i'm glad you solved the issue. I whish you a wonderful day. cheers Mike

Githopp192 avatar Dec 01 '22 21:12 Githopp192

the cronjob works well for my local installation, but for the one at a hoster it doesn't synchronize the documents. Instead I have tons of empty directories like data/appdata_*/documentserver_community/doc_*/asc*/docx_unpacked/ which is eating up my inode quota :-(

I haven't found out the reason. One difference is that the database at the hoster is still mysql 5.7 whereas the local installation is already converted to mysql 8, or it's just a different usage pattern...

As a workaround for others who see the same problem as reported here, I have found out that you can export the current version of a document within onlyoffice. Download that file and upload it again in Nextcloud, replacing the existing version. This way you have an up to date file on disk, but I know, this is an uncomfortable workaround. It would be much better if onlyoffice could synchronize the current version of the documents as they are stored in the database to disk as well.

mrbaseman avatar Dec 05 '22 19:12 mrbaseman

the difference seems to be the file type. *.odt files are updated regularly, and the timestamp is always "a few seconds ago" (even if no changes are made anymore) at least with the cronjob, but for *docx files the timestamp sticks to the most recent upload of the file, but ignores the modifications made in onlyoffice. Anyhow, if one opens the file in onlyoffice, the changes are there.

mrbaseman avatar Dec 05 '22 21:12 mrbaseman

a workaround could be to export the files after editing within onlyoffice, and one can upload the file again to the folder in nextcloud (of course one would expect that this extra step is not needed)

mrbaseman avatar Dec 11 '22 20:12 mrbaseman

Hi, I just checked the nextcloud community document server 0.1.13 on NC 26.05 and can confirm that changes are not written back to the nextcloud storage. As described above opening the same file with ONLY OFFICE again, the changes are "stored" there. opening the same file with collabora or the synced file on the laptop the old version is used. As ONLYOFFICE is well announced https://nextcloud.com/blog/how-to-install-onlyoffice-in-nextcloud-hub-and-new-integration-feature/ it should also work as expected. It must also "work" without haveing access to root level occ commands as for example using a NC provider like Hetzner.

ferdiga avatar Oct 16 '23 08:10 ferdiga

I have to amend my statement above:

  • the file gets updated on nextcloud after some time (minutes) but IMO must get updated immediately, especially leaving ONLYOFFICE (by selecting a different app/icon) as there is no "close" button.
  • ONLY OFFICE runs in FAST mode - "all changes are saved automatically" - at least here it should be mentioned "with a delay of max x minutes"

ferdiga avatar Oct 16 '23 09:10 ferdiga

Hi @ferdiga , as I reported before You can create e cron job set it to run every 20 sec. The job could be something like that: /usr/local/bin/php -q /home/[USER]/public_html/www/[NEXTCLOUD INSTALLATION FOLDER]/occ documentserver:flush (thank ti great @Githopp192 ) Test it and let us know if it fixed the issue. Warm regards Ale

phaser32 avatar Oct 16 '23 14:10 phaser32

As I said, I have no access to the root account on the Hetzner service - hence I (and all other Hetzner and SaaS users) can not do what you ask for.

ferdiga avatar Oct 16 '23 15:10 ferdiga

Hi @ferdiga , I know it's not a conventional operation, and in some cases it could put the server under stress, but you could try writing a php script like the following:

<?php
while (true) {
    // do something

    // wait  20 second before running the next iteration
    sleep(20);
}
?>

and have it run every 20 seconds. Unfortunately I can't think of any other alternatives. Warm regards Ale

phaser32 avatar Oct 16 '23 16:10 phaser32

It would be very helpful to know the timespan after which the document server "saves" the file. It's about managing expectations.

ferdiga avatar Oct 16 '23 17:10 ferdiga