From e70f67cea9666047d168e7c6f1326f3b7c96c8b0 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Sat, 20 Apr 2019 13:04:35 -0100 Subject: small fixes Signed-off-by: Maxence Lange --- lib/Command/CheckInstall.php | 88 +++++++++++++++++++++++++++++++++ lib/Controller/NavigationController.php | 12 ++--- lib/Db/FollowsRequest.php | 3 ++ lib/Service/ConfigService.php | 9 +++- 4 files changed, 105 insertions(+), 7 deletions(-) create mode 100644 lib/Command/CheckInstall.php (limited to 'lib') diff --git a/lib/Command/CheckInstall.php b/lib/Command/CheckInstall.php new file mode 100644 index 00000000..fcd06aa0 --- /dev/null +++ b/lib/Command/CheckInstall.php @@ -0,0 +1,88 @@ + + * @copyright 2018, Maxence Lange + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + + +namespace OCA\Social\Command; + + +use Exception; +use OC\Core\Command\Base; +use OCA\Social\Service\CheckService; +use OCA\Social\Service\MiscService; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + + +class CheckInstall extends Base { + + + /** @var CheckService */ + private $checkService; + + /** @var MiscService */ + private $miscService; + + + /** + * CacheUpdate constructor. + * + * @param CheckService $checkService + * @param MiscService $miscService + */ + public function __construct(CheckService $checkService, MiscService $miscService) { + parent::__construct(); + + $this->checkService = $checkService; + $this->miscService = $miscService; + } + + + /** + * + */ + protected function configure() { + parent::configure(); + $this->setName('social:check:install') + ->setDescription('Check the integrity of the installation'); + } + + + /** + * @param InputInterface $input + * @param OutputInterface $output + * + * @throws Exception + */ + protected function execute(InputInterface $input, OutputInterface $output) { + $this->checkService->checkInstallationStatus(); + } + + +} + diff --git a/lib/Controller/NavigationController.php b/lib/Controller/NavigationController.php index fd2ae48c..2621c7c0 100644 --- a/lib/Controller/NavigationController.php +++ b/lib/Controller/NavigationController.php @@ -189,15 +189,15 @@ class NavigationController extends Controller { } private function setupCloudAddress(): string { - $frontControllerActive = - ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true - || getenv('front_controller_active') === 'true'); +// $frontControllerActive = +// ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true +// || getenv('front_controller_active') === 'true'); $cloudAddress = rtrim($this->config->getSystemValue('overwrite.cli.url', ''), '/'); if ($cloudAddress !== '') { - if (!$frontControllerActive) { - $cloudAddress .= '/index.php'; - } +// if (!$frontControllerActive) { +// $cloudAddress .= '/index.php'; +// } $this->configService->setCloudAddress($cloudAddress); return $cloudAddress; diff --git a/lib/Db/FollowsRequest.php b/lib/Db/FollowsRequest.php index 6c9855a9..ec8a7582 100644 --- a/lib/Db/FollowsRequest.php +++ b/lib/Db/FollowsRequest.php @@ -33,6 +33,7 @@ namespace OCA\Social\Db; use daita\MySmallPhpTools\Traits\TArrayTools; use DateTime; +use Exception; use OCA\Social\Exceptions\FollowDoesNotExistException; use OCA\Social\Model\ActivityPub\Object\Follow; use OCP\DB\QueryBuilder\IQueryBuilder; @@ -53,6 +54,8 @@ class FollowsRequest extends FollowsRequestBuilder { * Insert a new Note in the database. * * @param Follow $follow + * + * @throws Exception */ public function save(Follow $follow) { $qb = $this->getFollowsInsertSql(); diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index 4236b9de..cdfee8e3 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -262,6 +262,12 @@ class ConfigService { throw new SocialAppConfigException(); } + // fixing address for alpha2 + if (substr($address, -10) === '/index.php') { + $address = substr($address, 0, -10); + $this->setCloudAddress($address); + } + if ($host === true) { $parsed = parse_url($address); $result = $this->get('host', $parsed, ''); @@ -288,7 +294,8 @@ class ConfigService { $path = $this->urlGenerator->linkToRoute('social.Navigation.navigate'); } - return 'https://' . $this->getCloudAddress(true) . $path; + return $this->getCloudAddress() . $path; +// return 'https://' . $this->getCloudAddress(true) . $path; } -- cgit v1.2.3