Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

We just got our servers set up with SVN which works great. Wordpress upgrades and plugin installations are managed manually, which all goes through SVN as well, but I can't work out a good way to version control upload directories.

The best solution I can think of is to periodically go into the folders, look through the images to make sure they are legitimate (no self-unpacking shell scripts, etc) and commit them... either that or svn:ignore the entire folder.

Is there a better way to do this? All the discussion I can find on Google has to do with using SVN for Wordpress installs, not dynamically managed assets.

share|improve this question
add comment

1 Answer

You could hook into the action add_attachment and perform an SVN commit.

add_action( 'add_attachment', 'svn_commit_attachments' );

function svn_commit_attachments( $attachment_ID )
{
    // collect data about the attachment, for example its path, the user and so on.
     shell_exec ( '$ svn commit -m "$user added file $filename."' )
}
share|improve this answer
    
This is certainly an option... I wonder how difficult it would be to write a plugin so users could do a "verification" commit. Part of the reason we moved to SVN was to catch malicious changes made on our servers, so having uploads automatically committed scares me a bit. I'm gonna play with this snippet and see what I can come up with. –  kristina childs Apr 23 '13 at 23:23
    
@kristinachilds This is just a rough draft. If you had used Git you could add those uploads to the stage. But as far as I’m aware there is no such concept in SVN. –  toscho Apr 23 '13 at 23:25
    
This whole version control concept is new to me. Coudda Shoudda Wouldda... of course I would learn that a week after our new infrastructure was built :) –  kristina childs Apr 23 '13 at 23:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.