Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-05-17 01:52:16 +0300
committerCarl Schwan <carl@carlschwan.eu>2022-05-20 16:00:54 +0300
commite8e0f97c9a934ba9da4f4f4c092a5f8683500164 (patch)
treeb90dbe6efcb02a5c590cacc2bdd67a786ecf6e36 /apps/settings/lib
parent87ce03db1ac8f1d7313850128528e5b8f06fce66 (diff)
Port BackgroundJob admin settings to vue
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/settings/lib')
-rw-r--r--apps/settings/lib/Settings/Admin/Server.php45
1 files changed, 22 insertions, 23 deletions
diff --git a/apps/settings/lib/Settings/Admin/Server.php b/apps/settings/lib/Settings/Admin/Server.php
index 0fe98f21c8f..0d8ef00a1fd 100644
--- a/apps/settings/lib/Settings/Admin/Server.php
+++ b/apps/settings/lib/Settings/Admin/Server.php
@@ -33,28 +33,25 @@ use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IL10N;
+use OCP\IURLGenerator;
use OCP\Settings\IDelegatedSettings;
class Server implements IDelegatedSettings {
use TProfileHelper;
- /** @var IDBConnection */
- private $connection;
- /** @var IInitialState */
- private $initialStateService;
- /** @var ProfileManager */
- private $profileManager;
- /** @var ITimeFactory */
- private $timeFactory;
- /** @var IConfig */
- private $config;
- /** @var IL10N $l */
- private $l;
+ private IDBConnection $connection;
+ private IInitialState $initialStateService;
+ private ProfileManager $profileManager;
+ private ITimeFactory $timeFactory;
+ private IConfig $config;
+ private IL10N $l;
+ private IURLGenerator $urlGenerator;
public function __construct(IDBConnection $connection,
IInitialState $initialStateService,
ProfileManager $profileManager,
ITimeFactory $timeFactory,
+ IURLGenerator $urlGenerator,
IConfig $config,
IL10N $l) {
$this->connection = $connection;
@@ -63,27 +60,29 @@ class Server implements IDelegatedSettings {
$this->timeFactory = $timeFactory;
$this->config = $config;
$this->l = $l;
+ $this->urlGenerator = $urlGenerator;
}
/**
* @return TemplateResponse
*/
public function getForm() {
- $parameters = [
- // Background jobs
- 'backgroundjobs_mode' => $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax'),
- 'lastcron' => $this->config->getAppValue('core', 'lastcron', false),
- 'cronMaxAge' => $this->cronMaxAge(),
- 'cronErrors' => $this->config->getAppValue('core', 'cronErrors'),
- 'cli_based_cron_possible' => function_exists('posix_getpwuid'),
- 'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '',
- 'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(),
- ];
+ // Background jobs
+ $this->initialStateService->provideInitialState('backgroundJobsMode', $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax'));
+ $this->initialStateService->provideInitialState('lastCron', (int)$this->config->getAppValue('core', 'lastcron', '0'));
+ $this->initialStateService->provideInitialState('cronMaxAge', $this->cronMaxAge());
+ $this->initialStateService->provideInitialState('cronErrors', $this->config->getAppValue('core', 'cronErrors'));
+ $this->initialStateService->provideInitialState('cliBasedCronPossible', function_exists('posix_getpwuid'));
+ $this->initialStateService->provideInitialState('cliBasedCronUser', function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '');
+ $this->initialStateService->provideInitialState('backgroundJobsDocUrl', $this->urlGenerator->linkToDocs('admin-background-jobs'));
+ // Profile page
$this->initialStateService->provideInitialState('profileEnabledGlobally', $this->profileManager->isProfileEnabled());
$this->initialStateService->provideInitialState('profileEnabledByDefault', $this->isProfileEnabledByDefault($this->config));
- return new TemplateResponse('settings', 'settings/admin/server', $parameters, '');
+ return new TemplateResponse('settings', 'settings/admin/server', [
+ 'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(),
+ ], '');
}
protected function cronMaxAge(): int {