Commits

Anonymous committed e8959f5

- checkinstall script determines if installation/configuration is OK
- update branding to phpHgAdmin

  • Participants
  • Parent commits 39d2386

Comments (0)

Files changed (7)

File admin/application/config/config.php

 |	http://example.com/
 |
 */
-$config['base_url']	= "http://localhost/admin/";
+$config['base_url']	= "http://localhost:8080/admin/";
 
 /*
 |--------------------------------------------------------------------------

File admin/application/config/hgphp.php

 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');

File admin/checkinstall.php

+<?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;
+?>

File admin/themes/mercurial/views/coal.php

   <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>

File admin/themes/mercurial/views/gitweb.php

   <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>

File admin/themes/mercurial/views/monoblue.php

   <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>

File admin/themes/mercurial/views/paper.php

   <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>