public function writeCurrentSchema($filename)
{
$this->cacheSources = false;
$file = basename($filename);
$path = dirname($filename);
$name = basename(Inflector::classify(basename($file)), '.php');
$Schema = ClassRegistry::init('CakeSchema');
$Schema->connection = $this->configKeyName;
if (empty($path)) {
$path = $Schema->path;
}
$tables = $this->listSources();
$models = array();
$tableList = getTableList();
foreach ($tables as $table) {
if (in_array($table, $tableList['core']) || in_array($table, $tableList['plugin'])) {
$models[] = Inflector::classify(Inflector::singularize(str_replace($this->config['prefix'], '', $table)));
}
}
return $this->writeSchema(array('name' => $name, 'model' => $models, 'path' => $path, 'file' => $file));
}