Skip to content

Commit

Permalink
Added full configuration for parallelism if mirror
Browse files Browse the repository at this point in the history
  • Loading branch information
webysther committed Sep 16, 2017
1 parent db5ef8b commit 6eca06b
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 5 deletions.
21 changes: 19 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
# Folder used to save the files
PUBLIC_DIR=public
MIRROR=https://packagist.org
URL=https://packagist.com.br

# Main mirror used to get providers
MAIN_MIRROR=packagist.org

# Mirror snapshot capable, download a file
# with all providers and repositories with
# some days outdated, if dont exists show a
# warning and fallback to full mode clone
SNAPSHOT_MIRROR=packagist.com.br

# Data mirror is the main and other mirrors
# used to download repositories data
DATA_MIRROR=packagist.jp,packagist.com.br,packagist.phpcomposer.com

# URI of your mirror
URL=packagist.com.br

# Max connections by mirror
MAX_CONNECTIONS=10
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
coverage
vendor
legacy
.env
File renamed without changes.
Empty file removed public/.gitkeep
Empty file.
9 changes: 6 additions & 3 deletions src/Command/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ protected function configure():void
* @param InputInterface $input Input console
* @param OutputInterface $output Output console
*
* @return void
* @return int 0 if pass, any another is error
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output):int
{
exit(1);
$input;
$output;

return 0;
}
}
60 changes: 60 additions & 0 deletions src/Command/Snapshot.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Packagist Mirror.
*
* For the full license information, please view the LICENSE.md
* file that was distributed with this source code.
*/

namespace League\Mirror\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Make a snapshot of all data to available to other mirror.
*
* @author Webysther Nunes <webysther@gmail.com>
*/
class Snapshot extends Command
{
/**
* Console description.
*
* @var string
*/
protected $description = <<<'TEXT'
Make snapshot of mirror.
<comment>Don't use this option if you plan for private mirror.</comment>

TEXT;

/**
* Console params configuration.
*/
protected function configure():void
{
$this->setName('snapshot')->setDescription($this->description);
}

/**
* Execution.
*
* @param InputInterface $input Input console
* @param OutputInterface $output Output console
*
* @return int 0 if pass, any another is error
*/
protected function execute(InputInterface $input, OutputInterface $output):int
{
$input;
$output;

return 0;
}
}
2 changes: 2 additions & 0 deletions src/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use SebastianBergmann\Version;
use Symfony\Component\Console\Application;
use League\Mirror\Command\Create;
use League\Mirror\Command\Snapshot;

/**
* Entrypoint for application.
Expand All @@ -32,5 +33,6 @@ public function __construct()

// Add all commands
$this->add(new Create());
$this->add(new Snapshot());
}
}

0 comments on commit 6eca06b

Please sign in to comment.