|
|
@@ -31,6 +31,7 @@ declare(strict_types=1); |
|
|
|
namespace OCA\Provisioning_API\Controller; |
|
|
|
|
|
|
|
use OC_App; |
|
|
|
use OCP\API; |
|
|
|
use OCP\App\AppPathNotFoundException; |
|
|
|
use OCP\App\IAppManager; |
|
|
|
use OCP\AppFramework\Http\DataResponse; |
|
|
@@ -39,14 +40,9 @@ use OCP\AppFramework\OCSController; |
|
|
|
use OCP\IRequest; |
|
|
|
|
|
|
|
class AppsController extends OCSController { |
|
|
|
/** @var \OCP\App\IAppManager */ |
|
|
|
/** @var IAppManager */ |
|
|
|
private $appManager; |
|
|
|
|
|
|
|
/** |
|
|
|
* @param string $appName |
|
|
|
* @param IRequest $request |
|
|
|
* @param IAppManager $appManager |
|
|
|
*/ |
|
|
|
public function __construct( |
|
|
|
string $appName, |
|
|
|
IRequest $request, |
|
|
@@ -58,7 +54,7 @@ class AppsController extends OCSController { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param string $filter |
|
|
|
* @param string|null $filter |
|
|
|
* @return DataResponse |
|
|
|
* @throws OCSException |
|
|
|
*/ |
|
|
@@ -92,12 +88,12 @@ class AppsController extends OCSController { |
|
|
|
* @throws OCSException |
|
|
|
*/ |
|
|
|
public function getAppInfo(string $app): DataResponse { |
|
|
|
$info = \OCP\App::getAppInfo($app); |
|
|
|
$info = $this->appManager->getAppInfo($app); |
|
|
|
if (!is_null($info)) { |
|
|
|
return new DataResponse(OC_App::getAppInfo($app)); |
|
|
|
return new DataResponse($info); |
|
|
|
} |
|
|
|
|
|
|
|
throw new OCSException('The request app was not found', \OCP\API::RESPOND_NOT_FOUND); |
|
|
|
throw new OCSException('The request app was not found', API::RESPOND_NOT_FOUND); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -110,7 +106,7 @@ class AppsController extends OCSController { |
|
|
|
try { |
|
|
|
$this->appManager->enableApp($app); |
|
|
|
} catch (AppPathNotFoundException $e) { |
|
|
|
throw new OCSException('The request app was not found', \OCP\API::RESPOND_NOT_FOUND); |
|
|
|
throw new OCSException('The request app was not found', API::RESPOND_NOT_FOUND); |
|
|
|
} |
|
|
|
return new DataResponse(); |
|
|
|
} |