コード例 #1
0
 /**
  * This loads the file with the schema checks, not the schema definition per se
  *
  * @param string $fileName
  * @param string $fileFormat
  * @throws Exception
  */
 public function loadChecksFile($fileName, $fileFormat)
 {
     switch ($fileFormat) {
         case 'ezini':
             $parser = new ezdbiIniFormat();
             $this->checks = $parser->parseFile($fileName);
             break;
         default:
             throw new Exception("Schema file format {$fileFormat} not supported");
     }
 }
コード例 #2
0
        $cli->output("Class: {$class}, found " . count($classChecks->getForeignKeys()) . " keys");
        $checks->merge($classChecks);
    }
}
if ($options['extensions']) {
    $cli->output('Checking classes from extension autoloads...');
    $classes = (include 'var/autoload/ezp_extension.php');
    ksort($classes);
    foreach ($classes as $class => $file) {
        if (is_subclass_of($class, 'eZPersistentObject')) {
            $classChecks = $parser->parseFile($class);
            $cli->output("Class: {$class}, found " . count($classChecks->getForeignKeys()) . " keys");
            $checks->merge($classChecks);
        }
    }
}
if (!count($options['arguments'])) {
    $options['arguments'] = array('php://stdout');
}
switch ($options['schemaformat']) {
    case 'ezini':
    case '':
        $parser = new ezdbiIniFormat();
        $parser->writeFile($options['arguments'][0], $checks);
        break;
    default:
        $cli->error("Unsupported output format: {$options['schemaformat']}");
}
$cli->output('Done!');
$cli->output();
$script->shutdown();