mirror of
https://github.com/nextcloud/server.git
synced 2026-02-18 18:28:50 -05:00
fix: Deprecate action and actionInclude from routes and fix actionInclude
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
5c9092bc5b
commit
216da3a81c
3 changed files with 9 additions and 9 deletions
|
|
@ -124,15 +124,9 @@ class Route extends SymfonyRoute implements IRoute {
|
|||
* The action to execute when this route matches, includes a file like
|
||||
* it is called directly
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
public function actionInclude($file) {
|
||||
$function = function ($param) use ($file) {
|
||||
unset($param['_route']);
|
||||
$_GET = array_merge($_GET, $param);
|
||||
unset($param);
|
||||
require_once "$file";
|
||||
} ;
|
||||
$this->action($function);
|
||||
$this->setDefault('file', $file);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -322,6 +322,10 @@ class Router implements IRouter {
|
|||
call_user_func($action, $parameters);
|
||||
$this->eventLogger->end('route:run:call');
|
||||
} elseif (isset($parameters['file'])) {
|
||||
$param = $parameters;
|
||||
unset($param['_route']);
|
||||
$_GET = array_merge($_GET, $param);
|
||||
unset($param);
|
||||
include $parameters['file'];
|
||||
} else {
|
||||
throw new \Exception('no action available');
|
||||
|
|
|
|||
|
|
@ -34,8 +34,9 @@ interface IRoute {
|
|||
* it is called directly
|
||||
*
|
||||
* @param string $file
|
||||
* @return void
|
||||
* @return $this
|
||||
* @since 7.0.0
|
||||
* @deprecated 32.0.0 Use a proper controller instead
|
||||
*/
|
||||
public function actionInclude($file);
|
||||
|
||||
|
|
@ -70,6 +71,7 @@ interface IRoute {
|
|||
* This function is called with $class set to a callable or
|
||||
* to the class with $function
|
||||
* @since 7.0.0
|
||||
* @deprecated 32.0.0 Use a proper controller instead
|
||||
*/
|
||||
public function action($class, $function = null);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue