{% extends '@Installation/layout.twig' %}

{% block content %}

{% set helpMessage %}{{- 'CoreUpdater_HelpMessageContent'|translate('[',']',"<br/>")|raw }}{% endset %}

<h2>{{ 'Installation_ReusingTables'|translate }}</h2>

<div class="reuseTables">

{% if coreError %}
    <div class="error">
        <img src="plugins/Zeitgeist/images/error_medium.png"/> {{ 'CoreUpdater_CriticalErrorDuringTheUpgradeProcess'|translate }}
        <ul>
            {% for message in errorMessages %}
                <li>{{ message }}</li>
            {% endfor %}
        </ul>
    </div>
    <p>{{ 'CoreUpdater_HelpMessageIntroductionWhenError'|translate }}
    <ul>
        <li>{{ helpMessage }}</li>
    </ul>
    </p>
    <p>{{ 'CoreUpdater_ErrorDIYHelp'|translate }}
    <ul>
        <li>{{ 'CoreUpdater_ErrorDIYHelp_1'|translate }}</li>
        <li>{{ 'CoreUpdater_ErrorDIYHelp_2'|translate }}</li>
        <li>{{ 'CoreUpdater_ErrorDIYHelp_3'|translate }} <a href='https://piwik.org/faq/how-to-update/#faq_179' target='_blank'>(see FAQ)</a></li>
        <li>{{ 'CoreUpdater_ErrorDIYHelp_4'|translate }}</li>
        <li>{{ 'CoreUpdater_ErrorDIYHelp_5'|translate }}</li>
    </ul>
    </p>
{% else %}
    {% if warningMessages|length > 0 %}
        <div class="warning">
            <img src="plugins/Zeitgeist/images/warning_medium.png"/> {{ 'CoreUpdater_WarningMessages'|translate }}
            <ul>
                {% for message in warningMessages %}
                    <li>{{ message }}</li>
                {% endfor %}
            </ul>
        </div>
    {% endif %}

    {% if errorMessages|length > 0 %}
        <div class="error">
            <img src="plugins/Zeitgeist/images/error_medium.png"/> {{ 'CoreUpdater_ErrorDuringPluginsUpdates'|translate }}
            <ul>
                {% for message in errorMessages %}
                    <li>{{ message }}</li>
                {% endfor %}
            </ul>

            {% if deactivatedPlugins is defined and deactivatedPlugins|length > 0 %}
                {% set listOfDeactivatedPlugins=deactivatedPlugins|join(', ') %}
                <p style="color:red;">
                    <img src="plugins/Zeitgeist/images/error_medium.png"/>
                    {{ 'CoreUpdater_WeAutomaticallyDeactivatedTheFollowingPlugins'|translate(listOfDeactivatedPlugins) }}
                </p>
            {% endif %}
        </div>
    {% endif %}

    {% if errorMessages|length > 0 or warningMessages|length > 0 %}
        <p>{{ 'CoreUpdater_HelpMessageIntroductionWhenWarning'|translate }}
        <ul>
            <li>{{ helpMessage }}</li>
        </ul>
        </p>
    {% else %}
        <div class="success"> {{ 'Installation_TablesUpdatedSuccess'|translate(oldVersion, currentVersion) }}
            <img src="plugins/Zeitgeist/images/success_medium.png"/></div>
        <br />

    {% endif %}

{% endif %}

</div>
{% endblock %}