1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 
<?php
namespace Omeka\Installation\Task;

use Omeka\Installation\Installer;

/**
 * Task to initialize the migrations table with all existing migrations.
 */
class RecordMigrationsTask implements TaskInterface
{
    public function perform(Installer $installer)
    {
        $migrator = $installer->getServiceLocator()->get('Omeka\MigrationManager');
        $conn = $installer->getServiceLocator()->get('Omeka\Connection');

        $migrations = $migrator->getAvailableMigrations();

        $conn->beginTransaction();
        foreach ($migrations as $version => $data) {
            $migrator->recordMigration($version);
        }
        $conn->commit();
    }
}