Page 1 of 2

A Support Tool

Posted: Fri Jun 13, 2008 12:24 am
by Nullig
Here is a small start to something I hope can be incorporated into the CMSMS Admin Panel. The idea is to provide a simple means to gather the basic info required for support questions in the Forum.

Create a UDT called "support_info" and add the following code:

Updated to include CMSMS Version and active modules
Updated 13/6/2008 to add more php config info, browser info and directory permission info
Updated 14/6/2008 mostly cosmetic changes and changed from get_cfg_var to ini_get
Updated 16/6/2008 to add mysqli and postgre db info

Code: Select all

global $gCms;
$db = &$gCms->db;
$config = &$gCms->config;

echo "<b>CMS Made Simple Version:</b> " . $GLOBALS['CMS_VERSION'] . "<br /> <br />";
echo "<b>Installed Modules:</b> ";
echo "<ul>";
$query = "SELECT * FROM ".cms_db_prefix()."modules WHERE active=1";
$dbresult = $db->Execute($query);
while($row = $dbresult->FetchRow()) {
	echo "<li>" . $row['module_name'] . ": " . $row['version'] . "</li>";
} 
echo "</ul>";

echo "<b>Current PHP Version:</b> " . phpversion() . "<br /> <br />";
echo "<b>PHP Configuration:</b>";
echo "<ul>";
echo "<li>Maximum Post Size: " . ini_get('post_max_size') . "</li>";
echo "<li>Maximum Upload Size: " . ini_get('upload_max_filesize') . "</li>";
echo "<li>PHP Memory Limit: " . ini_get( 'memory_limit' ) . "</li>";

if (ini_get('safe_mode') == 1) {
        echo "<li>PHP Safe Mode: On</li>";
} else {
        echo "<li>PHP Safe Mode: Off</li>";
}
echo "<li>Maximum Execution Time: " . ini_get('max_execution_time') . " seconds</li>";
echo "<li>Session Save Path: " . session_save_path() . "</li>";

echo "</ul>";

switch($config['dbms']) 
{
    case 'postgres7': 	$v = pg_version();
			$_server_db = "<b>PostgreSQL Server Version:</b> " . $v['server_version'];
                        break;
    case 'mysql':	$v = mysql_get_server_info();
			$_server_db = "<b>MySQL Server Version:</b> " . $v;
                        break;
    case 'mysqli':      $v = mysqli_get_server_info();
			$_server_db = "<b>MySQLi Server Version:</b> " . $v;
                        break;
}

echo $_server_db . "<br /> <br />";

echo "<b>Server Software:</b> " . $_SERVER['SERVER_SOFTWARE'] . "<br />";
echo "<b>Server API:</b> " . strtoupper(PHP_SAPI) . "<br />";
echo "<b>Server OS:</b> " . PHP_OS . " v " . php_uname('r') . " on " . php_uname('m') . " architecture<br /> <br />";

clearstatcache();

echo "<b>Directory Permissions:</b>";
echo "<ul>";
echo "<li>tmp/cache - " . substr(sprintf('%o', fileperms($config['root_path'].DIRECTORY_SEPARATOR.'tmp/cache')), -4) . "</li>";
echo "<li>tmp/templates_c - " . substr(sprintf('%o', fileperms($config['root_path'].DIRECTORY_SEPARATOR.'tmp/templates_c')), -4) . "</li>";
echo "<li>uploads - " . substr(sprintf('%o', fileperms($config['root_path'].DIRECTORY_SEPARATOR.'uploads')), -4) . "</li>";
echo "<li>modules - " . substr(sprintf('%o', fileperms($config['root_path'].DIRECTORY_SEPARATOR.'modules')), -4) . "</li>";
echo "</ul>";

echo "<b>Browser:</b> " . $_SERVER['HTTP_USER_AGENT'] . "<br />";
Now you can place the {support_info} tag on a test page and it will print out some of the basic configuration info that is required to provide effective support, which you can copy and paste into your Forum posting.

Perhaps others could add to the code, to make it more comprehensive. I'm thinking that we should be able to read the Apache and MySQL log files, to include a number of lines from them as well.

Nullig

Re: A Support Tool

Posted: Fri Jun 13, 2008 12:30 am
by calguy1000
Not a bad plan...

We should also include
  a) current CMS version  (global $CMS_VERSION)
  b) which versions of which modules are installed
      (iterating through $gCms->modules)
  c) the host type if we can get it
  d) some basic permissions checks
  e) some basic functionality tests (like what the installer has).

And when this information is collected, maybe, just maybe a module or something could be written that would allow a user to type in his CMS forum username, password, and a description of the problem and have this stuff posted to the forum as a new post.

It'd definately help some people to provide some useful information.  They would still have to know what all that information means.

Re: A Support Tool

Posted: Fri Jun 13, 2008 12:35 am
by Dr.CSS
Very nice...

