* Class ProxyMapper
*
* @package OCA\DAV\CalDAV\Proxy
+ *
+ * @template-extends QBMapper<Proxy>
*/
class ProxyMapper extends QBMapper {
public const PERMISSION_READ = 1;
use OCP\DB\Exception;
use OCP\IDBConnection;
+/**
+ * @template-extends QBMapper<OpenLocalEditor>
+ */
class OpenLocalEditorMapper extends QBMapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'open_local_editor', OpenLocalEditor::class);
use OCP\AppFramework\Db\QBMapper;
use OCP\IDBConnection;
+/**
+ * @template-extends QBMapper<TransferOwnership>
+ */
class TransferOwnershipMapper extends QBMapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'user_transfer_owner', TransferOwnership::class);
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IDBConnection;
+/**
+ * @template-extends QBMapper<LoginFlowV2>
+ */
class LoginFlowV2Mapper extends QBMapper {
private const lifetime = 1200;
use OCP\AppFramework\Db\QBMapper;
use OCP\IDBConnection;
+/**
+ * @template-extends QBMapper<ProfileConfig>
+ */
class ProfileConfigMapper extends QBMapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'profile_config', ProfileConfig::class);
'OC\\Translation\\TranslationManager' => $baseDir . '/lib/private/Translation/TranslationManager.php',
'OC\\URLGenerator' => $baseDir . '/lib/private/URLGenerator.php',
'OC\\Updater' => $baseDir . '/lib/private/Updater.php',
+ 'OC\\Updater\\Changes' => $baseDir . '/lib/private/Updater/Changes.php',
'OC\\Updater\\ChangesCheck' => $baseDir . '/lib/private/Updater/ChangesCheck.php',
'OC\\Updater\\ChangesMapper' => $baseDir . '/lib/private/Updater/ChangesMapper.php',
- 'OC\\Updater\\ChangesResult' => $baseDir . '/lib/private/Updater/ChangesResult.php',
'OC\\Updater\\VersionCheck' => $baseDir . '/lib/private/Updater/VersionCheck.php',
'OC\\UserStatus\\ISettableProvider' => $baseDir . '/lib/private/UserStatus/ISettableProvider.php',
'OC\\UserStatus\\Manager' => $baseDir . '/lib/private/UserStatus/Manager.php',
'OC\\Translation\\TranslationManager' => __DIR__ . '/../../..' . '/lib/private/Translation/TranslationManager.php',
'OC\\URLGenerator' => __DIR__ . '/../../..' . '/lib/private/URLGenerator.php',
'OC\\Updater' => __DIR__ . '/../../..' . '/lib/private/Updater.php',
+ 'OC\\Updater\\Changes' => __DIR__ . '/../../..' . '/lib/private/Updater/Changes.php',
'OC\\Updater\\ChangesCheck' => __DIR__ . '/../../..' . '/lib/private/Updater/ChangesCheck.php',
'OC\\Updater\\ChangesMapper' => __DIR__ . '/../../..' . '/lib/private/Updater/ChangesMapper.php',
- 'OC\\Updater\\ChangesResult' => __DIR__ . '/../../..' . '/lib/private/Updater/ChangesResult.php',
'OC\\Updater\\VersionCheck' => __DIR__ . '/../../..' . '/lib/private/Updater/VersionCheck.php',
'OC\\UserStatus\\ISettableProvider' => __DIR__ . '/../../..' . '/lib/private/UserStatus/ISettableProvider.php',
'OC\\UserStatus\\Manager' => __DIR__ . '/../../..' . '/lib/private/UserStatus/Manager.php',
/**
* @method KnownUser mapRowToEntity(array $row)
+ *
+ * @template-extends QBMapper<KnownUser>
*/
class KnownUserMapper extends QBMapper {
/**
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
+/**
+ * @template-extends QBMapper<FileMetadata>
+ */
class FileMetadataMapper extends QBMapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'file_metadata', FileMetadata::class);
* Updates an entry in the db from an entity
*
* @param Entity $entity the entity that should be created
- * @return Entity the saved entity with the set id
+ * @return FileMetadata the saved entity with the set id
* @throws Exception
* @throws \InvalidArgumentException if entity has no id
*/
- public function update(Entity $entity): Entity {
+ public function update(Entity $entity): FileMetadata {
if (!($entity instanceof FileMetadata)) {
throw new \Exception("Entity should be a FileMetadata entity");
}
use OCP\IGroupManager;
use OCP\IUser;
+/**
+ * @template-extends QBMapper<AuthorizedGroup>
+ */
class AuthorizedGroupMapper extends QBMapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'authorized_groups', AuthorizedGroup::class);
/**
* Mapper for Tag entity
+ *
+ * @template-extends QBMapper<Tag>
*/
class TagMapper extends QBMapper {
/**
--- /dev/null
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2018 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @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 <http://www.gnu.org/licenses/>.
+ *
+ */
+namespace OC\Updater;
+
+use OCP\AppFramework\Db\Entity;
+
+/**
+ * Class Changes
+ *
+ * @package OC\Updater
+ * @method string getVersion()=1
+ * @method void setVersion(string $version)
+ * @method string getEtag()
+ * @method void setEtag(string $etag)
+ * @method int getLastCheck()
+ * @method void setLastCheck(int $lastCheck)
+ * @method string getData()
+ * @method void setData(string $data)
+ */
+class Changes extends Entity {
+ /** @var string */
+ protected $version = '';
+
+ /** @var string */
+ protected $etag = '';
+
+ /** @var int */
+ protected $lastCheck = 0;
+
+ /** @var string */
+ protected $data = '';
+
+ public function __construct() {
+ $this->addType('version', 'string');
+ $this->addType('etag', 'string');
+ $this->addType('lastCheck', 'int');
+ $this->addType('data', 'string');
+ }
+}
return json_decode($changesInfo->getData(), true);
}
} catch (DoesNotExistException $e) {
- $changesInfo = new ChangesResult();
+ $changesInfo = new Changes();
}
$response = $this->queryChangesServer($uri, $changesInfo);
return self::RESPONSE_NO_CONTENT;
}
- protected function cacheResult(ChangesResult $entry, string $version) {
+ protected function cacheResult(Changes $entry, string $version) {
if ($entry->getVersion() === $version) {
$this->mapper->update($entry);
} else {
/**
* @throws \Exception
*/
- protected function queryChangesServer(string $uri, ChangesResult $entry): IResponse {
+ protected function queryChangesServer(string $uri, Changes $entry): IResponse {
$headers = [];
if ($entry->getEtag() !== '') {
$headers['If-None-Match'] = [$entry->getEtag()];
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
+/**
+ * @template-extends QBMapper<Changes>
+ */
class ChangesMapper extends QBMapper {
public const TABLE_NAME = 'whats_new';
/**
* @throws DoesNotExistException
*/
- public function getChanges(string $version): ChangesResult {
+ public function getChanges(string $version): Changes {
/* @var $qb IQueryBuilder */
$qb = $this->db->getQueryBuilder();
$result = $qb->select('*')
if ($data === false) {
throw new DoesNotExistException('Changes info is not present');
}
- return ChangesResult::fromRow($data);
+ return Changes::fromRow($data);
}
}
+++ /dev/null
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright Copyright (c) 2018 Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @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 <http://www.gnu.org/licenses/>.
- *
- */
-namespace OC\Updater;
-
-use OCP\AppFramework\Db\Entity;
-
-/**
- * Class ChangesResult
- *
- * @package OC\Updater
- * @method string getVersion()=1
- * @method void setVersion(string $version)
- * @method string getEtag()
- * @method void setEtag(string $etag)
- * @method int getLastCheck()
- * @method void setLastCheck(int $lastCheck)
- * @method string getData()
- * @method void setData(string $data)
- */
-class ChangesResult extends Entity {
- /** @var string */
- protected $version = '';
-
- /** @var string */
- protected $etag = '';
-
- /** @var int */
- protected $lastCheck = 0;
-
- /** @var string */
- protected $data = '';
-
- public function __construct() {
- $this->addType('version', 'string');
- $this->addType('etag', 'string');
- $this->addType('lastCheck', 'int');
- $this->addType('data', 'string');
- }
-}
/**
* @param IDBConnection $db Instance of the Db abstraction layer
* @param string $tableName the name of the table. set this to allow entity
- * @param string|null $entityClass the name of the entity that the sql should be
- * @psalm-param class-string<T>|null $entityClass the name of the entity that the sql should be
+ * @param class-string<T>|null $entityClass the name of the entity that the sql should be
* mapped to queries without using sql
* @since 14.0.0
*/
use OC\Updater\ChangesCheck;
use OC\Updater\ChangesMapper;
-use OC\Updater\ChangesResult;
+use OC\Updater\Changes;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
public function testCacheResultInsert() {
$version = '13.0.4';
- $entry = $this->createMock(ChangesResult::class);
+ $entry = $this->createMock(Changes::class);
$entry->expects($this->exactly(2))
->method('__call')
->withConsecutive(['getVersion'], ['setVersion', [$version]])
public function testCacheResultUpdate() {
$version = '13.0.4';
- $entry = $this->createMock(ChangesResult::class);
+ $entry = $this->createMock(Changes::class);
$entry->expects($this->once())
->method('__call')
->willReturn($version);
*/
public function testQueryChangesServer(string $etag) {
$uri = 'https://changes.nextcloud.server/?13.0.5';
- $entry = $this->createMock(ChangesResult::class);
+ $entry = $this->createMock(Changes::class);
$entry->expects($this->any())
->method('__call')
->willReturn($etag);
$this->expectException(DoesNotExistException::class);
$mocker->willThrowException(new DoesNotExistException('Changes info is not present'));
} else {
- $entry = $this->createMock(ChangesResult::class);
+ $entry = $this->createMock(Changes::class);
$entry->expects($this->once())
->method('__call')
->with('getData')
}
public function testGetChangesForVersionEmptyData() {
- $entry = $this->createMock(ChangesResult::class);
+ $entry = $this->createMock(Changes::class);
$entry->expects($this->once())
->method('__call')
->with('getData')