Forum Moderators: coopster

Message Too Old, No Replies

Using includes to use one set of code on several sites

         

tintin99

4:07 pm on Jan 29, 2010 (gmt 0)

10+ Year Member



I've designed a CMS which is now in use on several of my websites and every time I make a change I have to update the files on all the sites. I've been wondering about just maintaining one set of core files on my development site and using includes to make the code available on my clients' sites. That way when I make an improvement all my clients get it at the same time.

The obvious risk with this is that if my dev site goes down all my clients lose their CMS, but I wonder if there are any other problems with this approach - maybe in terms of performance?

Are there any better options for keeping files up to date across several sites?

Thanks.

eelixduppy

4:09 pm on Jan 29, 2010 (gmt 0)



Host them all on the same server and keep the config file below all their roots with permissions to only read that specific file. I wouldn't acquire a config file like that over the internet, as many things can go wrong. It should either be local or not at all IMO.

KenB

4:15 pm on Jan 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I agree, local or not at all for security reasons. Plus remote pulls of code would slow down website response.

The way I handle this is that my CMS has a dedicated folder for shared files (and only shared files). All my own sites are on the same account/server so I can just do a symbolic link from the folder's of each website to the shared folder. For sites that use my CMS but are hosted on other servers all I need to do to provide an update is push the entire shared folder over to those other servers.

tintin99

4:39 pm on Jan 29, 2010 (gmt 0)

10+ Year Member



Thanks for the quick response guys! KenB please can you eaxplain what you mean by a symbolic link, I haven't come across that term before.

KenB

5:01 pm on Jan 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Symbolic links are a Unix (Linux, FreeBSD, etc.) thing.

Basically it looks like a normal file folder, but instead points to a different file folder. For instance, "/root/web/bluewidgets/shared/" actually points to "/root/web/sharedstuff/". Thus to the file system and Apache whatever you place in "/root/web/sharedstuf/" can also be referenced via "/root/web/bluewidgets/shared/".

The result is that you could place the file "admin/cp.inc" in "/root/web/sharedstuff/" but call the file from your script "index.html" in "/root/web/bluewidgets/" via "shared/admin/cp.inc".

It is a seriously useful way to share files between websites on the same account. Windows does not have an equivalent function unfortunately.

tintin99

5:13 pm on Jan 29, 2010 (gmt 0)

10+ Year Member



Thanks KenB - it sounds exactly what I need.

KenB

5:19 pm on Jan 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you have a control panel on your web hosting account, you should be able to make the symbolic links there.

eelixduppy

5:23 pm on Jan 29, 2010 (gmt 0)



otherwise:

man ln

:)