mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-12-05 15:29:58 +01:00
restore tool - mostly working
This commit is contained in:
10
admin.php
10
admin.php
@@ -393,11 +393,19 @@ class AdminPlugin extends Plugin
|
|||||||
$manifestFiles = $manager->hasSnapshots() ? [true] : [];
|
$manifestFiles = $manager->hasSnapshots() ? [true] : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tools = $event['tools'];
|
||||||
|
Grav::instance()['log']->debug('[Admin] Tools before restore grav: ' . implode(',', array_keys($tools)));
|
||||||
|
|
||||||
if ($manifestFiles) {
|
if ($manifestFiles) {
|
||||||
$event['tools']['restore-grav'] = [['admin.super'], 'PLUGIN_ADMIN.RESTORE_GRAV'];
|
$tools['restore-grav'] = [['admin.super'], 'PLUGIN_ADMIN.RESTORE_GRAV'];
|
||||||
|
Grav::instance()['log']->debug('[Admin] Restore Grav tool enabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$event['tools'] = $tools;
|
||||||
|
Grav::instance()['log']->debug('[Admin] Tools after register: ' . implode(',', array_keys($tools)));
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
// ignore availability errors, snapshots tool will simply stay hidden
|
// ignore availability errors, snapshots tool will simply stay hidden
|
||||||
|
Grav::instance()['log']->warning('[Admin] Restore Grav detection failed: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
{% do assets.addInlineCss(' \
|
||||||
|
.restore-grav-content {\n padding-bottom: 2rem;\n}\n\n.restore-grav-intro {\n margin-left: 1.5rem;\n margin-bottom: 1.5rem;\n}\n\n.restore-grav-table {\n margin-bottom: 1.5rem;\n}\n\n.restore-grav-table code {\n white-space: nowrap;\n}\n\n.restore-grav-content .button-bar {\n margin-bottom: 1rem;\n}\n') %}
|
||||||
|
|
||||||
<h1>{{ "PLUGIN_ADMIN.RESTORE_GRAV"|t }}</h1>
|
<h1>{{ "PLUGIN_ADMIN.RESTORE_GRAV"|t }}</h1>
|
||||||
|
|
||||||
<div class="restore-grav-content">
|
<div class="restore-grav-content">
|
||||||
@@ -20,7 +23,6 @@
|
|||||||
<th>{{ "PLUGIN_ADMIN.RESTORE_GRAV_TABLE_SNAPSHOT"|t }}</th>
|
<th>{{ "PLUGIN_ADMIN.RESTORE_GRAV_TABLE_SNAPSHOT"|t }}</th>
|
||||||
<th>{{ "PLUGIN_ADMIN.RESTORE_GRAV_TABLE_VERSION"|t }}</th>
|
<th>{{ "PLUGIN_ADMIN.RESTORE_GRAV_TABLE_VERSION"|t }}</th>
|
||||||
<th>{{ "PLUGIN_ADMIN.RESTORE_GRAV_TABLE_CREATED"|t }}</th>
|
<th>{{ "PLUGIN_ADMIN.RESTORE_GRAV_TABLE_CREATED"|t }}</th>
|
||||||
<th>{{ "PLUGIN_ADMIN.RESTORE_GRAV_TABLE_LOCATION"|t }}</th>
|
|
||||||
<th class="actions-cell">{{ "PLUGIN_ADMIN.RESTORE_GRAV_TABLE_ACTIONS"|t }}</th>
|
<th class="actions-cell">{{ "PLUGIN_ADMIN.RESTORE_GRAV_TABLE_ACTIONS"|t }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -41,13 +43,6 @@
|
|||||||
{{ "PLUGIN_ADMIN.UNKNOWN"|t }}
|
{{ "PLUGIN_ADMIN.UNKNOWN"|t }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
|
||||||
{% if snapshot.backup_path %}
|
|
||||||
<code class="snapshot-path">{{ snapshot.backup_path }}</code>
|
|
||||||
{% else %}
|
|
||||||
{{ "PLUGIN_ADMIN.UNKNOWN"|t }}
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
<td class="actions-cell">
|
<td class="actions-cell">
|
||||||
<form action="{{ admin_route('/tools/restore-grav') }}" method="post" class="inline-form">
|
<form action="{{ admin_route('/tools/restore-grav') }}" method="post" class="inline-form">
|
||||||
<input type="hidden" name="task" value="safeUpgradeRestore">
|
<input type="hidden" name="task" value="safeUpgradeRestore">
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{{ dump(tools) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|||||||
Reference in New Issue
Block a user