Skip to content

Commit

Permalink
Display warning if zip extension is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
slawkens committed Nov 23, 2024
1 parent c0a6603 commit e3ffe5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion admin/pages/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@
warning('Plugin installation and management is disabled in Settings.<br/>If you wish to enable, go to Settings and enable <strong>Enable Plugins Manage</strong>.');
}
else {
$twig->display('admin.plugins.form.html.twig');
$pluginUploadEnabled = true;
if(!\class_exists('\ZipArchive')) {
error('Please install PHP zip extension. Plugins upload disabled until then.');
$pluginUploadEnabled = false;
}

$twig->display('admin.plugins.form.html.twig', ['pluginUploadEnabled' => $pluginUploadEnabled]);

if (isset($_POST['uninstall'])) {
$uninstall = $_POST['uninstall'];
Expand Down
2 changes: 1 addition & 1 deletion system/templates/admin.plugins.form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
</div>
<div class="card-footer">
<button type="submit" class="btn btn-info">Upload</button>
<button type="submit" class="btn btn-info" {% if not pluginUploadEnabled %}disabled{% endif %}>Upload</button>
</div>
</form>
</div>
Expand Down

0 comments on commit e3ffe5d

Please sign in to comment.