test_setup.php
author rejo
Sun, 22 Apr 2007 07:20:09 +0000
changeset 8 47dd15d8bb8c
parent 3 64525a2eb098
child 47 ae140472d97c
permissions -rw-r--r--
[feladat @ 20] - Merged branches/1.3.0 changes r12:19 into the trunk.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     1
<?php
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     2
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     3
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     4
// | PowerAdmin								|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     5
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     6
// | Copyright (c) 1997-2002 The PowerAdmin Team			|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     7
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     8
// | This source file is subject to the license carried by the overal	|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     9
// | program PowerAdmin as found on http://poweradmin.sf.net		|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    10
// | The PowerAdmin program falls under the QPL License:		|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    11
// | http://www.trolltech.com/developer/licensing/qpl.html		|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    12
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    13
// | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl>	|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    14
// |          Sjeemz <sjeemz <AT> sjeemz <DOT> nl>			|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    15
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    16
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    17
// Filename: test_setup.php
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    18
// Description: tests your PowerAdmin install.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    19
// Adding tables? Increase the total count to (2^numberoftables)-1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    20
// Substract its binary value and put it in the last failure close.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    21
// Yes this is binary, why? Because thats cool! Squeeky geeky stuff!
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    22
//
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    23
// $Id: test_setup.php,v 1.4 2003/01/08 00:40:08 azurazu Exp $
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    24
//
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    25
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    26
include_once("inc/header.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    27
require_once("inc/config.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    28
require_once("inc/database.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    29
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    30
// Initialize variables
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    31
global $db;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    32
$bad_array = array();
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    33
$check_tables = array('zones', 'users', 'records', 'domains');
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    34
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    35
function error()
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    36
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    37
	return true;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    38
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    39
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    40
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'error');
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    41
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    42
foreach($check_tables as $table)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    43
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    44
	if(DB::isError($db->query("select * from $table")))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    45
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    46
		$bad_array[] = $table;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    47
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    48
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    49
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    50
$bad = (count($bad_array) == 0) ? false : true;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    51
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    52
// Start error or message output
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    53
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    54
echo "<P>";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    55
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    56
if($bad)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    57
{
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    58
	?><TABLE CLASS="error"><TR><TD CLASS="error"><H2><? echo _('Not all tables are ok!'); ?></H2><?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    59
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    60
else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    61
{
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    62
	?><TABLE CLASS="messagetable"><TR><TD CLASS="message"><H2><? echo _('Successful!'); ?></H2><?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    63
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    64
?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    65
<BR>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    66
<FONT STYLE="font-weight: Bold">
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    67
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    68
if($bad)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    69
{
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    70
	echo _('Sorry, but there are error(s) found in the following table(s):'); 
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    71
	foreach($bad_array as $table)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    72
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    73
		echo " '$table'";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    74
		}
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    75
		?>.</P><P><? echo _('Please fix these errors and run the script again.'); ?></P><?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    76
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    77
	else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    78
	{
3
64525a2eb098 [feladat @ 4]
rejo
parents: 2
diff changeset
    79
		echo _('Successful! Everything is set up ok, you can rumble!');
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    80
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    81
?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    82
<BR></TD></TR></TABLE></P>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    83
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    84
	include_once("inc/footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    85
?>