1
0
Fork 0
mirror of https://github.com/Oreolek/kohana-migrations.git synced 2024-05-24 11:58:11 +03:00

fixing unproperly handled lack of description

This commit is contained in:
Michał Matyas 2011-06-26 11:20:56 +02:00
parent 8b38ab7025
commit b1fa2b7cb0
3 changed files with 21 additions and 6 deletions

View file

@ -61,9 +61,16 @@ class Minion_Migration_Util {
// path from the migrations folder to the migration file
$migration['group'] = dirname(substr($file, 11, -strlen(EXT)));
list($migration['timestamp'], $migration['description'])
= explode('_', basename($file, EXT), 2);
if(strpos(basename($file), "_"))
{
list($migration['timestamp'], $migration['description'])
= explode('_', basename($file, EXT), 2);
}
else
{
$migration['timestamp'] = basename($file, EXT);
$migration['description'] = "";
}
$migration['id'] = $migration['group'].':'.$migration['timestamp'];
return $migration;
@ -79,7 +86,15 @@ class Minion_Migration_Util {
public static function get_filename_from_migration(array $migration)
{
$group = $migration['group'];
$migration = $migration['timestamp'].'_'.$migration['description'];
if(!empty($migration['description']))
{
$migration = $migration['timestamp'].'_'.$migration['description'];
}
else
{
$migration = $migration['timestamp'];
}
$group = ( ! empty($group)) ? (rtrim($group, '/').'/') : '';

View file

@ -1,3 +1,3 @@
Minion encountered an error while executing migration `<?php echo $migration['id']; ?>` (<?php echo $migration['description'] ?>):
Minion encountered an error while executing migration `<?php echo $migration['id']; ?>` <?php echo (!empty($migration['description']) ? '('.$migration['description'].')' : '') ?>):
<?php echo $error; ?>

View file

@ -1,4 +1,4 @@
<?php foreach($groups as $group => $status): ?>
* <?php echo $group ?> <?php echo ($status !== NULL ? $status['timestamp'].' ('.$status['description'].')' : 'Not installed'); ?>
* <?php echo $group ?> <?php echo ($status !== NULL ? $status['timestamp'].' '.( !empty($status['description']) ? '('.$status['description'].')' : '' ) : 'Not installed'); ?>
<?php endforeach; ?>