0

I want to enable only one user at a time, to edit a file.

File would be edited through either tinyMCE or another WYSIWYG editor.

Example:

When User A is editing file f, user B will have to wait for User A to come out of editing.

How can I make this work?

Beri
  • 11,470
  • 4
  • 35
  • 57
nlangerdev
  • 122
  • 15
  • You want to disable the editing of `editor`...? what is your context of `file`? – Krishna38 Apr 16 '15 at 09:20
  • files will mainly be pdf documents, doc or docx files. Video files and image files will also be on the system but as they can't be modified that isn't an issue. I want to disable editing for the secondary user. So the primary user who enters the file first and puts the file into edit mode can make changes. But then when another user comes along, they are told that %user% is in the file, you are viewing this file in read only mode. – nlangerdev Apr 16 '15 at 09:23
  • Are you keeping a log/flag of who is trying to edit the file in the database? – aksappy Apr 16 '15 at 09:36
  • I have the fields ready for it yes – nlangerdev Apr 16 '15 at 09:51
  • Rewritten the question in shorter, more understandable form. – Beri Apr 16 '15 at 12:33
  • Thankyou for simplifying the question for me, I tried to write it in the best way I could but couldn't seem to work it. So thankyou – nlangerdev Apr 16 '15 at 12:34

1 Answers1

0

You would want to have a lock on the file if a user views it. PHP offers the Mutex::lock for that purpose. After editing, you release the lock and the file is free for other users edits again.

st.eve
  • 114
  • 1
  • 4