Ver código fonte

Add mirror list and details, fixes #574

Jordi Boggiano 7 anos atrás
pai
commit
e2bb21c130

+ 31 - 0
src/Packagist/WebBundle/Controller/MirrorsController.php

@@ -0,0 +1,31 @@
+<?php
+
+/*
+ * This file is part of Packagist.
+ *
+ * (c) Jordi Boggiano <j.boggiano@seld.be>
+ *     Nils Adermann <naderman@naderman.de>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Packagist\WebBundle\Controller;
+
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
+
+/**
+ * @author Jordi Boggiano <j.boggiano@seld.be>
+ */
+class MirrorsController extends Controller
+{
+    /**
+     * @Template()
+     * @Route("/mirrors", name="mirrors")
+     */
+    public function indexAction()
+    {
+        return array();
+    }
+}

+ 7 - 0
src/Packagist/WebBundle/Resources/translations/messages.en.yml

@@ -13,6 +13,7 @@ menu:
     contact: Contact
     stats: Statistics
     api_doc: API
+    mirrors: Mirrors
     browse: Browse
     submit: Submit
     togglenav: Toggle navigation
@@ -145,6 +146,12 @@ api_doc:
     get_by_name: Get a package by name
     get_package_data: Getting package data
 
+mirrors:
+    title: Mirrors of the Packagist.org Metadata
+    caution: 'Disclaimer: A word of caution'
+    mirror_list: Existing mirrors
+    running_your_own: Running your own mirror
+
 user:
     member_since: member since
     packages: "%username%'s packages"

+ 26 - 0
src/Packagist/WebBundle/Resources/views/Mirrors/index.html.twig

@@ -0,0 +1,26 @@
+{% extends "PackagistWebBundle::layout.html.twig" %}
+{% block content %}
+
+<h2 class="title">{{ 'mirrors.title'|trans }}</h2>
+
+<section class="col-d-12">
+<h3 id="list-packages">{{ 'mirrors.caution'|trans }}</h3>
+<p>Packagist.org tries to provide our own mirrors globally and to scale bandwidth availaibility as required to meet demand from the Composer user base. That said, we can not host in every country and given bandwidth/latency constraint in certain areas of the world it makes sense for people to use more local mirrors.</p>
+<p>These mirrors are unafiliated with us, community run and as such they might be considered an additional security risk as the metadata that Composer downloads tells it where to download code from.</p>
+
+<h3 id="list-packages">{{ 'mirrors.mirror_list'|trans }}</h3>
+<p>Packagist currently provides mirrors in Europe, North America (Montreal), and Asia (Singapore).</p>
+<p>On top of this, we are aware of the following list of third-party-run mirrors, please refer to their website to see how to use them:</p>
+<ul>
+  <li>Asia, China <a href="https://pkg.phpcomposer.com/">pkg.phpcomposer.com</a></li>
+  <li>Asia, Indonesia <a href="https://packagist.phpindonesia.id/">packagist.phpindonesia.id</a></li>
+  <li>Asia, Japan <a href="https://packagist.jp/">packagist.jp</a></li>
+  <li>South America, Brazil <a href="https://packagist.com.br/">packagist.com.br</a></li>
+</ul>
+
+<h3 id="list-packages-all">{{ 'mirrors.running_your_own'|trans }}</h3>
+<p>If you are interested in running your own mirror, we recommend using <a href="https://github.com/Webysther/packagist-mirror">Webysther's mirror code</a> to avoid duplicating efforts and then sending us a pull request to get your mirror added to the list above.</p>
+
+</section>
+
+{% endblock %}

+ 1 - 0
src/Packagist/WebBundle/Resources/views/layout.html.twig

@@ -192,6 +192,7 @@
 
                     <ul class="col-xs-3 col-md-2">
                         <li><a href="{{ path('api_doc') }}">{{ 'menu.api_doc'|trans }}</a></li>
+                        <li><a href="{{ path('mirrors') }}">{{ 'menu.mirrors'|trans }}</a></li>
                     </ul>
 
                 </div>