Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 3 additions & 32 deletions settings/Settings/Admin/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -89,7 +60,7 @@ public function getForm() {
/**
* @return string the section ID, e.g. 'sharing'
*/
public function getSection() {
public function getSection(): string {
return 'server';
}

Expand All @@ -100,7 +71,7 @@ public function getSection() {
*
* E.g.: 70
*/
public function getPriority() {
public function getPriority(): int {
return 0;
}
}
6 changes: 3 additions & 3 deletions settings/templates/settings/admin/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

$formatter = \OC::$server->getDateTimeFormatter();
$absolute_time = $formatter->formatDateTime($_['lastcron'], 'long', 'long');
if (time() - $_['lastcron'] <= 3600): ?>
if (time() - $_['lastcron'] <= 600): ?>
<span class="status success"></span>
<span class="crondate" title="<?php p($absolute_time);?>">
<?php p($l->t("Last job ran %s.", [$relative_time]));?>
Expand Down Expand Up @@ -72,7 +72,7 @@
print_unescaped('checked="checked"');
} ?>>
<label for="backgroundjobs_webcron">Webcron</label><br/>
<em><?php p($l->t("cron.php is registered at a webcron service to call cron.php every 15 minutes over HTTP.")); ?></em>
<em><?php p($l->t("cron.php is registered at a webcron service to call cron.php every 5 minutes over HTTP.")); ?></em>
</p>
<p>
<input type="radio" name="mode" value="cron" class="radio"
Expand All @@ -83,7 +83,7 @@
print_unescaped('disabled');
}?>>
<label for="backgroundjobs_cron">Cron</label><br/>
<em><?php p($l->t("Use system cron service to call the cron.php file every 15 minutes.")); ?>
<em><?php p($l->t("Use system cron service to call the cron.php file every 5 minutes.")); ?>
<?php if($_['cli_based_cron_possible']) {
p($l->t('The cron.php needs to be executed by the system user "%s".', [$_['cli_based_cron_user']]));
} else {
Expand Down
25 changes: 2 additions & 23 deletions tests/lib/Settings/Admin/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

Expand Down