migrate therinaldos.com data
Build & Deploy to DigitalOcean Space / build (push) Failing after 2m38s

This commit is contained in:
2024-05-05 15:50:45 -04:00
commit ef1ff240d4
23182 changed files with 3801898 additions and 0 deletions
@@ -0,0 +1,472 @@
<?php
declare(strict_types=1);
/**
* Circles - Bring cloud-users closer together.
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2017
* @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 OCA\Circles\Model\GlobalScale;
use JsonSerializable;
use OCA\Circles\Exceptions\JsonException;
use OCA\Circles\Exceptions\ModelException;
use OCA\Circles\Model\Circle;
use OCA\Circles\Model\DeprecatedCircle;
use OCA\Circles\Model\DeprecatedMember;
use OCA\Circles\Tools\Model\SimpleDataStore;
use OCA\Circles\Tools\Traits\TArrayTools;
/**
* Class GSEvent
*
* @package OCA\Circles\Model\GlobalScale
*/
class GSEvent implements JsonSerializable {
public const SEVERITY_LOW = 1;
public const SEVERITY_HIGH = 3;
public const TEST = '\OCA\Circles\GlobalScale\Test';
public const CIRCLE_STATUS = '\OCA\Circles\GlobalScale\CircleStatus';
public const CIRCLE_CREATE = '\OCA\Circles\GlobalScale\CircleCreate';
public const MEMBER_ADD = '\OCA\Circles\GlobalScale\MemberAdd';
public const MEMBER_JOIN = '\OCA\Circles\GlobalScale\MemberJoin';
public const MEMBER_LEAVE = '\OCA\Circles\GlobalScale\MemberLeave';
public const MEMBER_LEVEL = '\OCA\Circles\GlobalScale\MemberLevel';
public const MEMBER_UPDATE = '\OCA\Circles\GlobalScale\MemberUpdate';
public const MEMBER_REMOVE = '\OCA\Circles\GlobalScale\MemberRemove';
public const USER_DELETED = '\OCA\Circles\GlobalScale\UserDeleted';
public const FILE_SHARE = '\OCA\Circles\GlobalScale\FileShare';
public const FILE_UNSHARE = '\OCA\Circles\GlobalScale\FileUnshare';
use TArrayTools;
/** @var string */
private $type = '';
/** @var string */
private $source = '';
/** @var DeprecatedCircle */
private $deprecatedCircle;
/** @var Circle */
private $circle;
/** @var DeprecatedMember */
private $member;
/** @var SimpleDataStore */
private $data;
/** @var int */
private $severity = self::SEVERITY_LOW;
/** @var SimpleDataStore */
private $result;
/** @var string */
private $key = '';
/** @var bool */
private $local = false;
/** @var bool */
private $force = false;
/** @var bool */
private $async = false;
/** @var bool */
private $checked = false;
/**
* GSEvent constructor.
*
* @param string $type
* @param bool $local
* @param bool $force
*/
public function __construct(string $type = '', bool $local = false, bool $force = false) {
$this->type = $type;
$this->local = $local;
$this->force = $force;
$this->data = new SimpleDataStore();
$this->result = new SimpleDataStore();
}
/**
* @return string
*/
public function getType(): string {
return $this->type;
}
/**
* @param mixed $type
*
* @return GSEvent
*/
public function setType($type): self {
$this->type = $type;
return $this;
}
/**
* @return string
*/
public function getSource(): string {
return $this->source;
}
/**
* @param string $source
*
* @return GSEvent
*/
public function setSource(string $source): self {
$this->source = $source;
if ($this->hasMember() && $this->member->getInstance() === '') {
$this->member->setInstance($source);
}
if ($this->hasCircle()
&& $this->getDeprecatedCircle()
->hasViewer()
&& $this->getDeprecatedCircle()
->getViewer()
->getInstance() === '') {
$this->getDeprecatedCircle()
->getViewer()
->setInstance($source);
}
return $this;
}
/**
* @return bool
*/
public function isLocal(): bool {
return $this->local;
}
/**
* @param bool $local
*
* @return GSEvent
*/
public function setLocal(bool $local): self {
$this->local = $local;
return $this;
}
/**
* @return bool
*/
public function isForced(): bool {
return $this->force;
}
/**
* @param bool $force
*
* @return GSEvent
*/
public function setForced(bool $force): self {
$this->force = $force;
return $this;
}
/**
* @return bool
*/
public function isAsync(): bool {
return $this->async;
}
/**
* @param bool $async
*
* @return GSEvent
*/
public function setAsync(bool $async): self {
$this->async = $async;
return $this;
}
/**
* @return DeprecatedCircle
* @deprecated
*/
public function getDeprecatedCircle(): DeprecatedCircle {
return $this->deprecatedCircle;
}
/**
* @param DeprecatedCircle $deprecatedCircle
*
* @return GSEvent
* @deprecated
*/
public function setDeprecatedCircle(DeprecatedCircle $deprecatedCircle): self {
$this->deprecatedCircle = $deprecatedCircle;
return $this;
}
/**
* @return bool
*/
public function hasCircle(): bool {
return ($this->deprecatedCircle !== null || $this->circle !== null);
}
/**
* @param Circle $circle
*
* @return GSEvent
*/
public function setCircle(Circle $circle): self {
$this->circle = $circle;
return $this;
}
/**
* @return Circle
*/
public function getCircle(): Circle {
return $this->circle;
}
/**
* @return DeprecatedMember
*/
public function getMember(): DeprecatedMember {
return $this->member;
}
/**
* @param DeprecatedMember $member
*
* @return GSEvent
*/
public function setMember(DeprecatedMember $member): self {
$this->member = $member;
return $this;
}
/**
* @return bool
*/
public function hasMember(): bool {
return ($this->member !== null);
}
/**
* @param SimpleDataStore $data
*
* @return GSEvent
*/
public function setData(SimpleDataStore $data): self {
$this->data = $data;
return $this;
}
/**
* @return SimpleDataStore
*/
public function getData(): SimpleDataStore {
return $this->data;
}
/**
* @return int
*/
public function getSeverity(): int {
return $this->severity;
}
/**
* @param int $severity
*
* @return GSEvent
*/
public function setSeverity(int $severity): self {
$this->severity = $severity;
return $this;
}
/**
* @return SimpleDataStore
*/
public function getResult(): SimpleDataStore {
return $this->result;
}
/**
* @param SimpleDataStore $result
*
* @return GSEvent
*/
public function setResult(SimpleDataStore $result): self {
$this->result = $result;
return $this;
}
/**
* @return string
*/
public function getKey(): string {
return $this->key;
}
/**
* @param string $key
*
* @return GSEvent
*/
public function setKey(string $key): self {
$this->key = $key;
return $this;
}
/**
* @return bool
*/
public function isValid(): bool {
if ($this->getType() === '') {
return false;
}
return true;
}
/**
* @param string $json
*
* @return GSEvent
* @throws JsonException
* @throws ModelException
*/
public function importFromJson(string $json): self {
$data = json_decode($json, true);
if (!is_array($data)) {
throw new JsonException('invalid JSON');
}
return $this->import($data);
}
/**
* @param array $data
*
* @return GSEvent
* @throws ModelException
*/
public function import(array $data): self {
$this->setType($this->get('type', $data));
$this->setSeverity($this->getInt('severity', $data));
$this->setData(new SimpleDataStore($this->getArray('data', $data)));
$this->setResult(new SimpleDataStore($this->getArray('result', $data)));
$this->setSource($this->get('source', $data));
$this->setKey($this->get('key', $data));
$this->setForced($this->getBool('force', $data));
$this->setAsync($this->getBool('async', $data));
if (array_key_exists('circle', $data)) {
$this->setDeprecatedCircle(DeprecatedCircle::fromArray($data['circle']));
}
if (array_key_exists('member', $data)) {
$this->setMember(DeprecatedMember::fromArray($data['member']));
}
if (!$this->isValid()) {
throw new ModelException('invalid GSEvent');
}
return $this;
}
/**
* @return array
*/
public function jsonSerialize(): array {
$arr = [
'type' => $this->getType(),
'severity' => $this->getSeverity(),
'data' => $this->getData(),
'result' => $this->getResult(),
'key' => $this->getKey(),
'source' => $this->getSource(),
'force' => $this->isForced(),
'async' => $this->isAsync()
];
if ($this->hasCircle()) {
$arr['circle'] = $this->getDeprecatedCircle();
}
if ($this->hasMember()) {
$arr['member'] = $this->getMember();
}
$this->cleanArray($arr);
return $arr;
}
}
@@ -0,0 +1,318 @@
<?php
declare(strict_types=1);
/**
* Circles - Bring cloud-users closer together.
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2017
* @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 OCA\Circles\Model\GlobalScale;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
/**
* Class GSShare
*
* @package OCA\Circles\Model\GlobalScale
*/
class GSShare implements JsonSerializable {
use TArrayTools;
/** @var int */
private $id = 0;
/** @var string */
private $circleId = '';
/** @var string */
private $defaultMountPoint = '';
/** @var string */
private $mountPoint = '';
/** @var int */
private $parent = -1;
/** @var string */
private $owner = '';
/** @var string */
private $instance = '';
/** @var string */
private $token = '';
/** @var string */
private $password = '';
/**
* GSShare constructor.
*
* @param string $circleId
* @param string $token
*/
public function __construct(string $circleId = '', string $token = '') {
$this->circleId = $circleId;
$this->token = $token;
}
/**
* @return int
*/
public function getId(): int {
return $this->id;
}
public function setId(int $id): self {
$this->id = $id;
return $this;
}
/**
*
* @return string
*/
public function getCircleId(): string {
return $this->circleId;
}
/**
* @param string $circleId
*
* @return GSShare
*/
public function setCircleId(string $circleId): self {
$this->circleId = $circleId;
return $this;
}
/**
* @return string
*/
public function getDefaultMountPoint(): string {
return $this->defaultMountPoint;
}
/**
* @param string $mountPoint
*
* @return GSShare
*/
public function setDefaultMountPoint(string $mountPoint): self {
$this->defaultMountPoint = $mountPoint;
return $this;
}
/**
* @param string $userId
*
* @return string
*/
public function getMountPoint(string $userId = ''): string {
$mountPoint = $this->mountPoint;
if ($mountPoint === '') {
$mountPoint = $this->defaultMountPoint;
}
if ($userId === '') {
return $mountPoint;
}
return '/' . $userId . '/files/' . ltrim($mountPoint, '/');
}
/**
* @param string $mountPoint
*
* @return GSShare
*/
public function setMountPoint(string $mountPoint): self {
$this->mountPoint = $mountPoint;
return $this;
}
/**
* @return int
*/
public function getParent(): int {
return $this->parent;
}
/**
* @param int $parent
*
* @return GSShare
*/
public function setParent(int $parent): self {
$this->parent = $parent;
return $this;
}
/**
* @return string
*/
public function getOwner(): string {
return $this->owner;
}
/**
* @param string $owner
*
* @return GSShare
*/
public function setOwner(string $owner): self {
$this->owner = $owner;
return $this;
}
/**
* @return string
*/
public function getInstance(): string {
return $this->instance;
}
/**
* @param string $instance
*
* @return GSShare
*/
public function setInstance(string $instance): self {
$this->instance = $instance;
return $this;
}
/**
* @return string
*/
public function getToken(): string {
return $this->token;
}
/**
* @param string $token
*
* @return GSShare
*/
public function setToken(string $token): self {
$this->token = $token;
return $this;
}
/**
* @return string
*/
public function getPassword(): string {
return $this->password;
}
/**
* @param string $password
*
* @return GSShare
*/
public function setPassword(string $password): self {
$this->password = $password;
return $this;
}
/**
* @param array $data
*
* @return GSShare
*/
public function importFromDatabase(array $data): self {
$this->setId($this->getInt('id', $data));
$this->setCircleId($this->get('circle_id', $data));
$this->setOwner($this->get('owner', $data));
$this->setInstance($this->get('instance', $data));
$this->setToken($this->get('token', $data));
$this->setParent($this->getInt('parent', $data));
$this->setMountPoint($this->get('gsshares_mountpoint', $data));
$this->setDefaultMountPoint($this->get('mountpoint', $data));
return $this;
}
/**
* @param string $userId
* @param string $protocol
*
* @return array
*/
public function toMount(string $userId, string $protocol = 'https'): array {
return [
'owner' => $this->getOwner(),
'remote' => $protocol . '://' . $this->getInstance(),
'token' => $this->getToken(),
'share_token' => $this->getToken(),
'password' => $this->getPassword(),
'mountpoint' => $this->getMountPoint($userId)
];
}
/**
* @return array
*/
public function jsonSerialize(): array {
return [
'id' => $this->getId(),
'defaultMountPoint' => $this->getDefaultMountPoint(),
'mountPoint' => $this->getMountPoint(),
'parent' => $this->getParent(),
'owner' => $this->getOwner(),
'instance' => $this->getInstance(),
'token' => $this->getToken(),
'password' => $this->getPassword()
];
}
}
@@ -0,0 +1,151 @@
<?php
declare(strict_types=1);
/**
* Circles - Bring cloud-users closer together.
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2017
* @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 OCA\Circles\Model\GlobalScale;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
/**
* Class GSShare
*
* @package OCA\Circles\Model\GlobalScale
*/
class GSShareMountpoint implements JsonSerializable {
use TArrayTools;
/** @var int */
private $shareId = 0;
/** @var string */
private $userId = '';
/** @var string */
private $mountPoint = '';
/**
* GSShareMountpoint constructor.
*
* @param int $shareId
* @param string $userId
* @param string $mountPoint
*/
public function __construct(int $shareId = 0, string $userId = '', string $mountPoint = '') {
$this->shareId = $shareId;
$this->userId = $userId;
$this->mountPoint = $mountPoint;
}
/**
* @return string
*/
public function getUserId(): string {
return $this->userId;
}
/**
* @param string $userId
*
* @return GSShareMountpoint
*/
public function setUserId(string $userId): self {
$this->userId = $userId;
return $this;
}
/**
* @return int
*/
public function getShareId(): int {
return $this->shareId;
}
/**
* @param int $shareId
*
* @return $this
*/
public function setShareId(int $shareId): self {
$this->shareId = $shareId;
return $this;
}
/**
* @return string
*/
public function getMountPoint(): string {
return $this->mountPoint;
}
/**
* @param string $mountPoint
*
* @return GSShareMountpoint
*/
public function setMountPoint(string $mountPoint): self {
$this->mountPoint = $mountPoint;
return $this;
}
/**
* @param array $data
*
* @return GSShareMountpoint
*/
public function importFromDatabase(array $data): self {
$this->setShareId($this->getInt('share_id', $data));
$this->setUserId($this->get('user_id', $data));
$this->setMountPoint($this->get('mountpoint', $data));
return $this;
}
/**
* @return array
*/
public function jsonSerialize(): array {
return [
'userId' => $this->getUserId(),
'shareId' => $this->getShareId(),
'mountPoint' => $this->getMountPoint(),
];
}
}
@@ -0,0 +1,238 @@
<?php
declare(strict_types=1);
/**
* Circles - Bring cloud-users closer together.
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2017
* @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 OCA\Circles\Model\GlobalScale;
use OCA\Circles\Tools\Traits\TArrayTools;
use JsonSerializable;
use OCA\Circles\Exceptions\JsonException;
use OCA\Circles\Exceptions\ModelException;
/**
* Class GSEvent
*
* @package OCA\Circles\Model\GlobalScale
*/
class GSWrapper implements JsonSerializable {
use TArrayTools;
public const STATUS_INIT = 0;
public const STATUS_FAILED = 1;
public const STATUS_DONE = 8;
public const STATUS_OVER = 9;
/** @var string */
private $token = '';
/** @var GSEvent */
private $event;
/** @var string */
private $instance = '';
/** @var int */
private $severity = GSEvent::SEVERITY_LOW;
/** @var int */
private $status = 0;
/** @var int */
private $creation;
public function __construct() {
}
/**
* @return string
*/
public function getToken(): string {
return $this->token;
}
/**
* @param string $token
*
* @return GSWrapper
*/
public function setToken(string $token): self {
$this->token = $token;
return $this;
}
/**
* @return GSEvent
*/
public function getEvent(): GSEvent {
return $this->event;
}
/**
* @param GSEvent $event
*
* @return GSWrapper
*/
public function setEvent(GSEvent $event): self {
$this->event = $event;
return $this;
}
/**
* @return bool
*/
public function hasEvent(): bool {
return ($this->event !== null);
}
/**
* @return string
*/
public function getInstance(): string {
return $this->instance;
}
/**
* @param string $instance
*
* @return GSWrapper
*/
public function setInstance(string $instance): self {
$this->instance = $instance;
return $this;
}
/**
* @return int
*/
public function getSeverity(): int {
return $this->severity;
}
/**
* @param int $severity
*
* @return GSWrapper
*/
public function setSeverity(int $severity): self {
$this->severity = $severity;
return $this;
}
/**
* @return int
*/
public function getStatus(): int {
return $this->status;
}
/**
* @param int $status
*
* @return GSWrapper
*/
public function setStatus(int $status): self {
$this->status = $status;
return $this;
}
/**
* @return int
*/
public function getCreation(): int {
return $this->creation;
}
/**
* @param int $creation
*
* @return GSWrapper
*/
public function setCreation(int $creation): self {
$this->creation = $creation;
return $this;
}
/**
* @param array $data
*
* @return GSWrapper
* @throws JsonException
* @throws ModelException
*/
public function import(array $data): self {
$this->setToken($this->get('token', $data));
$this->setInstance($this->get('instance', $data));
$this->setSeverity($this->getInt('severity', $data, GSEvent::SEVERITY_LOW));
$this->setStatus($this->getInt('status', $data, GSWrapper::STATUS_INIT));
$event = new GSEvent();
$event->importFromJson($this->get('event', $data));
$this->setEvent($event);
$this->setCreation($this->getInt('creation', $data));
return $this;
}
/**
* @return array
*/
public function jsonSerialize(): array {
$arr = [
'id' => $this->getToken(),
'event' => $this->getEvent(),
'severity' => $this->getSeverity(),
'status' => $this->getStatus(),
'creation' => $this->getCreation()
];
$this->cleanArray($arr);
return $arr;
}
}