mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-07-01 00:48:46 +02:00
[WORK IN PROGRESS] First draft of a Tools menu with direct install (#990)
* First draft of a Tools menu with direct install * Basic styling * Translate GPM messages * Basic frontend validation * Fix form action path * Added lang strings for offical_gpm_only toggle
This commit is contained in:
committed by
Andy Miller
parent
c473a8db84
commit
c7256134ba
@@ -2090,4 +2090,30 @@ class AdminController extends AdminBaseController
|
||||
|
||||
return $filename . '.md';
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle direct install.
|
||||
*
|
||||
*/
|
||||
protected function taskDirectInstall()
|
||||
{
|
||||
$file_path = '';
|
||||
|
||||
if (isset($_FILES['uploaded_file'])) {
|
||||
$file_path = $_FILES['uploaded_file']['tmp_name'];
|
||||
} else {
|
||||
$file_path = $this->data['file_path'];
|
||||
}
|
||||
|
||||
$result = Gpm::directInstall($file_path);
|
||||
|
||||
if ($result === true) {
|
||||
$this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.INSTALLATION_SUCCESSFUL'), 'info');
|
||||
} else {
|
||||
$this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.INSTALLATION_FAILED') . ': ' . $result, 'error');
|
||||
}
|
||||
|
||||
$this->setRedirect('/tools');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user