tags:

views:

47

answers:

6

I have a hosting (hostgator) account with a master directory and multiple subdirectories, each representing a www address. I'd like to know if its possible to create an interface in php that would allow me to update a given file (say, header.php) in a specific folder (my custom wordpress theme which resides in each site) which will be the same in every site.

I currently have to do this via FTP, but its cumbersome b/c I have to open each directory and copy the file to it. So if I have 30 sites to update, its very time consuming. i'd like to just have a list of sites with a checkbox beside each of them (and a "select all" toggle) and run the update on all sites in one click)

Thanks for your input!

PS: I know there are probably chron scripts or interfaces that can do this, but I'll be creating a scriptable (PHP) solution I can package up and send to someone and it just works and is brain-dead simple to use.

+1  A: 

Yes, it's possible, you can modify files using PHP's file functions and you can communicate what to update through sockets.

It would be fairly complicated to implement though so I'm not sure what you're asking for.. Yes it's possible but I doubt someone here will give you a copy&paste solution. Do you have a more specific question?


EDIT: an easier solution would be to have a SVN repository so you can simply do it with one line of PHP code:

`svn update`
Andreas Bonini
i would do that
streetparade
Can I package an SVN repository with my script that I'm sending the user? I want everything to be easy install.
Scott B
+1  A: 

Any reason you're not using WordPress MU? With it and the child theme functionality built into recent versions of WordPress, your life might be a lot easier.

ceejayoz
My hosting provider (hostgator) provides one-click installs of wordpress, but not wordpress MU. That's the only reason. So, if I'm able to istall MU on my master domain, I can bypass hostgator's one click install and install from the MU interface?
Scott B
A: 

Yes:

I currently have to do this via FTP, but its cumbersome b/c I have to open each directory and copy the file to it. So if I have 30 sites to update, its very time consuming. i'd like to just have a list of sites with a checkbox beside each of them (and a "select all" toggle) and run the update on all sites in one click)

Basically you need to script those FTP actions and provide some logic as to what path and what files. You can then style the entire thing with a simple front end, listing your sites with a checkbox to select.

Doesn't seem difficult, just have to get the FTP path traversal working and file cp'ing down.

Mr-sk
Script those commands in a .php file? If so, I expect I'll just have to provide a means to pass the username/password to the user's FTP server, along with the file info. Am I on the right track with what you are proposing?
Scott B
Yeah, that sounds good.
Mr-sk
A: 

Have a look at Phing and search Google for deployment with PHP

Gordon
Will do, thanks for the suggestion.
Scott B
A: 

If you are hosting multiple WP sites, you really should use WPMU.

I've implemented Uploadify for single / multiple file upload. Works great. I also use Wordpress.

Steven
Steven, I've come across WPMU several times. Since my host only has the 1-click install for Wordpress, how would you suggest to implement WPMU with the same functionality? 1-click site creation, that is.
Scott B
A: 

if its just the header.php and you dont have svn (you could setup an hook which would copy it for you to the right place) you could write a bash script if you have ssh access

streetparade