<commit_before><?php namespace Flarum\Console;

use Illuminate\Contracts\Container\Container;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;

class UpgradeCommand extends Command
{
    /**
     * @var Container
     */
    protected $container;

    public function __construct(Container $container)
    {
        $this->container = $container;

        parent::__construct();
    }

    protected function configure()
    {
        $this
            ->setName('upgrade')
            ->setDescription("Run Flarum's upgrade script");
    }

    /**
     * @inheritdoc
     */
    protected function fire()
    {
        $this->info('Upgrading Flarum...');

        $this->upgrade();

        $this->info('DONE.');
    }

    protected function upgrade()
    {
        $this->container->bind('Illuminate\Database\Schema\Builder', function($container) {
            return $container->make('Illuminate\Database\ConnectionInterface')->getSchemaBuilder();
        });

        $migrator = $this->container->make('Flarum\Migrations\Migrator');

        $migrator->run(base_path('core/migrations'));

        foreach ($migrator->getNotes() as $note) {
            $this->info($note);
        }
    }
}<commit_msg>Migrate extensions in upgrade script<commit_after><?php namespace Flarum\Console;

use Illuminate\Contracts\Container\Container;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;

class UpgradeCommand extends Command
{
    /**
     * @var Container
     */
    protected $container;

    public function __construct(Container $container)
    {
        $this->container = $container;

        parent::__construct();
    }

    protected function configure()
    {
        $this
            ->setName('upgrade')
            ->setDescription("Run Flarum's upgrade script");
    }

    /**
     * @inheritdoc
     */
    protected function fire()
    {
        $this->info('Upgrading Flarum...');

        $this->upgrade();

        $this->info('DONE.');
    }

    protected function upgrade()
    {
        $this->container->bind('Illuminate\Database\Schema\Builder', function($container) {
            return $container->make('Illuminate\Database\ConnectionInterface')->getSchemaBuilder();
        });

        $migrator = $this->container->make('Flarum\Migrations\Migrator');

        $migrator->run(base_path('core/migrations'));

        foreach ($migrator->getNotes() as $note) {
            $this->info($note);
        }

        $extensions = $this->container->make('Flarum\Support\ExtensionManager');

        $migrator = $extensions->getMigrator();

        foreach ($extensions->getInfo() as $extension) {
            $this->info('Upgrading extension: '.$extension->name);

            $extensions->enable($extension->name);

            foreach ($migrator->getNotes() as $note) {
                $this->info($note);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.14384639597104187, 'fraction_numerical': 0.0, 'mean_word_length': 2.6195899772209565, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4097973', 'n_tokens_mistral': 884, 'n_tokens_neox': 864, 'n_words': 141}