From 553239c0834f4089d7ad9b75691264d41de9e069 Mon Sep 17 00:00:00 2001 From: cld4h <20869428+cld4h@users.noreply.github.com> Date: Fri, 22 Apr 2022 10:00:00 +0800 Subject: Fix issue #31692 of occ files:scan occ files:scan reports error "Implicit conversion from float XXX to int loses precision" Signed-off-by: cld4h <20869428+cld4h@users.noreply.github.com> --- apps/files/lib/Command/Scan.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/files/lib/Command') diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php index 47f1caabc78..0a7a53dc0bf 100644 --- a/apps/files/lib/Command/Scan.php +++ b/apps/files/lib/Command/Scan.php @@ -291,7 +291,7 @@ class Scan extends Base { protected function formatExecTime() { $secs = round($this->execTime); # convert seconds into HH:MM:SS form - return sprintf('%02d:%02d:%02d', ($secs / 3600), ($secs / 60 % 60), $secs % 60); + return sprintf('%02d:%02d:%02d', (int)($secs / 3600), ( (int)($secs / 60) % 60), $secs % 60); } protected function reconnectToDatabase(OutputInterface $output): Connection { -- cgit v1.2.3 From ad60b3b479918634f3f30ea83104fbb116e9d0bb Mon Sep 17 00:00:00 2001 From: Bill McGonigle Date: Tue, 14 Jun 2022 07:10:29 -0400 Subject: Mention missing files subdir Many users are getting confused by the inaccurate error message "Home storage for user $user not writable" because the storage *is* writable. The actual issue is a missing files/ subdirectory. cf. https://help.nextcloud.com/t/home-storage-for-user-not-writable/10831/7 By mentioning the possible cause in the error message, users are going to be able to rapidly solve their problem rather than bang their heads against the screen, Google, and eventually forums to find out that the error message is wrong in their case. Yes, it would be better to detect and precisely describe the fault, or fix the problem automatically, but until then, be kind to the users for the next however many years. --- apps/files/lib/Command/Scan.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/files/lib/Command') diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php index 0a7a53dc0bf..b40e963efc6 100644 --- a/apps/files/lib/Command/Scan.php +++ b/apps/files/lib/Command/Scan.php @@ -144,7 +144,7 @@ class Scan extends Base { $scanner->scan($path, $recursive, $homeOnly ? [$this, 'filterHomeMount'] : null); } } catch (ForbiddenException $e) { - $output->writeln("Home storage for user $user not writable"); + $output->writeln("Home storage for user $user not writable or 'files' subdirectory missing"); $output->writeln('Make sure you\'re running the scan command only as the user the web server runs as'); } catch (InterruptedException $e) { # exit the function if ctrl-c has been pressed -- cgit v1.2.3 From c54fb5f9e616e0a0a5a475a1378cb340d7083780 Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Tue, 14 Jun 2022 15:12:28 +0200 Subject: Use {$var} instead of ${var} for PHP 8.2 compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/dav/lib/DAV/Sharing/Backend.php | 2 +- apps/files/lib/Command/RepairTree.php | 2 +- lib/private/L10N/L10N.php | 2 +- lib/private/Mail/EMailTemplate.php | 2 +- lib/private/Setup/MySQL.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'apps/files/lib/Command') diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index 0f675ea4c15..544a38cfbe6 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -201,7 +201,7 @@ class Backend { while ($row = $result->fetch()) { $p = $this->principalBackend->getPrincipalByPath($row['principaluri']); $shares[] = [ - 'href' => "principal:${row['principaluri']}", + 'href' => "principal:{$row['principaluri']}", 'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '', 'status' => 1, 'readOnly' => (int) $row['access'] === self::ACCESS_READ, diff --git a/apps/files/lib/Command/RepairTree.php b/apps/files/lib/Command/RepairTree.php index 96f114735d6..4fe64ef0edf 100644 --- a/apps/files/lib/Command/RepairTree.php +++ b/apps/files/lib/Command/RepairTree.php @@ -68,7 +68,7 @@ class RepairTree extends Command { ->where($query->expr()->eq('fileid', $query->createParameter('fileid'))); foreach ($rows as $row) { - $output->writeln("Path of file ${row['fileid']} is ${row['path']} but should be ${row['parent_path']}/${row['name']} based on it's parent", OutputInterface::VERBOSITY_VERBOSE); + $output->writeln("Path of file {$row['fileid']} is {$row['path']} but should be {$row['parent_path']}/{$row['name']} based on it's parent", OutputInterface::VERBOSITY_VERBOSE); if ($fix) { $fileId = $this->getFileId((int)$row['parent_storage'], $row['parent_path'] . '/' . $row['name']); diff --git a/lib/private/L10N/L10N.php b/lib/private/L10N/L10N.php index 09c0f1cdb35..82ef3350b1f 100644 --- a/lib/private/L10N/L10N.php +++ b/lib/private/L10N/L10N.php @@ -122,7 +122,7 @@ class L10N implements IL10N { * */ public function n(string $text_singular, string $text_plural, int $count, array $parameters = []): string { - $identifier = "_${text_singular}_::_${text_plural}_"; + $identifier = "_{$text_singular}_::_{$text_plural}_"; if (isset($this->translations[$identifier])) { return (string) new L10NString($this, $identifier, $parameters, $count); } diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php index 2c091deb2a1..7ec2b46bad3 100644 --- a/lib/private/Mail/EMailTemplate.php +++ b/lib/private/Mail/EMailTemplate.php @@ -497,7 +497,7 @@ EOF; */ /** @var string $label */ $label = ($plainMetaInfo !== false)? $plainMetaInfo : ''; - $this->plainBody .= sprintf("%${plainIndent}s %s\n", + $this->plainBody .= sprintf("%{$plainIndent}s %s\n", $label, str_replace("\n", "\n" . str_repeat(' ', $plainIndent + 1), $plainText)); } diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php index 7bd8fa7b1ec..e878ed4d9aa 100644 --- a/lib/private/Setup/MySQL.php +++ b/lib/private/Setup/MySQL.php @@ -80,7 +80,7 @@ class MySQL extends AbstractDatabase { $user = $this->dbUser; //we can't use OC_DB functions here because we need to connect as the administrative user. $characterSet = $this->config->getValue('mysql.utf8mb4', false) ? 'utf8mb4' : 'utf8'; - $query = "CREATE DATABASE IF NOT EXISTS `$name` CHARACTER SET $characterSet COLLATE ${characterSet}_bin;"; + $query = "CREATE DATABASE IF NOT EXISTS `$name` CHARACTER SET $characterSet COLLATE {$characterSet}_bin;"; $connection->executeUpdate($query); } catch (\Exception $ex) { $this->logger->error('Database creation failed.', [ -- cgit v1.2.3