From 9b89baca14d9fb1319cef1f50ef6464da39d0fcc Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 26 Aug 2019 10:20:55 +0200 Subject: [PATCH 1/2] Cron should run every 5 mins So also 10 mins is now an error, so admins check their set up crons Signed-off-by: Joas Schilling --- settings/templates/settings/admin/server.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/settings/templates/settings/admin/server.php b/settings/templates/settings/admin/server.php index 3536c05e99..92bf433ca6 100644 --- a/settings/templates/settings/admin/server.php +++ b/settings/templates/settings/admin/server.php @@ -34,7 +34,7 @@ $formatter = \OC::$server->getDateTimeFormatter(); $absolute_time = $formatter->formatDateTime($_['lastcron'], 'long', 'long'); - if (time() - $_['lastcron'] <= 3600): ?> + if (time() - $_['lastcron'] <= 600): ?> t("Last job ran %s.", [$relative_time]));?> @@ -72,7 +72,7 @@ print_unescaped('checked="checked"'); } ?>>
- t("cron.php is registered at a webcron service to call cron.php every 15 minutes over HTTP.")); ?> + t("cron.php is registered at a webcron service to call cron.php every 5 minutes over HTTP.")); ?>

>
- t("Use system cron service to call the cron.php file every 15 minutes.")); ?> + t("Use system cron service to call the cron.php file every 5 minutes.")); ?> t('The cron.php needs to be executed by the system user "%s".', [$_['cli_based_cron_user']])); } else { From db968cb1d415f1998be6df73b365ae5ca04686ad Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 26 Aug 2019 10:21:26 +0200 Subject: [PATCH 2/2] Cleanup the Settings class Signed-off-by: Joas Schilling --- settings/Settings/Admin/Server.php | 35 +++---------------------- tests/lib/Settings/Admin/ServerTest.php | 25 ++---------------- 2 files changed, 5 insertions(+), 55 deletions(-) diff --git a/settings/Settings/Admin/Server.php b/settings/Settings/Admin/Server.php index 1ebea8a4dc..bceca06812 100644 --- a/settings/Settings/Admin/Server.php +++ b/settings/Settings/Admin/Server.php @@ -26,48 +26,19 @@ namespace OC\Settings\Admin; -use Doctrine\DBAL\Connection; -use Doctrine\DBAL\DBALException; -use Doctrine\DBAL\Platforms\SqlitePlatform; -use OC\Lock\DBLockingProvider; -use OC\Lock\NoopLockingProvider; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; -use OCP\IDBConnection; -use OCP\IL10N; -use OCP\IRequest; -use OCP\Lock\ILockingProvider; use OCP\Settings\ISettings; class Server implements ISettings { - /** @var IDBConnection|Connection */ - private $db; - /** @var IRequest */ - private $request; /** @var IConfig */ private $config; - /** @var ILockingProvider */ - private $lockingProvider; - /** @var IL10N */ - private $l; /** - * @param IDBConnection $db - * @param IRequest $request * @param IConfig $config - * @param ILockingProvider $lockingProvider - * @param IL10N $l */ - public function __construct(IDBConnection $db, - IRequest $request, - IConfig $config, - ILockingProvider $lockingProvider, - IL10N $l) { - $this->db = $db; - $this->request = $request; + public function __construct(IConfig $config) { $this->config = $config; - $this->lockingProvider = $lockingProvider; - $this->l = $l; } /** @@ -89,7 +60,7 @@ class Server implements ISettings { /** * @return string the section ID, e.g. 'sharing' */ - public function getSection() { + public function getSection(): string { return 'server'; } @@ -100,7 +71,7 @@ class Server implements ISettings { * * E.g.: 70 */ - public function getPriority() { + public function getPriority(): int { return 0; } } diff --git a/tests/lib/Settings/Admin/ServerTest.php b/tests/lib/Settings/Admin/ServerTest.php index a121abc3df..adf8ef4f36 100644 --- a/tests/lib/Settings/Admin/ServerTest.php +++ b/tests/lib/Settings/Admin/ServerTest.php @@ -23,44 +23,23 @@ namespace Test\Settings\Admin; -use Doctrine\DBAL\Platforms\SqlitePlatform; use OC\Settings\Admin\Server; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; -use OCP\IDBConnection; -use OCP\IL10N; -use OCP\IRequest; -use OCP\Lock\ILockingProvider; use Test\TestCase; class ServerTest extends TestCase { /** @var Server */ private $admin; - /** @var IDBConnection */ - private $dbConnection; - /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */ - private $request; /** @var IConfig */ private $config; - /** @var ILockingProvider */ - private $lockingProvider; - /** @var IL10N */ - private $l10n; public function setUp() { parent::setUp(); - $this->config = $this->getMockBuilder(IConfig::class)->getMock(); - $this->request = $this->createMock(IRequest::class); - $this->dbConnection = $this->getMockBuilder('\OCP\IDBConnection')->getMock(); - $this->lockingProvider = $this->getMockBuilder('\OCP\Lock\ILockingProvider')->getMock(); - $this->l10n = $this->getMockBuilder(IL10N::class)->getMock(); + $this->config = $this->createMock(IConfig::class); $this->admin = new Server( - $this->dbConnection, - $this->request, - $this->config, - $this->lockingProvider, - $this->l10n + $this->config ); }