protected function _enumerateOldMigrations($type)
{
$mapping = array();
$path = APP . 'Config' . DS . 'Migration' . DS;
if ($type !== 'app') {
$path = CakePlugin::path(Inflector::camelize($type)) . 'Config' . DS . 'Migration' . DS;
}
if (!file_exists($path)) {
return $mapping;
}
$folder = new Folder($path);
foreach ($folder->find('.*?\\.php', true) as $file) {
$parts = explode('_', $file);
$version = array_shift($parts);
$className = implode('_', $parts);
if ($version > 0 && strlen($className) > 0) {
$contents = file_get_contents($path . $file);
if (preg_match("/class\\s([\\w]+)\\sextends/", $contents, $matches)) {
$mapping[(int) $version] = array(substr($file, 0, -4) => $matches[1]);
}
}
}
return $mapping;
}