Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/previewgenerator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Steinmetz <richard@steinmetz.cloud>2022-05-17 11:59:54 +0300
committerGitHub <noreply@github.com>2022-05-17 11:59:54 +0300
commitc9984ca1a3a8420de36dc04affa33ef1702f211c (patch)
treec0640d72204cdad1a434ed4f099704031e02c0f9
parent9bf3ec33041a0eeb4ba94486aeefbd560803e41b (diff)
parent3f1580878866b66157a2bffbe71d1b4f590fc7a7 (diff)
Merge pull request #296 from nextcloud/techdebt/noid/drop-php-7.3
Drop support for PHP 7.3
-rw-r--r--.github/workflows/lint.yml2
-rw-r--r--appinfo/info.xml2
-rw-r--r--composer.json2
-rw-r--r--lib/AppInfo/Application.php5
-rw-r--r--lib/Command/Generate.php35
-rw-r--r--lib/Command/PreGenerate.php42
-rw-r--r--lib/Command/TimestampFormatter.php13
-rw-r--r--lib/Listeners/PostWriteListener.php11
-rw-r--r--lib/SizeHelper.php7
9 files changed, 52 insertions, 67 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 91cc94a..bf6d75e 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
- php-versions: ['7.3', '7.4', '8.0', '8.1']
+ php-versions: ['7.4', '8.0', '8.1']
name: php${{ matrix.php-versions }}
steps:
diff --git a/appinfo/info.xml b/appinfo/info.xml
index e440c7d..95f4699 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -23,7 +23,7 @@ The first time you install this app, before using a cron job, you properly want
<filesystem/>
</types>
<dependencies>
- <php min-version="7.3" max-version="8.1" />
+ <php min-version="7.4" max-version="8.1" />
<nextcloud min-version="22" max-version="24" />
</dependencies>
diff --git a/composer.json b/composer.json
index 815a61b..af1e211 100644
--- a/composer.json
+++ b/composer.json
@@ -4,7 +4,7 @@
"optimize-autoloader": true,
"classmap-authoritative": true,
"platform": {
- "php": "7.3"
+ "php": "7.4"
}
},
"scripts": {
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index dc43dca..ed1d4ee 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -1,10 +1,12 @@
<?php
declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016, Roeland Jago Douma <roeland@famdouma.nl>
*
* @author Roeland Jago Douma <roeland@famdouma.nl>
+ * @author Richard Steinmetz <richard@steinmetz.cloud>
*
* @license GNU AGPL version 3 or any later version
*
@@ -22,6 +24,7 @@ declare(strict_types=1);
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+
namespace OCA\PreviewGenerator\AppInfo;
use OCA\PreviewGenerator\Listeners\PostWriteListener;
@@ -32,7 +35,7 @@ use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Files\Events\Node\NodeWrittenEvent;
class Application extends App implements IBootstrap {
- public const APPNAME='previewgenerator';
+ public const APPNAME = 'previewgenerator';
public function __construct() {
parent::__construct(self::APPNAME);
diff --git a/lib/Command/Generate.php b/lib/Command/Generate.php
index 738d24e..7b22c3b 100644
--- a/lib/Command/Generate.php
+++ b/lib/Command/Generate.php
@@ -1,10 +1,12 @@
<?php
declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016, Roeland Jago Douma <roeland@famdouma.nl>
*
* @author Roeland Jago Douma <roeland@famdouma.nl>
+ * @author Richard Steinmetz <richard@steinmetz.cloud>
*
* @license GNU AGPL version 3 or any later version
*
@@ -50,26 +52,15 @@ class Generate extends Command {
/** @var ?GlobalStoragesService */
protected $globalService;
- /** @var IUserManager */
- protected $userManager;
-
- /** @var IRootFolder */
- protected $rootFolder;
-
- /** @var IPreview */
- protected $previewGenerator;
-
- /** @var IConfig */
- protected $config;
-
- /** @var OutputInterface */
- protected $output;
-
/** @var int[][] */
- protected $sizes;
+ protected array $sizes;
- /** @var IManager */
- protected $encryptionManager;
+ protected IUserManager $userManager;
+ protected IRootFolder $rootFolder;
+ protected IPreview $previewGenerator;
+ protected IConfig $config;
+ protected OutputInterface $output;
+ protected IManager $encryptionManager;
public function __construct(IRootFolder $rootFolder,
IUserManager $userManager,
@@ -92,7 +83,7 @@ class Generate extends Command {
}
}
- protected function configure() {
+ protected function configure(): void {
$this
->setName('preview:generate-all')
->setDescription('Generate previews')
@@ -168,7 +159,7 @@ class Generate extends Command {
return $mountPaths;
}
- private function generatePathPreviews(IUser $user, string $path) {
+ private function generatePathPreviews(IUser $user, string $path): void {
\OC_Util::tearDownFS();
\OC_Util::setupFS($user->getUID());
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
@@ -183,7 +174,7 @@ class Generate extends Command {
$this->parseFolder($pathFolder, $noPreviewMountPaths);
}
- private function generateUserPreviews(IUser $user) {
+ private function generateUserPreviews(IUser $user): void {
\OC_Util::tearDownFS();
\OC_Util::setupFS($user->getUID());
@@ -222,7 +213,7 @@ class Generate extends Command {
}
}
- private function parseFile(File $file) {
+ private function parseFile(File $file): void {
if ($this->previewGenerator->isMimeSupported($file->getMimeType())) {
if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_VERBOSE) {
$this->output->writeln('Generating previews for ' . $file->getPath());
diff --git a/lib/Command/PreGenerate.php b/lib/Command/PreGenerate.php
index d0fa010..c29256b 100644
--- a/lib/Command/PreGenerate.php
+++ b/lib/Command/PreGenerate.php
@@ -1,8 +1,10 @@
<?php
+
/**
* @copyright Copyright (c) 2016, Roeland Jago Douma <roeland@famdouma.nl>
*
* @author Roeland Jago Douma <roeland@famdouma.nl>
+ * @author Richard Steinmetz <richard@steinmetz.cloud>
*
* @license GNU AGPL version 3 or any later version
*
@@ -20,6 +22,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+
namespace OCA\PreviewGenerator\Command;
use OCA\PreviewGenerator\SizeHelper;
@@ -38,35 +41,18 @@ use Symfony\Component\Console\Output\OutputInterface;
class PreGenerate extends Command {
- /** @var string */
- protected $appName;
-
- /** @var IUserManager */
- protected $userManager;
-
- /** @var IRootFolder */
- protected $rootFolder;
-
- /** @var IPreview */
- protected $previewGenerator;
-
- /** @var IConfig */
- protected $config;
-
- /** @var IDBConnection */
- protected $connection;
-
- /** @var OutputInterface */
- protected $output;
-
/** @var int[][] */
- protected $sizes;
-
- /** @var IManager */
- protected $encryptionManager;
-
- /** @var ITimeFactory */
- protected $time;
+ protected array $sizes;
+
+ protected string $appName;
+ protected IUserManager $userManager;
+ protected IRootFolder $rootFolder;
+ protected IPreview $previewGenerator;
+ protected IConfig $config;
+ protected IDBConnection $connection;
+ protected OutputInterface $output;
+ protected IManager $encryptionManager;
+ protected ITimeFactory $time;
/**
* @param string $appName
diff --git a/lib/Command/TimestampFormatter.php b/lib/Command/TimestampFormatter.php
index eb0d971..ea4181e 100644
--- a/lib/Command/TimestampFormatter.php
+++ b/lib/Command/TimestampFormatter.php
@@ -1,10 +1,12 @@
<?php
declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Joas Schilling <coding@schilljs.com>
+ * @author Richard Steinmetz <richard@steinmetz.cloud>
*
* @license AGPL-3.0
*
@@ -37,11 +39,8 @@ use Symfony\Component\Console\Formatter\OutputFormatterStyleInterface;
* @package OCA\PreviewGenerator\Command
*/
class TimestampFormatter implements OutputFormatterInterface {
- /** @var IConfig */
- protected $config;
-
- /** @var OutputFormatterInterface */
- protected $formatter;
+ protected IConfig $config;
+ protected OutputFormatterInterface $formatter;
/**
* @param IConfig $config
@@ -57,7 +56,7 @@ class TimestampFormatter implements OutputFormatterInterface {
*
* @param bool $decorated Whether to decorate the messages or not
*/
- public function setDecorated($decorated) {
+ public function setDecorated($decorated): void {
$this->formatter->setDecorated($decorated);
}
@@ -76,7 +75,7 @@ class TimestampFormatter implements OutputFormatterInterface {
* @param string $name The style name
* @param OutputFormatterStyleInterface $style The style instance
*/
- public function setStyle($name, OutputFormatterStyleInterface $style) {
+ public function setStyle($name, OutputFormatterStyleInterface $style): void {
$this->formatter->setStyle($name, $style);
}
diff --git a/lib/Listeners/PostWriteListener.php b/lib/Listeners/PostWriteListener.php
index 60576e6..22b2261 100644
--- a/lib/Listeners/PostWriteListener.php
+++ b/lib/Listeners/PostWriteListener.php
@@ -1,10 +1,12 @@
<?php
declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016, Roeland Jago Douma <roeland@famdouma.nl>
*
* @author Roeland Jago Douma <roeland@famdouma.nl>
+ * @author Richard Steinmetz <richard@steinmetz.cloud>
*
* @license GNU AGPL version 3 or any later version
*
@@ -22,6 +24,7 @@ declare(strict_types=1);
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+
namespace OCA\PreviewGenerator\Listeners;
use OCP\EventDispatcher\Event;
@@ -32,12 +35,8 @@ use OCP\IDBConnection;
use OCP\IUserManager;
class PostWriteListener implements IEventListener {
-
- /** @var IDBConnection */
- private $connection;
-
- /** @var IUserManager */
- private $userManager;
+ private IDBConnection $connection;
+ private IUserManager $userManager;
public function __construct(IDBConnection $connection,
IUserManager $userManager) {
diff --git a/lib/SizeHelper.php b/lib/SizeHelper.php
index 62c6838..6bacbfd 100644
--- a/lib/SizeHelper.php
+++ b/lib/SizeHelper.php
@@ -1,10 +1,12 @@
<?php
declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2017, Roeland Jago Douma <roeland@famdouma.nl>
*
* @author Roeland Jago Douma <roeland@famdouma.nl>
+ * @author Richard Steinmetz <richard@steinmetz.cloud>
*
* @license GNU AGPL version 3 or any later version
*
@@ -28,6 +30,11 @@ namespace OCA\PreviewGenerator;
use OCP\IConfig;
class SizeHelper {
+
+ /**
+ * @param IConfig $config
+ * @return int[][]
+ */
public static function calculateSizes(IConfig $config): array {
/*
* First calculate the systems max sizes