You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nextcloud-server/apps/testing/lib/Controller/RoutesController.php

42 lines
963 B

<?php
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Testing\Controller;
use OCP\App\AppPathNotFoundException;
use OCP\App\IAppManager;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\IRequest;
class RoutesController extends OCSController {
public function __construct(
string $appName,
IRequest $request,
private IAppManager $appManager,
) {
parent::__construct($appName, $request);
}
public function getRoutesInRoutesPhp(string $app): DataResponse {
try {
$appPath = $this->appManager->getAppPath($app);
} catch (AppPathNotFoundException) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
}
$file = $appPath . '/appinfo/routes.php';
if (!file_exists($file)) {
return new DataResponse();
}
$routes = include $file;
return new DataResponse($routes);
}
}