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,47 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl>
*
* @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\Activity\BackgroundJob;
use OC\BackgroundJob\TimedJob;
use OCA\Activity\DigestSender;
use OCP\AppFramework\Utility\ITimeFactory;
class DigestMail extends TimedJob {
/** @var DigestSender */
protected $digestSender;
/** @var ITimeFactory */
protected $timeFactory;
public function __construct(DigestSender $digestSender, ITimeFactory $timeFactory) {
// run hourly
$this->setInterval(60 * 60);
$this->digestSender = $digestSender;
$this->timeFactory = $timeFactory;
}
protected function run($argument) {
$this->digestSender->sendDigests($this->timeFactory->getTime());
}
}
@@ -0,0 +1,67 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Joas Schilling <coding@schilljs.com>
* @author Morris Jobke <hey@morrisjobke.de>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* 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, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OCA\Activity\BackgroundJob;
use OC\BackgroundJob\TimedJob;
use OCA\Activity\MailQueueHandler;
/**
* Class EmailNotification
*
* @package OCA\Activity\BackgroundJob
*/
class EmailNotification extends TimedJob {
/** @var MailQueueHandler */
protected $queueHandler;
/** @var bool */
protected $isCLI;
public function __construct(MailQueueHandler $mailQueueHandler,
bool $isCLI) {
// Run everytime cron is executed, so the batching doesn't delay too much
$this->setInterval(1);
$this->queueHandler = $mailQueueHandler;
$this->isCLI = $isCLI;
}
protected function run($argument) {
// We don't use time() but "time() - 1" here, so we don't run into
// runtime issues later and delete emails, which were created in the
// same second, but were not collected for the emails.
$sendTime = time() - 1;
if ($this->isCLI) {
do {
// If we are in CLI mode, we keep sending emails
// until we are done.
$emails_sent = $this->queueHandler->sendEmails(MailQueueHandler::CLI_EMAIL_BATCH_SIZE, $sendTime);
} while ($emails_sent === MailQueueHandler::CLI_EMAIL_BATCH_SIZE);
} else {
// Only send 25 Emails in one go for web cron
$this->queueHandler->sendEmails(MailQueueHandler::WEB_EMAIL_BATCH_SIZE, $sendTime);
}
}
}
@@ -0,0 +1,56 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Joas Schilling <coding@schilljs.com>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* 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, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OCA\Activity\BackgroundJob;
use OCA\Activity\Data;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;
class ExpireActivities extends TimedJob {
/** @var Data */
protected $data;
/** @var IConfig */
protected $config;
public function __construct(ITimeFactory $time,
Data $data,
IConfig $config) {
parent::__construct($time);
// Run once per day
$this->setInterval(60 * 60 * 24);
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
$this->data = $data;
$this->config = $config;
}
protected function run($argument): void {
// Remove activities that are older then one year
$expireDays = $this->config->getSystemValue('activity_expire_days', 365);
$this->data->expire($expireDays);
}
}
@@ -0,0 +1,129 @@
<?php
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
*
* @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\Activity\BackgroundJob;
use GuzzleHttp\Exception\ClientException;
use OC\BackgroundJob\QueuedJob;
use OCA\Activity\Extension\Files;
use OCP\Federation\ICloudId;
use OCP\Federation\ICloudIdManager;
use OCP\Http\Client\IClientService;
class RemoteActivity extends QueuedJob {
/** @var IClientService */
protected $clientService;
/** @var ICloudIdManager */
protected $cloudIdManager;
public function __construct(IClientService $clientService, ICloudIdManager $cloudIdManager) {
$this->clientService = $clientService;
$this->cloudIdManager = $cloudIdManager;
}
protected function run($arguments) {
call_user_func_array([$this, 'sendActivity'], $arguments);
}
protected function sendActivity($target, $token, $path, $internalType, $time, $actor, $secondPath = '') {
$client = $this->clientService->newClient();
$cloudId = $this->cloudIdManager->resolveCloudId($target);
$type = $this->translateType($internalType, $secondPath);
$fields = [
'@context' => 'https://www.w3.org/ns/activitystreams',
'to' => [
'type' => 'Person',
'name' => $cloudId->getUser(),
],
'actor' => [
'type' => 'Person',
'name' => $actor,
],
'type' => $type,
'updated' => date(\DateTime::W3C, $time),
];
if ($type === 'Move') {
$fields['target'] = [
'type' => 'Document',
'name' => $path,
];
$fields['origin'] = [
'type' => 'Document',
'name' => $secondPath,
];
} else {
$fields['object'] = [
'type' => 'Document',
'name' => $path,
];
}
try {
$client->post(
$this->getServerURL($cloudId, $token), [
'body' => $fields,
'timeout' => 10,
'connect_timeout' => 10,
]
);
} catch (ClientException $e) {
}
}
/**
* @param ICloudId $cloudId
* @param string $token
* @return string
*/
protected function getServerURL(ICloudId $cloudId, $token) {
$remote = $cloudId->getRemote();
if (strpos($remote, 'http') !== 0) {
$remote = 'https://' . $remote;
}
return rtrim($remote, '/') . '/ocs/v2.php/apps/activity/api/v2/remote/' . $token;
}
/**
* @param string $internalType
* @param string $secondPath
* @return string
*/
protected function translateType($internalType, $secondPath) {
switch ($internalType) {
case Files::TYPE_SHARE_CREATED:
case Files::TYPE_SHARE_RESTORED:
return 'Create';
case Files::TYPE_FILE_CHANGED:
if ($secondPath !== '') {
return 'Move';
}
return 'Update';
case Files::TYPE_SHARE_DELETED:
return 'Delete';
}
return '';
}
}