Page 1 of 1

Create a list of the CMS versions of multiple client websites with a UDT.

Posted: Wed Aug 25, 2010 12:32 pm
by Rolf
Some time ago in the Dutch board somebody was looking for a possibility to automaticly create a list of the CMS versions of several other (client) websites.

I have created two small User Defined Tags (UDTs). One for the clientside and one for the serverside. The data is stored in a automaticly created textfile on the clients server, you can change the name of this file and the folder where it is stored.
You can secure the version information per website with an identification code, and the info will be hashed transmitted by means of the PHP md5 function.
I would say it is fairly safe...

Client side

At the client websites you create the following UDT with a unique id code:
set_version_file

Code: Select all

// CLIENT CODE
// The unique id code must be equal to the one used in the {read_version_file} tag in the receiving site
$id = "hfue3nfls91";

// The filename should be the same as in the {read_version_file} tag
$file = "tmp/version.txt";

$create_write = @fopen(($_SERVER['DOCUMENT_ROOT'] . "/" . $file), 'w') or die("ERROR set_version_file UDT: Can't create or open version file!!");

global $CMS_VERSION;
$current_version= $CMS_VERSION;

$send_code = md5(($id . $current_version));

fwrite($create_write, $send_code);

fclose($create_write);
In the CMSMS EventManager you can call this UDT with for example LogoutPost
Every time somebody logs out of the admin, the data file is updated

Server side

Create another UDT at your own (secured) website:
read_version_file

Code: Select all

// SERVER CODE
// Example: {read_version_file url="www.yourwebsitename.com" id="hfue3nfls91"}
// The id code must be the same as in the 'set_version_file' udt in the other website

$id = $params[id];

$url = $params[url];

// The filename must be the same as in the 'set_version_file' udt
$file = "tmp/version.txt";

$complete_url = ("http://" . $url . "/" . $file);

$received_code = @file_get_contents($complete_url);

// Enter new release numbers below!
$cms_release = array (
"1.6", 
"1.6.1", 
"1.6.2", 
"1.6.3", 
"1.6.4", 
"1.6.5", 
"1.6.6", 
"1.6.7", 
"1.6.8", 
"1.7", 
"1.7.1", 
"1.7.2",
"1.8",
"1.8.1",
"1.8.2",
"1.8.3",
"1.9",
"2.0",
"2.1",
"2.2",
"2.3"
);

foreach ($cms_release as $foo) {

     $bar = md5(($id . $foo));

     if ($bar == $received_code) {
             echo $foo;
     }

}

In a secured webpage you can use the {read_version_file} tag like this:

Code: Select all

<p>www website.com {read_version_file url="www.website.com" id="hfue3nfls91"}</p>
<p>website.nl {read_version_file url="website.nl" id="hg6ogjvdruik33"}</p>
<p>www2 website.org {read_version_file url="www2.website.org" id="kjghlhgc55djf"}</p>

You will create a list of client websites, with it CMS version behind it:
www website.com 1.8.2
website.nl 1.6.8
www2 website.org 1.8.2

Re: Create a list of the CMS versions of multiple client web

Posted: Wed Aug 25, 2010 12:42 pm
by uniqu3
Thx Rolf for sharing, this is very usefull tip.

I was already thinking about feature like this, but it would be even better if it would be sort of a core feature for example in "Global Settings" where there would be a checkbox=send update notification input=my@mail.com.
Since user already gets notified in the Admin about an update available, this would be handy with options like above, so the main admin or developer who developed the site gets automated notification about update and site address and/or info.

Re: Create a list of the CMS versions of multiple client websites with a UDT.

Posted: Wed Aug 25, 2010 5:34 pm
by Nullig
Thank you for this excellent tip, Rolf.

What would be fantastic would be to extend it to also show the installed modules and their versions. That would make it easier to stay on top of things for sites you manage.

Nullig

Re: Create a list of the CMS versions of multiple client web

Posted: Wed Sep 10, 2014 9:42 pm
by Rolf

Re: Create a list of the CMS versions of multiple client web

Posted: Thu Jan 28, 2016 3:12 pm
by Rolf
New release of the SimpleSiteInfo and SimpleSiteMgr module available in the Forge.

Module is for CMSMS 2.x only and in not backwards compatible with previous releases...

-1 Install at all your websites:
http://dev.cmsmadesimple.org/projects/simplesiteinfo

-2 Install at your master website:
http://dev.cmsmadesimple.org/projects/simplesitemgr

-3 Fill the website information and pass phrase from #1 into the SimpleSiteMgr module

Now you have a nice maintenance tool to see the status of your websites!

Have fun!