function upgradeRegistry($args, $options) { if (!file_exists($args['path']) || !is_dir($args['path'])) { echo "Cannot upgrade registries at ", $args['path'], ", path does not exist or is not a directory\n"; exit(1); } echo "Upgrading registry at path ", $args['path'], "\n"; $registries = \PEAR2\Pyrus\Registry::detectRegistries($args['path']); if (!count($registries)) { echo "No registries found\n"; exit; } if (!in_array('Pear1', $registries)) { echo "Registry already upgraded\n"; exit; } $pear1 = new \PEAR2\Pyrus\Registry\Pear1($args['path']); if (!in_array('Sqlite3', $registries)) { $sqlite3 = new \PEAR2\Pyrus\Registry\Sqlite3($args['path']); $sqlite3->cloneRegistry($pear1); } if (!in_array('Xml', $registries)) { $xml = new \PEAR2\Pyrus\Registry\Xml($args['path']); $sqlite3 = new \PEAR2\Pyrus\Registry\Sqlite3($args['path']); $xml->cloneRegistry($sqlite3); } if ($options['removeold']) { \PEAR2\Pyrus\Registry\Pear1::removeRegistry($args['path']); } }