Commit 5adccec7 authored by Felix Flor's avatar Felix Flor

fix a problem with wrong error message output. rebuild phar file.

parent cc0f9350
<?php
$neededModules = array( 'session','xml','Core','pdo','openssl','mcrypt','standard','mbstring','filter' );
$neddedModulesInstallStatus = array();
$neededFunctions = array( 'session_start','utf8_encode','utf8_decode','trim','substr','count','array_unique','mkdir','header','strtotime','date','strlen','explode','end','file_exists','unlink','in_array','move_uploaded_file','rename','sha1','setcookie','time','function_exists','openssl_random_pseudo_bytes','bin2hex','mcrypt_create_iv','md5','uniqid','dirname','opendir','readdir','is_dir','closedir','rmdir','nl2br','defined','define','password_hash','trigger_error','is_null','is_int','is_string','gettype','sprintf','method_exists','preg_match','is_readable','fopen','fread','fclose','str_pad','chr','mt_rand','base64_encode','strtr','rtrim','crypt','password_get_info','sscanf','password_needs_rehash','password_verify','ord','mb_strlen','mb_substr','htmlentities','session_destroy','date_format','date_create','mail','filter_var','unserialize','file_get_contents' );
$neededFunctionsInstallStatus = array();
$neededConstants = array( 'MCRYPT_DEV_URANDOM','PASSWORD_BCRYPT','E_USER_WARNING','PASSWORD_BCRYPT_DEFAULT_COST','NULL','PASSWORD_DEFAULT','FILTER_VALIDATE_EMAIL' );
$neededConstantsInstallStatus = array();
$neededClasses = array( 'PDO' );
$neededClassesInstallStatus = array();
# needed modules
foreach($neededModules as $neededModule){
if(!extension_loaded($neededModule) && $neededModule != "Core"){
$neddedModulesInstallStatus[$neededModule] = false;
} else {
$neddedModulesInstallStatus[$neededModule] = true;
}
}
# needed functions
foreach($neededFunctions as $neededFunction){
if(!function_exists($neededFunction)){
$neededFunctionsInstallStatus[$neededFunction] = false;
} else {
$neededFunctionsInstallStatus[$neededFunction] = true;
}
}
# needed constants
foreach($neededConstants as $neededConstant){
if(!defined($neededConstant)){
$neededConstantsInstallStatus[$neededConstant] = false;
} else {
$neededConstantsInstallStatus[$neededConstant] = true;
}
}
# needed classes
foreach($neededClasses as $neededClass){
if(!class_exists($neededClass)){
$neededClassesInstallStatus[$neededClass] = false;
} else {
$neededClassesInstallStatus[$neededClass] = true;
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>a:php:autoanalyse</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link rel="stylesheet" href="http://getbootstrap.com/docs/4.0/examples/narrow-jumbotron/narrow-jumbotron.css">
</head>
<body>
<div class="container">
<div class="row marketing">
<div class="col-lg-12">
<img src="http://resources.code-mesa.com/a-php-analyse/logo_small.png" alt="logo" class="img-fluid" />
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h4>Results</h4>
</div>
</div>
<hr>
<main role="main">
<div class="row">
<div class="col-lg-12">
<?php
if(in_array(false, $neededClassesInstallStatus)){
echo "<b>&#10008; Not all needed Classes are defined.</b><br>List of all not defined Classes";
} else {
echo "<b>&#10003; All needed Classes are defined.</b>";
}
?>
<ul>
<?php
// List of Classes
foreach($neededClassesInstallStatus as $class => $classStatus){
if(!$classStatus)
echo "<li>$class</li>";
}
?>
</ul>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-12">
<?php
if(in_array(false, $neededConstantsInstallStatus)){
echo "<b><&#10008; Not all needed Constants are defined.</b><br>List of all not defined Constants";
} else {
echo "<b>&#10003; All needed Constants are defined.</b>";
}
?>
<ul>
<?php
// List of Constants
foreach($neededConstantsInstallStatus as $constant => $constantStatus){
if(!$constantStatus)
echo "<li>$constant</li>";
}
?>
</ul>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-12">
<?php
if(in_array(false, $neededFunctionsInstallStatus)){
echo "<b>&#10008; Not all needed Functions are defined.</b><br>List of all not defined Functions";
} else {
echo "<b>&#10003; All needed Functions are defined.</b>";
}
?>
<ul>
<?php
// List of Functions
foreach($neededFunctionsInstallStatus as $function => $functionStatus){
if(!$functionStatus)
echo "<li>$function</li>";
}
?>
</ul>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-12">
<?php
if(in_array(false, $neddedModulesInstallStatus)){
echo "<b>&#10008; Not all needed Modules are installed</b><br>List of all not installed Modules";
} else {
echo "<b>&#10003; All needed Modules are installed</b>";
}
?>
<ul>
<?php
// List of Modules
foreach($neddedModulesInstallStatus as $module => $moduleStatus){
if(!$moduleStatus)
echo "<li>$module</li>";
}
?>
</ul>
</div>
</div>
<br>
</main>
<footer class="footer">
<p>&copy; code-mesa.com</p>
</footer>
</div> <!-- /container -->
</body>
</html>
<?php
$neededModules = array( 'session','xml','Core','pdo','openssl','mcrypt','standard','mbstring','filter' );
$neddedModulesInstallStatus = array();
$neededFunctions = array( 'session_start','utf8_encode','utf8_decode','trim','substr','count','array_unique','mkdir','header','strtotime','date','strlen','explode','end','file_exists','unlink','in_array','move_uploaded_file','rename','sha1','setcookie','time','function_exists','openssl_random_pseudo_bytes','bin2hex','mcrypt_create_iv','md5','uniqid','dirname','opendir','readdir','is_dir','closedir','rmdir','nl2br','defined','define','password_hash','trigger_error','is_null','is_int','is_string','gettype','sprintf','method_exists','preg_match','is_readable','fopen','fread','fclose','str_pad','chr','mt_rand','base64_encode','strtr','rtrim','crypt','password_get_info','sscanf','password_needs_rehash','password_verify','ord','mb_strlen','mb_substr','htmlentities','session_destroy','date_format','date_create','mail','filter_var','unserialize','file_get_contents' );
$neededFunctionsInstallStatus = array();
$neededConstants = array( 'MCRYPT_DEV_URANDOM','PASSWORD_BCRYPT','E_USER_WARNING','PASSWORD_BCRYPT_DEFAULT_COST','NULL','PASSWORD_DEFAULT','FILTER_VALIDATE_EMAIL' );
$neededConstantsInstallStatus = array();
$neededClasses = array( 'PDO' );
$neededClassesInstallStatus = array();
# needed modules
foreach($neededModules as $neededModule){
if(!extension_loaded($neededModule) && $neededModule != "Core"){
$neddedModulesInstallStatus[$neededModule] = false;
} else {
$neddedModulesInstallStatus[$neededModule] = true;
}
}
# needed functions
foreach($neededFunctions as $neededFunction){
if(!function_exists($neededFunction)){
$neededFunctionsInstallStatus[$neededFunction] = false;
} else {
$neededFunctionsInstallStatus[$neededFunction] = true;
}
}
# needed constants
foreach($neededConstants as $neededConstant){
if(!defined($neededConstant)){
$neededConstantsInstallStatus[$neededConstant] = false;
} else {
$neededConstantsInstallStatus[$neededConstant] = true;
}
}
# needed classes
foreach($neededClasses as $neededClass){
if(!class_exists($neededClass)){
$neededClassesInstallStatus[$neededClass] = false;
} else {
$neededClassesInstallStatus[$neededClass] = true;
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>a:php:autoanalyse</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link rel="stylesheet" href="http://getbootstrap.com/docs/4.0/examples/narrow-jumbotron/narrow-jumbotron.css">
</head>
<body>
<div class="container">
<div class="row marketing">
<div class="col-lg-12">
<img src="http://resources.code-mesa.com/a-php-analyse/logo_small.png" alt="logo" class="img-fluid" />
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h4>Results</h4>
</div>
</div>
<hr>
<main role="main">
<div class="row">
<div class="col-lg-12">
<?php
if(in_array(false, $neededClassesInstallStatus)){
echo "<b>&#10008; Not all needed Classes are defined.</b>";
} else {
echo "<b>&#10003; All needed Classes are defined.</b>";
}
?>
<br><br>
<table class="table">
<thead>
<tr>
<th style="width:10%;">&nbsp;</th>
<th style="width:70%;">Class</th>
<th style="width:20%;">Defined</th>
</tr>
</thead>
<tbody>
<?php
// List of Classes
foreach($neededClassesInstallStatus as $class => $classStatus){
if($classStatus){
$status = "yes";
$symbol = "&#10003;";
} else {
$status = "no";
$symbol = "&#10008;";
}
echo "<tr><td>$symbol</td><td>$class</td><td>$status</td></tr>";
}
?>
</tbody>
</table>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-12">
<?php
if(in_array(false, $neededConstantsInstallStatus)){
echo "<b><&#10008; Not all needed Constants are defined.</b>";
} else {
echo "<b>&#10003; All needed Constants are defined.</b>";
}
?>
<br><br>
<table class="table">
<thead>
<tr>
<th style="width:10%;">&nbsp;</th>
<th style="width:70%;">Constant</th>
<th style="width:20%;">Defined</th>
</tr>
</thead>
<tbody>
<?php
// List of Constants
foreach($neededConstantsInstallStatus as $constant => $constantStatus){
if($constantStatus){
$status = "yes";
$symbol = "&#10003;";
} else {
$status = "no";
$symbol = "&#10008;";
}
echo "<tr><td>$symbol</td><td>$constant</td><td>$status</td></tr>";
}
?>
</tbody>
</table>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-12">
<?php
if(in_array(false, $neededFunctionsInstallStatus)){
echo "<b>&#10008; Not all needed Functions are defined.</b>";
} else {
echo "<b>&#10003; All needed Functions are defined.</b>";
}
?>
<br><br>
<table class="table">
<thead>
<tr>
<th style="width:10%;">&nbsp;</th>
<th style="width:70%;">Function</th>
<th style="width:20%;">Defined</th>
</tr>
</thead>
<tbody>
<?php
// List of Functions
foreach($neededFunctionsInstallStatus as $function => $functionStatus){
if($functionStatus){
$status = "yes";
$symbol = "&#10003;";
} else {
$status = "no";
$symbol = "&#10008;";
}
echo "<tr><td>$symbol</td><td>$function</td><td>$status</td></tr>";
}
?>
</tbody>
</table>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-12">
<?php
if(in_array(false, $neddedModulesInstallStatus)){
echo "<b>&#10008; Not all needed Modules are installed</b>";
} else {
echo "<b>&#10003; All needed Modules are installed</b>";
}
?>
<br><br>
<table class="table">
<thead>
<tr>
<th style="width:10%;">&nbsp;</th>
<th style="width:70%;">Module</th>
<th style="width:20%;">Installed</th>
</tr>
</thead>
<tbody>
<?php
// List of Modules
foreach($neddedModulesInstallStatus as $module => $moduleStatus){
if($moduleStatus){
$status = "yes";
$symbol = "&#10003;";
} else {
$status = "no";
$symbol = "&#10008;";
}
echo "<tr><td>$symbol</td><td>$module</td><td>$status</td></tr>";
}
?>
</tbody>
</table>
</div>
</div>
<br>
</main>
<footer class="footer">
<p>&copy; code-mesa.com</p>
</footer>
</div> <!-- /container -->
</body>
</html>
No preview for this file type
......@@ -15,8 +15,8 @@ function checkGivenArguments(array $argv) : void {
$path = realpath($argv[1]);
if(!isset($path) && !isset($argv[2]))
exitWithErrorMessage("Not enough arguments! (php autoanalyse.php <PATH> <OUTPUT>)\n");
if(!isset($path) || !isset($argv[2]))
exitWithErrorMessage("Not enough arguments! ( aphpanalyse <PATH> <OUTPUT> )\n");
if(!is_dir($path))
exitWithErrorMessage("There is no directory found on path \"$path\"\n");
......@@ -40,7 +40,7 @@ function checkGivenArguments(array $argv) : void {
}
if(!isset($argv[2]))
exitWithErrorMessage("You have to give argument for output. ( php autoanalyse.php <PATH> <OUTPUT> [ --console-full | --testfile ] ).\n");
exitWithErrorMessage("You have to give argument for output. ( aphpanalyse <PATH> <OUTPUT> [ --console-full | --testfile ] ).\n");
$acceptedOutputArguments = array("--console-full", "--testfile");
if(!in_array($argv[2], $acceptedOutputArguments))
......
......@@ -22,11 +22,29 @@ or not.
- [Developer-Template](http://test.code-mesa.com/simpletest-dev.php)
- [Monitor-Template](http://test.code-mesa.com/simpletest-mon.php)
## Hot To install
download a copy of aphpanalyse.phar
# change to directory where aphpanalyse.phar is stored
cd /to/the/aphpanalyse.phar
# make it executable
chmod +x aphpanalyse.phar
# copy it to you binary directory
cp aphpanalyse.phar /usr/local/bin/aphpanalyse
## How To Use
change the directory in aphpanalyse directory and run the command:
php autoanalyse.php <PATH> <OPTIONS> [--testfile <TEMPLATE>]
aphpanalyse <PATH> <OPTIONS> [--testfile <TEMPLATE>]
if you don't copied it to your binary, change the directory in the directory
where aphpanalyse.phar is stored and run the command:
php aphpanalyse.phar <PATH> <OPTIONS> [--testfile <TEMPLATE>]
### Arguments
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment