-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(update): put /update handler back in case of problems + phpactor…
… lsp support
- Loading branch information
Florian Schmitt
committed
Oct 10, 2024
1 parent
18258ba
commit f75f60c
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"$schema": "/phpactor.schema.json", | ||
"language_server_php_cs_fixer.enabled": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
use YesWiki\Core\YesWikiHandler; | ||
use YesWiki\Security\Controller\SecurityController; | ||
|
||
class UpdateHandler extends YesWikiHandler | ||
{ | ||
public function run(): string | ||
{ | ||
if ($this->getService(SecurityController::class)->isWikiHibernated()) { | ||
throw new \Exception(_t('WIKI_IN_HIBERNATION')); | ||
} | ||
|
||
$output = ''; | ||
|
||
if ($this->wiki->UserIsAdmin()) { | ||
$res = []; | ||
exec('./yeswicli migrate', $res); | ||
$output .= implode('<br>', $res); | ||
} else { | ||
$output .= '<div class="alert alert-danger">' . _t('ACLS_RESERVED_FOR_ADMINS') . '</div>'; | ||
} | ||
|
||
return $this->renderInSquelette('@core/handlers/update.twig', [ | ||
'output' => $output, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{output|raw}} |