예제 #1
0
$info = array('source_host' => $command->getSourceHost(), 'source_db' => $command->getSourceDB(), 'source_username' => $command->getSourceUsrName(), 'source_password' => $command->getSourcePWD(), 'source_port' => $command->getSourcePort(), 'target_host' => $command->getTargetHost(), 'target_db' => $command->getTargetDB(), 'target_username' => $command->getTargetUsrName(), 'target_password' => $command->getTargetPWD(), 'target_port' => $command->getTargetPort(), 'color' => $command->getColor(), 'report_level' => $command->getReportLevel(), 'sql_fix' => $command->getSQLFix());
// Load the help manual on the console
if ($command->getHelp()) {
    echo file_get_contents('../app/help.txt');
    functions::calMaxErrorLevel(_FILE_NOT_EXIST, TRUE, $command->getFailLevel());
}
// output the header on the screeen if verbosity was set
if ($command->getVerbose() == TRUE) {
    echo functions::parseOutoutHeader($info);
}
// Making sure all parameters have been defined
if ($command->getSourcePort() == '' || $command->getSourceDB() == '' || $command->getSourceUsrName() == '' || $command->getSourcePWD() == '' || $command->getTargetPort() == '' || $command->getTargetDB() == '' || $command->getTargetUsrName() == '' || $command->getTargetPWD() == '') {
    echo 'Please define all necessarily parameters or use the script with --help to see the details...' . PHP_EOL . PHP_EOL;
    functions::calMaxErrorLevel(_DEFINE_PARAM, TRUE, $command->getFailLevel());
}
// If specific test been defined in the command line here it will get loaded
$test = $command->getTests();
// if tests were not defined in the command line then read the tests from RuleConfig file
if ($test['test-flag'] === FALSE) {
    $test = App_Config_RulesConfig::getTestConfig($command->getTargetDB());
}
// Start running the schema checker
$chk = new App_Exphandler_General($info, $test);
$result = $chk->schemaChecker();
// If verbose requested print the report
if ($command->getVerbose()) {
    echo $result;
}
// exist status
functions::exitMe($command->getFailLevel());
예제 #2
0
 private function checkArgument($temp, $msg_source)
 {
     if (count($temp) == 1) {
         echo functions::getSysMsgSource($msg_source);
         functions::calMaxErrorLevel(_FATAL);
         functions::exitMe();
     } else {
         if (trim($temp[1]) == '') {
             echo functions::getSysMsgSource($msg_source, 'error');
             functions::calMaxErrorLevel(_FATAL);
             functions::exitMe();
         } else {
             switch ($msg_source) {
                 case 'test':
                     $this->setTests($temp[1]);
                     break;
                 case 'source-database':
                     $this->setSourceDB(trim($temp[1]));
                     break;
                 case 'source-host':
                     $this->setSourceHost(trim($temp[1]));
                     break;
                 case 'source-port':
                     $this->setSourcePORT(trim($temp[1]));
                     break;
                 case 'source-username':
                     $this->setSourceUsrName(trim($temp[1]));
                     break;
                 case 'source-password':
                     $this->setSourcePWD(trim($temp[1]));
                     break;
                 case 'target-database':
                     $this->setTargetDB(trim($temp[1]));
                     break;
                 case 'target-host':
                     $this->setTargetHost(trim($temp[1]));
                     break;
                 case 'target-port':
                     $this->setTargetPORT(trim($temp[1]));
                     break;
                 case 'target-username':
                     $this->setTargetUsrName(trim($temp[1]));
                     break;
                 case 'target-password':
                     $this->setTargetPWD(trim($temp[1]));
                     break;
                 case 'error-level':
                     $this->setReportLevel(trim($temp[1]));
                     break;
                 case 'fail-level':
                     $this->setFailLevel(trim($temp[1]));
                     break;
             }
         }
     }
 }