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:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-08-22 12:50:06 +0300
committerGitHub <noreply@github.com>2018-08-22 12:50:06 +0300
commit9e81ffdccc8b280d1e5b94b5335c55ae68dc1e92 (patch)
treef68a4f9e4b49f847512b02fe4362c66049309cc3
parent57f918beb50298b45f8533599a7ba16228f71c1f (diff)
parent166704f8ace549cba73e78161593323e97add6d6 (diff)
Merge pull request #123 from rullzer/php7
PHP7 fixes
-rw-r--r--.travis.yml2
-rw-r--r--appinfo/app.php2
-rw-r--r--appinfo/info.xml6
-rw-r--r--composer/composer/ClassLoader.php2
-rw-r--r--lib/AppInfo/Application.php16
-rw-r--r--lib/Command/DeleteOld.php15
-rw-r--r--lib/Command/Generate.php25
-rw-r--r--lib/Command/TimestampFormatter.php9
-rw-r--r--lib/SizeHelper.php7
-rw-r--r--lib/Watcher.php13
10 files changed, 25 insertions, 72 deletions
diff --git a/.travis.yml b/.travis.yml
index 83930f4..66f01ba 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,8 @@
language: php
php:
- - 5.6
- 7
- 7.1
+ - 7.2
env:
global:
diff --git a/appinfo/app.php b/appinfo/app.php
index 5f11dfb..781cab2 100644
--- a/appinfo/app.php
+++ b/appinfo/app.php
@@ -20,4 +20,4 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-$app = new \OCA\PreviewGenerator\AppInfo\Application('previewgenerator');
+$app = new \OCA\PreviewGenerator\AppInfo\Application();
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 3e27997..5b47c7c 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -11,7 +11,7 @@ The app does not replace on demand preview generation so if a preview is request
</description>
<licence>AGPL</licence>
<author>Roeland Jago Douma</author>
- <version>1.1.0</version>
+ <version>1.99.0</version>
<namespace>PreviewGenerator</namespace>
<category>multimedia</category>
<website>https://github.com/rullzer/previewgenerator</website>
@@ -21,8 +21,8 @@ The app does not replace on demand preview generation so if a preview is request
<filesystem/>
</types>
<dependencies>
- <php min-version="5.6"/>
- <nextcloud min-version="13" max-version="14" />
+ <php min-version="7.0"/>
+ <nextcloud min-version="14" max-version="14" />
</dependencies>
<commands>
diff --git a/composer/composer/ClassLoader.php b/composer/composer/ClassLoader.php
index dc02dfb..95f7e09 100644
--- a/composer/composer/ClassLoader.php
+++ b/composer/composer/ClassLoader.php
@@ -377,7 +377,7 @@ class ClassLoader
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
- $search = $subPath.'\\';
+ $search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index d31ab78..e61dad8 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, Roeland Jago Douma <roeland@famdouma.nl>
*
@@ -30,22 +31,15 @@ use OCP\Files\Node;
class Application extends App {
- /**
- * Application constructor.
- *
- * @param string $appName
- * @param array $urlParams
- */
- public function __construct($appName, array $urlParams = []) {
- parent::__construct($appName, $urlParams);
+ const APPNAME='previewgenerator';
+
+ public function __construct() {
+ parent::__construct(self::APPNAME);
$container = $this->getContainer();
$this->connectWatcher($container);
}
- /**
- * @param IAppContainer $container
- */
private function connectWatcher(IAppContainer $container) {
/** @var IRootFolder $root */
$root = $container->query(IRootFolder::class);
diff --git a/lib/Command/DeleteOld.php b/lib/Command/DeleteOld.php
index e0ef35d..d0ace74 100644
--- a/lib/Command/DeleteOld.php
+++ b/lib/Command/DeleteOld.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, Roeland Jago Douma <roeland@famdouma.nl>
*
@@ -40,10 +41,6 @@ class DeleteOld extends Command {
/** @var IRootFolder */
protected $rootFolder;
- /**
- * @param IRootFolder $rootFolder
- * @param IUserManager $userManager
- */
public function __construct(IRootFolder $rootFolder,
IUserManager $userManager) {
parent::__construct();
@@ -63,12 +60,7 @@ class DeleteOld extends Command {
);
}
- /**
- * @param InputInterface $input
- * @param OutputInterface $output
- * @return int
- */
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$userId = $input->getArgument('user_id');
if ($userId === null) {
@@ -85,9 +77,6 @@ class DeleteOld extends Command {
return 0;
}
- /**
- * @param IUser $user
- */
private function deletePreviews(IUser $user) {
\OC_Util::tearDownFS();
\OC_Util::setupFS($user->getUID());
diff --git a/lib/Command/Generate.php b/lib/Command/Generate.php
index 62cae3d..c7c4dec 100644
--- a/lib/Command/Generate.php
+++ b/lib/Command/Generate.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, Roeland Jago Douma <roeland@famdouma.nl>
*
@@ -61,14 +62,6 @@ class Generate extends Command {
/** @var IManager */
protected $encryptionManager;
-
- /**
- * @param IRootFolder $rootFolder
- * @param IUserManager $userManager
- * @param IPreview $previewGenerator
- * @param IConfig $config
- * @param IManager $encryptionManager
- */
public function __construct(IRootFolder $rootFolder,
IUserManager $userManager,
IPreview $previewGenerator,
@@ -94,12 +87,7 @@ class Generate extends Command {
);
}
- /**
- * @param InputInterface $input
- * @param OutputInterface $output
- * @return int
- */
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
if ($this->encryptionManager->isEnabled()) {
$output->writeln('Encryption is enabled. Aborted.');
return 1;
@@ -127,9 +115,6 @@ class Generate extends Command {
return 0;
}
- /**
- * @param IUser $user
- */
private function generateUserPreviews(IUser $user) {
\OC_Util::tearDownFS();
\OC_Util::setupFS($user->getUID());
@@ -138,9 +123,6 @@ class Generate extends Command {
$this->parseFolder($userFolder);
}
- /**
- * @param Folder $folder
- */
private function parseFolder(Folder $folder) {
// Respect the '.nomedia' file. If present don't traverse the folder
if ($folder->nodeExists('.nomedia')) {
@@ -161,9 +143,6 @@ class Generate extends Command {
}
}
- /**
- * @param File $file
- */
private function parseFile(File $file) {
if ($this->previewGenerator->isMimeSupported($file->getMimeType())) {
if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_VERBOSE) {
diff --git a/lib/Command/TimestampFormatter.php b/lib/Command/TimestampFormatter.php
index 8c622af..b716939 100644
--- a/lib/Command/TimestampFormatter.php
+++ b/lib/Command/TimestampFormatter.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -64,7 +65,7 @@ class TimestampFormatter implements OutputFormatterInterface {
*
* @return bool true if the output will decorate messages, false otherwise
*/
- public function isDecorated() {
+ public function isDecorated(): bool {
return $this->formatter->isDecorated();
}
@@ -84,7 +85,7 @@ class TimestampFormatter implements OutputFormatterInterface {
* @param string $name
* @return bool
*/
- public function hasStyle($name) {
+ public function hasStyle($name): bool {
return $this->formatter->hasStyle($name);
}
@@ -95,7 +96,7 @@ class TimestampFormatter implements OutputFormatterInterface {
* @return OutputFormatterStyleInterface
* @throws \InvalidArgumentException When style isn't defined
*/
- public function getStyle($name) {
+ public function getStyle($name): OutputFormatterStyleInterface {
return $this->formatter->getStyle($name);
}
@@ -106,7 +107,7 @@ class TimestampFormatter implements OutputFormatterInterface {
* @return string The styled message, prepended with a timestamp using the
* log timezone and dateformat, e.g. "2015-06-23T17:24:37+02:00"
*/
- public function format($message) {
+ public function format($message): string {
$timeZone = $this->config->getSystemValue('logtimezone', 'UTC');
$timeZone = $timeZone !== null ? new \DateTimeZone($timeZone) : null;
diff --git a/lib/SizeHelper.php b/lib/SizeHelper.php
index 18626d1..c49b253 100644
--- a/lib/SizeHelper.php
+++ b/lib/SizeHelper.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2017, Roeland Jago Douma <roeland@famdouma.nl>
*
@@ -27,7 +28,7 @@ use OCP\IConfig;
class SizeHelper {
- public static function calculateSizes(IConfig $config) {
+ public static function calculateSizes(IConfig $config): array {
/*
* First calculate the systems max sizes
*/
@@ -38,8 +39,8 @@ class SizeHelper {
'width' => [],
];
- $maxW = (int)$config->getSystemValue('preview_max_x', 2048);
- $maxH = (int)$config->getSystemValue('preview_max_y', 2048);
+ $maxW = (int)$config->getSystemValue('preview_max_x', 4096);
+ $maxH = (int)$config->getSystemValue('preview_max_y', 4096);
$s = 32;
while($s <= $maxW || $s <= $maxH) {
diff --git a/lib/Watcher.php b/lib/Watcher.php
index 5497e23..5344ff7 100644
--- a/lib/Watcher.php
+++ b/lib/Watcher.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, Roeland Jago Douma <roeland@famdouma.nl>
*
@@ -35,24 +36,12 @@ class Watcher {
/** @var IUserManager */
private $userManager;
- /**
- * Watcher constructor.
- *
- * @param IDBConnection $connection
- * @param IUserManager $userManager
- */
public function __construct(IDBConnection $connection,
IUserManager $userManager) {
$this->connection = $connection;
$this->userManager = $userManager;
}
- /**
- * A node has been updated. We just store the file id
- * with the current user in the DB
- *
- * @param Node $node
- */
public function postWrite(Node $node) {
$absPath = ltrim($node->getPath(), '/');
$owner = explode('/', $absPath)[0];