changeset 43:e8959f50523b

- checkinstall script determines if installation/configuration is OK - update branding to phpHgAdmin
author joshjcarrier
date Tue, 08 Jun 2010 23:32:05 -0700
parents 39d238675847
children 46961a5f545c
files admin/application/config/config.php admin/application/config/hgphp.php admin/checkinstall.php admin/themes/mercurial/views/coal.php admin/themes/mercurial/views/gitweb.php admin/themes/mercurial/views/monoblue.php admin/themes/mercurial/views/paper.php
diffstat 7 files changed, 143 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/admin/application/config/config.php	Tue Jun 08 23:08:41 2010 -0700
+++ b/admin/application/config/config.php	Tue Jun 08 23:32:05 2010 -0700
@@ -11,7 +11,7 @@
 |	http://example.com/
 |
 */
-$config['base_url']	= "http://localhost/admin/";
+$config['base_url']	= "http://localhost:8080/admin/";
 
 /*
 |--------------------------------------------------------------------------
--- a/admin/application/config/hgphp.php	Tue Jun 08 23:08:41 2010 -0700
+++ b/admin/application/config/hgphp.php	Tue Jun 08 23:32:05 2010 -0700
@@ -100,6 +100,7 @@
 define('HGPHP_REPO_STATUS_DISABLED', 0);
 define('HGPHP_REPO_STATUS_MISSING', 2);
 
+define('HGPHP_NAME', 'phpHgAdmin Mercurial Repository Manager');
 define('HGPHP_VERSION', '1.0.20100603');
 define('HGPHP_AUTHOR_NAME', 'Josh Carrier');
 define('HGPHP_AUTHOR_LINK', 'http://www.joshjcarrier.com');
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/admin/checkinstall.php	Tue Jun 08 23:32:05 2010 -0700
@@ -0,0 +1,137 @@
+<?php 
+header('Cache-Control: no-cache');
+header('Pragma: no-cache');
+define('BASEPATH', 'system/');
+include 'application/config/config.php';
+include 'application/config/hgphp.php';
+
+$checks = array(
+
+		/* base url, htaccess redirects, e-mailer set up, */
+		'General' => array(
+				'sitename' => array(
+						'description' => 'Makes sure it\'s not empty or pointing to localhost.',
+						'msg_warning' => '',
+						'msg_fail' => 'Set the site base url to an accessible address.',
+					),
+				'htaccess' => array(
+						'description' => 'Allows clean URLs and redirects while protecting direct access to framework scripts. Ensure Apache Rewrite module is enabled.',
+						'msg_warning' => '',
+						'msg_fail' => 'Restore the .htaccess file from initial install to this web directory.',
+					),
+			),
+		/* write temp directory, allow uploads */
+		'Server Permissions' => array(
+				'writetemp' => array(
+						'description' => 'Ensures local scratch space is writable.',
+						'msg_warning' => '',
+						'msg_fail' => 'Enable server write permissions to the temp directory. Config: lock_dir',
+					),
+				'writehgwebdir' => array(
+						'description' => 'Ensures Mercurial web directory registry is writable.',
+						'msg_warning' => '',
+						'msg_fail' => 'Allow hgwebdir.config to be writable by PHP. Config: hgwebconf_abs_filepath',
+					),
+				'writehgrc' => array(
+						'description' => 'Ensures Mercurial repository folder writable.',
+						'msg_warning' => '',
+						'msg_fail' => 'Allow Mercurial repositories folder to be writable by PHP. Config: repositories_abs_dir',
+					),
+			),
+	);
+	
+function table_result($t_name, $t_config, $t_result)
+{
+	$status_cell = '';
+	if($t_result)
+	{
+		$status_cell = '<td width=50 style="color:green" align=center>OK</td><td width="500"></td>';
+	}
+	else
+	{
+		$status_cell = '<td width=50 align=center valign=top><span style="color:white;background:red;padding:3"><b>FAIL</b></span></td><td width="500" valign=top><font size=-1>'.$t_config['msg_fail'].'</font></td>';
+	}
+	
+	echo "<tr><td width=100 valign=top><b>$t_name</b></td><td width=200 valign=top><font size=-1>".$t_config['description'] ."</font></td>$status_cell</tr>";
+}
+
+///////////////////////////////////////////////////////////////////
+
+function test_sitename()
+{
+	global $config;
+	return (!empty($config['base_url']) && stripos($config['base_url'], '127.0.0.1')===FALSE && stripos($config['base_url'], '://localhost')===FALSE);
+}
+
+function test_htaccess()
+{
+	return @file_exists('.htaccess');
+}
+
+///////////////////////////////////////////////////////////////////
+
+function test_writetemp()
+{
+	global $config;
+	return is_writable($config['lock_dir']);
+}
+
+function test_writehgwebdir()
+{
+	global $config;
+	return is_writable($config['hgwebconf_abs_filepath']);
+}
+
+function test_writehgrc()
+{
+	global $config;
+	return is_writable($config['repositories_abs_dir']);
+}
+
+///////////////////////////////////////////////////////////////////
+
+?>
+<html>
+<head>
+<title>phpHgAdmin Check Installation</title>
+</head>
+<body>
+<h2>phpHgAdmin Check Installation</h2>
+
+<fieldset>
+<legend>Server Information</legend>
+<table>
+<tr>
+	<td width="150"><b>PHP version</b></td>
+	<td><?php echo phpversion(); ?></td>
+</tr>
+<tr>
+	<td width="150"><b>Apache version</b></td>
+	<td><?php echo apache_get_version(); ?></td>
+</tr>
+</table>
+</fieldset>
+
+<?php foreach($checks as $category => $tests): ?>
+<fieldset>
+<legend><?php echo $category; ?></legend>
+<table width="100%">
+	<?php 
+		foreach($tests as $t_name => $test)
+		{
+			$t_result = call_user_func('test_'.$t_name);
+			echo table_result($t_name, $test, $t_result);
+		}
+		
+	?>
+</table>
+</fieldset>
+<?php endforeach;?><br/><font size="-1">
+<?php echo 'Report generated ' . date("g:i:s A D, F jS Y",time()); ?></font>
+</body>
+</html>
+<?php
+// clean up 
+	$config = null; 
+	$db = null;
+?>
\ No newline at end of file
--- a/admin/themes/mercurial/views/coal.php	Tue Jun 08 23:08:41 2010 -0700
+++ b/admin/themes/mercurial/views/coal.php	Tue Jun 08 23:32:05 2010 -0700
@@ -66,7 +66,7 @@
   <tr>
   	<td>
 <span style="background:#ffc;font-size:70%;">