I put it in a template, wrong one so I didn't see it...

How to put in other parts I wonder?...

Re: A Support Tool

Posted: Fri Jun 13, 2008 1:03 am
by Nullig
Forgot the MOST important piece of info... DUH!!!

So on your test page you have:

Code: Select all

CMS Made Simple Version: {cms_version}<br />
{support_info}
Nullig

Re: A Support Tool

Posted: Fri Jun 13, 2008 1:17 am
by nuno
mark wrote: Very nice...

I put it in a template, wrong one so I didn't see it...

How to put in other parts I wonder?...

or add in that UDT ;)
echo "CMS version: " . $GLOBALS['CMS_VERSION'] . "
";

Re: A Support Tool

Posted: Fri Jun 13, 2008 2:37 am
by Dr.CSS
Very nice indeed...

echo "Current PHP Version: " . phpversion() . "
";
echo "Maximum Post Size: " . get_cfg_var('post_max_size') . "
";
echo "Maximum Upload Size: " . get_cfg_var('upload_max_filesize') . "
";
echo "PHP Memory Limit: " . get_cfg_var( 'memory_limit' ) . "
";
echo "MySQL Server Version: " . mysql_get_server_info() . "
 
";
echo "Server Software: " . $_SERVER['SERVER_SOFTWARE'] . "
";
echo "CMS version: " . $GLOBALS['CMS_VERSION'] . "
 
";

=

Current PHP Version: 5.2.6
Maximum Post Size: 8M
Maximum Upload Size: 10M
PHP Memory Limit: 40M
MySQL Server Version: 5.0.45-community

Server Software: Apache/1.3.41 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.7a
CMS version: 1.3

Updated code now =...

CMS Made Simple Version: 1.3
Installed Modules:

    * CMSMailer vers - 1.73.13
    * FileManager vers - 0.3.0
    * MenuManager vers - 1.5
    * ModuleManager vers - 1.1.6
    * News vers - 2.8
    * nuSOAP vers - 1.0.1
    * Printing vers - 0.2.3
    * Search vers - 1.5
    * ThemeManager vers - 1.0.8
    * TinyMCE vers - 2.4.1
    * CGExtensions vers - 1.8
    * Blogs vers - 0.3.0b2
    * CompanyDirectory vers - 1.1.3

Current PHP version: 5.2.6
Maximum Post Size = 8M
Maximum Upload Size = 10M
PHP Memory Limit = 40M
MySQL server version = 5.0.45-community

Server Software = Apache/1.3.41 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.7a

Re: A Support Tool

Posted: Fri Jun 13, 2008 5:05 am
by cyberman
Nullig wrote: Here is a small start to something I hope can be incorporated into the CMSMS Admin Panel.
Yes - think a separate information page in admin panel would be a very good idea!

Users can access this page faster than an udt :).

Re: A Support Tool

Posted: Fri Jun 13, 2008 3:40 pm
by Pierre M.

Re: A Support Tool

Posted: Fri Jun 13, 2008 7:14 pm
by Nullig
Updated the first post to add some more info...

Re: A Support Tool

Posted: Fri Jun 13, 2008 8:25 pm
by alby
Nullig wrote: Updated the first post to add some more info...
Very nice idea.
Can you add this:
echo "Maximum Execution Time: " . get_cfg_var('max_execution_time') . "";
echo "Session Save Path: " . session_save_path() . "";

echo "SAPI: " . PHP_SAPI . "";
echo "OS: " . PHP_OS . "";
Alby

Re: A Support Tool

Posted: Fri Jun 13, 2008 8:38 pm
by Nullig
Thanks, alby. I've incorporated your suggestions.

Re: A Support Tool

Posted: Fri Jun 13, 2008 9:15 pm
by nuno
I hope can be incorporated into the CMSMS Admin Panel.
I hope to, is nice TOOL/UDT vs Support :)

Best regards

Re: A Support Tool

Posted: Fri Jun 13, 2008 11:27 pm
by calguy1000
I'll tell ya what...

if somebody writes the code, and submits a patch against current svn, I'll review it, and work with you to include it in 1.4

it may be a way to get your feet wet in core coding.

Re: A Support Tool

Posted: Sat Jun 14, 2008 1:37 am
by kermit
it could be incorporated into an "about cmsms" page in the back-end, perhaps under "main" or "site admin" -- with copyright info (including that for the various 3rd party code and libraries used), a list of the individuals who've contributed to the core code, links to the various parts of the cmsms.org site, the text of the gpl license (and others that may be used by portions of the code), and a little blurb about "how to submit a bug report and obtain support in the forums". it could even be rigged so that this page is shown the very first time the superadmin logs into the back-end after installation.

Re: A Support Tool

Posted: Sat Jun 14, 2008 2:55 am
by calguy1000
kermit, I like your way of thinking :)