I have a setup wherein admin need to be able to edit .phtml files. However, since the files are all under subversion control, I want to use PHPSVN to commit the files after they are edited.
The production server is CentOS. As I use svn2web, I have my working copies separate from the actual file-system in a directory called /home/working-copies.
Each file is editable through a textarea in a form. When user submits the form, the contents of the textarea are written over the working copy file using file_put_contents.
Ideally, the file would then be committed via svn_commit. However, instead of committing I get an error of "Not Found". If I attempt to save/svn_commit again, I get an error of "Attempted to lock an already-locked dir". The file is successfully overwritten, but the commit fails.
I then must manually (via command line) execute svn cleanup. When the working copy is unlocked, I am also able to manually commit successfully.
I have been unable to find any documentation of the "Not Found" error, but I am quite sure it's originating from the svn_commit. I am also sure that the attempt to commit the file is what locks the directory.
- SVN and the PHPSVN extension are both installed.
- svn_client_version() returns the correct version of SVN on the server (which seems to indicate that the PHPSVN extension is working... maybe?)
- The entire process does work on my local Ubuntu machine. Is this perhaps an issue with PHPSVN on the CentOS server?
I am not sure how to even go about debugging this issue further and I appreciate any input. Thank you.
Edit (2013-07-23) While I still haven't managed to solve the issue using the PHPSVN extension, I was able to use exec(). Here is the syntax I used, in case it helps anyone in the future:
// The flags used help get around any SSL certificate errors.
exec('cd /home/working-copies/testfolder; svn commit "test.phtml" --username "username" --password "pw" --no-auth-cache --non-interactive --trust-server-cert -m "test svn" 2>&1', $output, $returnStatus);
// Print the output to help debug.
if ( $returnStatus )
{
print_r($output);
}
I am still very curious as to the "Not Found" error I was getting while using PHPSVN, so I will leave this question open in hopes of finding an answer. Thanks again.