-Processed in {elapsed_time} seconds. Hg-PHP Mercurial Repository Manager v<?php echo HGPHP_VERSION; ?> <a href="<?php echo HGPHP_AUTHOR_LINK; ?>"><?php echo HGPHP_AUTHOR_NAME; ?></a>. 
+Processed in {elapsed_time} seconds. <?php echo HGPHP_NAME; ?> v<?php echo HGPHP_VERSION; ?> <a href="<?php echo HGPHP_AUTHOR_LINK; ?>"><?php echo HGPHP_AUTHOR_NAME; ?></a>. 
 </span>  	
   	</td>
   </tr>
--- a/admin/themes/mercurial/views/gitweb.php	Tue Jun 08 23:08:41 2010 -0700
+++ b/admin/themes/mercurial/views/gitweb.php	Tue Jun 08 23:32:05 2010 -0700
@@ -64,7 +64,7 @@
   <tr>
   	<td>
 <span style="background:#ffc;font-size:70%;">
-Processed in {elapsed_time} seconds. Hg-PHP Mercurial Repository Manager v<?php echo HGPHP_VERSION; ?> <a href="<?php echo HGPHP_AUTHOR_LINK; ?>"><?php echo HGPHP_AUTHOR_NAME; ?></a>. 
+Processed in {elapsed_time} seconds. <?php echo HGPHP_NAME; ?> v<?php echo HGPHP_VERSION; ?> <a href="<?php echo HGPHP_AUTHOR_LINK; ?>"><?php echo HGPHP_AUTHOR_NAME; ?></a>. 
 </span>  	
   	</td>
   </tr>
--- a/admin/themes/mercurial/views/monoblue.php	Tue Jun 08 23:08:41 2010 -0700
+++ b/admin/themes/mercurial/views/monoblue.php	Tue Jun 08 23:32:05 2010 -0700
@@ -64,7 +64,7 @@
   <tr>
   	<td>
 <span style="background:#ffc;font-size:70%;">
-Processed in {elapsed_time} seconds. Hg-PHP Mercurial Repository Manager v<?php echo HGPHP_VERSION; ?> <a href="<?php echo HGPHP_AUTHOR_LINK; ?>"><?php echo HGPHP_AUTHOR_NAME; ?></a>. 
+Processed in {elapsed_time} seconds. <?php echo HGPHP_NAME; ?> v<?php echo HGPHP_VERSION; ?> <a href="<?php echo HGPHP_AUTHOR_LINK; ?>"><?php echo HGPHP_AUTHOR_NAME; ?></a>. 
 </span>  	
   	</td>
   </tr>
--- a/admin/themes/mercurial/views/paper.php	Tue Jun 08 23:08:41 2010 -0700
+++ b/admin/themes/mercurial/views/paper.php	Tue Jun 08 23:32:05 2010 -0700
@@ -72,7 +72,7 @@
   <tr>
   	<td>
 <span style="background:#ffc;font-size:70%;">
-Processed in {elapsed_time} seconds. Hg-PHP Mercurial Repository Manager v<?php echo HGPHP_VERSION; ?> <a href="<?php echo HGPHP_AUTHOR_LINK; ?>"><?php echo HGPHP_AUTHOR_NAME; ?></a>. 
+Processed in {elapsed_time} seconds. <?php echo HGPHP_NAME; ?> v<?php echo HGPHP_VERSION; ?> <a href="<?php echo HGPHP_AUTHOR_LINK; ?>"><?php echo HGPHP_AUTHOR_NAME; ?></a>. 
 </span>  	
   	</td>
   </tr>