SimuleditWithoutPopen

Note: This recipe is outdated -- see SimultaneousEdits? for an updated version of this recipe.

Superceded

Goal

Use Simuledit on Server with popen() not allowed

Problem description

When your webserver runs in safe mode, it will not allow popen(), neccessary for a proper working of the simultaneous edit routine. What you get after a simultaneous edit is an empty page in the edit screen in stead of a proper hint where the edit conflict is.

Solution

  1. Put Attach:simuledit.php into the folder cookbook/simuledit
  2. Put diff3.php into the folder cookbook/simuledit
  3. Change require_once('lib/difflib.php') to require_once('difflib.php') in diff3.php
  4. Replace return $lines; at the bottom of diff3.php with return join("\n",$lines);
  5. Put difflib.php into the folder cookbook/simuledit
  6. delete the second line rcs_id ... in diff3.php and difflib.php
  7. put $EnableSimulEdit = 0; in your config.php to disable scripts/ simuledit.php
  8. put include_once("cookbook/simuledit/simuledit.php"); in your config.php to activate the new script
  9. in difflib.php, search for "function final ()" and replace the word final with anything else e.g. wibble. Then search for "final()" and replace all occurances with "wibble()" (assuming this was the function name you chose). Note this fixes a php parse error I was seeing with pmwiki 2.0 beta 36.

Discussion

The diff3.php and difflib.php files are source code in a webpage. You can copy and paste (as plain ascii) the code in an editor and save them as file (resp. diff3.php and difflib.php) or use the big download button in the left upper corner of the download page.

For the pmwiki release 2.0.beta54 the attached simuledit.php script no longer works. You will have to open the vanilla: scripts/simuledit.php and copy the entire function MergeSimulEdits() from the original simuledit.php into the above one. The problem is some name changes to variables etc.

History

  • 28.07.04 - First Release
  • 12.02.05 - some changes for pmwiki 2.0 beta 20
  • 20.06.05 - set to work with pmwiki 2.0 beta 36 (fixed PHP parse error being reported by adding step above)
  • 30.08.05 - added information to make this work with pmwiki 2.0 beta 54 davidof

Contributer

Licences

  • simuledit.php - see PmWiki
  • diff3.php and difflib.php - GPL

Notes

tested with pmwiki 2.1 beta 22

  • Gives a lot of warning messages with PHP5 - Klonk March 01, 2006, at 03:12 AM