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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.htaccess3
-rw-r--r--.user.ini3
-rw-r--r--apps/accessibility/lib/Controller/AccessibilityController.php10
-rw-r--r--apps/dav/lib/Connector/Sabre/File.php13
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesPlugin.php8
-rw-r--r--apps/dav/lib/Connector/Sabre/Node.php31
-rw-r--r--apps/files/appinfo/info.xml4
-rw-r--r--apps/files/appinfo/routes.php5
-rw-r--r--apps/files/composer/composer/autoload_classmap.php2
-rw-r--r--apps/files/composer/composer/autoload_static.php2
-rw-r--r--apps/files/js/admin.js70
-rw-r--r--apps/files/lib/Controller/SettingsController.php51
-rw-r--r--apps/files/lib/Settings/Admin.php87
-rw-r--r--apps/files/templates/admin.php20
-rw-r--r--apps/files/tests/Settings/AdminTest.php84
-rw-r--r--apps/files_external/3rdparty/composer.json2
-rw-r--r--apps/files_external/3rdparty/composer.lock12
-rw-r--r--apps/files_external/3rdparty/composer/autoload_classmap.php15
-rw-r--r--apps/files_external/3rdparty/composer/autoload_static.php15
-rw-r--r--apps/files_external/3rdparty/composer/installed.json12
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Wrapped/Connection.php6
-rw-r--r--apps/files_external/lib/Command/Notify.php67
-rw-r--r--apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php29
-rw-r--r--apps/lookup_server_connector/lib/UpdateLookupServer.php20
-rw-r--r--lib/private/IntegrityCheck/Checker.php34
-rw-r--r--lib/private/legacy/files.php82
-rw-r--r--lib/private/legacy/helper.php26
-rw-r--r--tests/data/integritycheck/htaccessWithValidModifiedContent/.htaccess3
-rw-r--r--tests/data/integritycheck/htaccessWithValidModifiedContent/.user.ini7
-rw-r--r--tests/lib/FilesTest.php137
-rw-r--r--tests/lib/IntegrityCheck/CheckerTest.php14
-rw-r--r--tests/lib/LegacyHelperTest.php22
32 files changed, 182 insertions, 714 deletions
diff --git a/.htaccess b/.htaccess
index 2b0caed2743..cc2e0c95eb1 100644
--- a/.htaccess
+++ b/.htaccess
@@ -31,9 +31,6 @@
</FilesMatch>
</IfModule>
<IfModule mod_php7.c>
- php_value upload_max_filesize 511M
- php_value post_max_size 511M
- php_value memory_limit 512M
php_value mbstring.func_overload 0
php_value default_charset 'UTF-8'
php_value output_buffering 0
diff --git a/.user.ini b/.user.ini
index fe14834b2e3..ff8f6b0b17c 100644
--- a/.user.ini
+++ b/.user.ini
@@ -1,6 +1,3 @@
-upload_max_filesize=511M
-post_max_size=511M
-memory_limit=512M
mbstring.func_overload=0
always_populate_raw_post_data=-1
default_charset='UTF-8'
diff --git a/apps/accessibility/lib/Controller/AccessibilityController.php b/apps/accessibility/lib/Controller/AccessibilityController.php
index 91c110de868..e17b206cdfd 100644
--- a/apps/accessibility/lib/Controller/AccessibilityController.php
+++ b/apps/accessibility/lib/Controller/AccessibilityController.php
@@ -260,7 +260,15 @@ class AccessibilityController extends Controller {
* @return string
*/
private function invertSvgIconsColor(string $css) {
- return str_replace(['color=000', 'color=fff', 'color=***'], ['color=***', 'color=000', 'color=fff'], $css);
+ return str_replace(
+ ['color=000&', 'color=fff&', 'color=***&'],
+ ['color=***&', 'color=000&', 'color=fff&'],
+ str_replace(
+ ['color=000000&', 'color=ffffff&', 'color=******&'],
+ ['color=******&', 'color=000000&', 'color=ffffff&'],
+ $css
+ )
+ );
}
/**
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php
index 8aa7d66ba34..3c42f66a04a 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -169,9 +169,12 @@ class File extends Node implements IFile {
if ($partStorage->instanceOfStorage(Storage\IWriteStreamStorage::class)) {
if (!is_resource($data)) {
- $data = fopen('php://temp', 'r+');
- fwrite($data, 'foobar');
- rewind($data);
+ $tmpData = fopen('php://temp', 'r+');
+ if ($data !== null) {
+ fwrite($tmpData, $data);
+ rewind($tmpData);
+ }
+ $data = $tmpData;
}
$isEOF = false;
@@ -205,7 +208,9 @@ class File extends Node implements IFile {
if (isset($_SERVER['CONTENT_LENGTH'])) {
$expected = $_SERVER['CONTENT_LENGTH'];
}
- throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )');
+ if ($expected !== "0") {
+ throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )');
+ }
}
// if content length is sent by client:
diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
index f53f13c5687..99317f2bc1c 100644
--- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
@@ -70,6 +70,7 @@ class FilesPlugin extends ServerPlugin {
const HAS_PREVIEW_PROPERTYNAME = '{http://nextcloud.org/ns}has-preview';
const MOUNT_TYPE_PROPERTYNAME = '{http://nextcloud.org/ns}mount-type';
const IS_ENCRYPTED_PROPERTYNAME = '{http://nextcloud.org/ns}is-encrypted';
+ const SHARE_NOTE = '{http://nextcloud.org/ns}note';
/**
* Reference to main server object
@@ -161,6 +162,7 @@ class FilesPlugin extends ServerPlugin {
$server->protectedProperties[] = self::HAS_PREVIEW_PROPERTYNAME;
$server->protectedProperties[] = self::MOUNT_TYPE_PROPERTYNAME;
$server->protectedProperties[] = self::IS_ENCRYPTED_PROPERTYNAME;
+ $server->protectedProperties[] = self::SHARE_NOTE;
// normally these cannot be changed (RFC4918), but we want them modifiable through PROPPATCH
$allowedProperties = ['{DAV:}getetag'];
@@ -359,6 +361,12 @@ class FilesPlugin extends ServerPlugin {
$propFind->handle(self::MOUNT_TYPE_PROPERTYNAME, function () use ($node) {
return $node->getFileInfo()->getMountPoint()->getMountType();
});
+
+ $propFind->handle(self::SHARE_NOTE, function() use ($node, $httpRequest) {
+ return $node->getNoteFromShare(
+ $httpRequest->getRawServerValue('PHP_AUTH_USER')
+ );
+ });
}
if ($node instanceof \OCA\DAV\Connector\Sabre\Node) {
diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php
index 38d0ff57fb2..32ba6c53a0c 100644
--- a/apps/dav/lib/Connector/Sabre/Node.php
+++ b/apps/dav/lib/Connector/Sabre/Node.php
@@ -41,6 +41,8 @@ use OCP\Files\FileInfo;
use OCP\Files\StorageNotAvailableException;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager;
+use OCP\Share;
+use OCP\Share\IShare;
abstract class Node implements \Sabre\DAV\INode {
@@ -291,6 +293,35 @@ abstract class Node implements \Sabre\DAV\INode {
}
/**
+ * @param string $user
+ * @return string
+ */
+ public function getNoteFromShare($user) {
+ if ($user === null) {
+ return '';
+ }
+
+ $types = [
+ Share::SHARE_TYPE_USER,
+ Share::SHARE_TYPE_GROUP,
+ Share::SHARE_TYPE_CIRCLE,
+ Share::SHARE_TYPE_ROOM
+ ];
+
+ foreach ($types as $shareType) {
+ $shares = $this->shareManager->getSharedWith($user, $shareType, $this, -1);
+ foreach ($shares as $share) {
+ $note = $share->getNote();
+ if($share->getShareOwner() !== $user && !empty($note)) {
+ return $note;
+ }
+ }
+ }
+
+ return '';
+ }
+
+ /**
* @return string
*/
public function getDavPermissions() {
diff --git a/apps/files/appinfo/info.xml b/apps/files/appinfo/info.xml
index d6a0959eebe..79926afe83e 100644
--- a/apps/files/appinfo/info.xml
+++ b/apps/files/appinfo/info.xml
@@ -35,10 +35,6 @@
<command>OCA\Files\Command\ScanAppData</command>
</commands>
- <settings>
- <admin>OCA\Files\Settings\Admin</admin>
- </settings>
-
<activity>
<settings>
<setting>OCA\Files\Activity\Settings\FavoriteAction</setting>
diff --git a/apps/files/appinfo/routes.php b/apps/files/appinfo/routes.php
index 06806309cac..b085d79b8c8 100644
--- a/apps/files/appinfo/routes.php
+++ b/apps/files/appinfo/routes.php
@@ -77,11 +77,6 @@ $application->registerRoutes(
'verb' => 'GET',
],
[
- 'name' => 'settings#setMaxUploadSize',
- 'url' => '/settings/maxUpload',
- 'verb' => 'POST',
- ],
- [
'name' => 'ajax#getStorageStats',
'url' => '/ajax/getstoragestats.php',
'verb' => 'GET',
diff --git a/apps/files/composer/composer/autoload_classmap.php b/apps/files/composer/composer/autoload_classmap.php
index b664b3fa227..dd0bea25644 100644
--- a/apps/files/composer/composer/autoload_classmap.php
+++ b/apps/files/composer/composer/autoload_classmap.php
@@ -31,9 +31,7 @@ return array(
'OCA\\Files\\Command\\TransferOwnership' => $baseDir . '/../lib/Command/TransferOwnership.php',
'OCA\\Files\\Controller\\AjaxController' => $baseDir . '/../lib/Controller/AjaxController.php',
'OCA\\Files\\Controller\\ApiController' => $baseDir . '/../lib/Controller/ApiController.php',
- 'OCA\\Files\\Controller\\SettingsController' => $baseDir . '/../lib/Controller/SettingsController.php',
'OCA\\Files\\Controller\\ViewController' => $baseDir . '/../lib/Controller/ViewController.php',
'OCA\\Files\\Helper' => $baseDir . '/../lib/Helper.php',
'OCA\\Files\\Service\\TagService' => $baseDir . '/../lib/Service/TagService.php',
- 'OCA\\Files\\Settings\\Admin' => $baseDir . '/../lib/Settings/Admin.php',
);
diff --git a/apps/files/composer/composer/autoload_static.php b/apps/files/composer/composer/autoload_static.php
index ef1ecdcc0ce..ae748b5d4d8 100644
--- a/apps/files/composer/composer/autoload_static.php
+++ b/apps/files/composer/composer/autoload_static.php
@@ -46,11 +46,9 @@ class ComposerStaticInitFiles
'OCA\\Files\\Command\\TransferOwnership' => __DIR__ . '/..' . '/../lib/Command/TransferOwnership.php',
'OCA\\Files\\Controller\\AjaxController' => __DIR__ . '/..' . '/../lib/Controller/AjaxController.php',
'OCA\\Files\\Controller\\ApiController' => __DIR__ . '/..' . '/../lib/Controller/ApiController.php',
- 'OCA\\Files\\Controller\\SettingsController' => __DIR__ . '/..' . '/../lib/Controller/SettingsController.php',
'OCA\\Files\\Controller\\ViewController' => __DIR__ . '/..' . '/../lib/Controller/ViewController.php',
'OCA\\Files\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php',
'OCA\\Files\\Service\\TagService' => __DIR__ . '/..' . '/../lib/Service/TagService.php',
- 'OCA\\Files\\Settings\\Admin' => __DIR__ . '/..' . '/../lib/Settings/Admin.php',
);
public static function getInitializer(ClassLoader $loader)
diff --git a/apps/files/js/admin.js b/apps/files/js/admin.js
deleted file mode 100644
index 6afd77eb03e..00000000000
--- a/apps/files/js/admin.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2014
- *
- * This file is licensed under the Affero General Public License version 3
- * or later.
- *
- * See the COPYING-README file.
- *
- */
-
-(function() {
- if (!OCA.Files) {
- /**
- * Namespace for the files app
- * @namespace OCA.Files
- */
- OCA.Files = {};
- }
-
- /**
- * @namespace OCA.Files.Admin
- */
- OCA.Files.Admin = {
- initialize: function() {
- $('#submitMaxUpload').on('click', _.bind(this._onClickSubmitMaxUpload, this));
- },
-
- _onClickSubmitMaxUpload: function () {
- OC.msg.startSaving('#maxUploadSizeSettingsMsg');
-
- var request = $.ajax({
- url: OC.generateUrl('/apps/files/settings/maxUpload'),
- type: 'POST',
- data: {
- maxUploadSize: $('#maxUploadSize').val()
- }
- });
-
- request.done(function (data) {
- $('#maxUploadSize').val(data.maxUploadSize);
- OC.msg.finishedSuccess('#maxUploadSizeSettingsMsg', 'Saved');
- });
-
- request.fail(function () {
- OC.msg.finishedError('#maxUploadSizeSettingsMsg', 'Error');
- });
- }
- }
-})();
-
-function switchPublicFolder() {
- var publicEnable = $('#publicEnable').is(':checked');
- // find all radiobuttons of that group
- var sharingaimGroup = $('input:radio[name=sharingaim]');
- $.each(sharingaimGroup, function(index, sharingaimItem) {
- // set all buttons to the correct state
- sharingaimItem.disabled = !publicEnable;
- });
-}
-
-$(document).ready(function() {
- OCA.Files.Admin.initialize();
-
- // Execute the function after loading DOM tree
- switchPublicFolder();
- $('#publicEnable').click(function() {
- // To get rid of onClick()
- switchPublicFolder();
- });
-});
diff --git a/apps/files/lib/Controller/SettingsController.php b/apps/files/lib/Controller/SettingsController.php
deleted file mode 100644
index 0b2dc9c2dd1..00000000000
--- a/apps/files/lib/Controller/SettingsController.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/**
- *
- *
- * @author Roeland Jago Douma <roeland@famdouma.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\Files\Controller;
-
-use OCP\AppFramework\Controller;
-use OCP\AppFramework\Http;
-use OCP\AppFramework\Http\JSONResponse;
-use OCP\IRequest;
-use OCP\Util;
-
-class SettingsController extends Controller {
- public function __construct($appName, IRequest $request) {
- parent::__construct($appName, $request);
- }
-
- /**
- * @param string $maxUploadSize
- * @return JSONResponse
- */
- public function setMaxUploadSize($maxUploadSize) {
- $setMaxSize = \OC_Files::setUploadLimit(Util::computerFileSize($maxUploadSize));
-
- if ($setMaxSize === false) {
- return new JSONResponse([], Http::STATUS_BAD_REQUEST);
- } else {
- return new JSONResponse([
- 'maxUploadSize' => Util::humanFileSize($setMaxSize)
- ]);
- }
- }
-}
diff --git a/apps/files/lib/Settings/Admin.php b/apps/files/lib/Settings/Admin.php
deleted file mode 100644
index 11b66dab846..00000000000
--- a/apps/files/lib/Settings/Admin.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author 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\Files\Settings;
-
-use bantu\IniGetWrapper\IniGetWrapper;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IRequest;
-use OCP\Settings\ISettings;
-use OCP\Util;
-
-class Admin implements ISettings {
-
- /** @var IniGetWrapper */
- private $iniWrapper;
-
- /** @var IRequest */
- private $request;
-
- public function __construct(IniGetWrapper $iniWrapper, IRequest $request) {
- $this->iniWrapper = $iniWrapper;
- $this->request = $request;
- }
-
- /**
- * @return TemplateResponse
- */
- public function getForm() {
- $htaccessWorking = (getenv('htaccessWorking') === 'true');
- $htaccessWritable = is_writable(\OC::$SERVERROOT.'/.htaccess');
- $userIniWritable = is_writable(\OC::$SERVERROOT.'/.user.ini');
-
- $upload_max_filesize = $this->iniWrapper->getBytes('upload_max_filesize');
- $post_max_size = $this->iniWrapper->getBytes('post_max_size');
- $maxUploadFilesize = Util::humanFileSize(min($upload_max_filesize, $post_max_size));
-
- $parameters = [
- 'uploadChangable' => ($htaccessWorking and $htaccessWritable) or $userIniWritable,
- 'uploadMaxFilesize' => $maxUploadFilesize,
- // max possible makes only sense on a 32 bit system
- 'displayMaxPossibleUploadSize' => PHP_INT_SIZE === 4,
- 'maxPossibleUploadSize' => Util::humanFileSize(PHP_INT_MAX),
- ];
-
- return new TemplateResponse('files', 'admin', $parameters, '');
- }
-
- /**
- * @return string the section ID, e.g. 'sharing'
- */
- public function getSection() {
- return 'server';
- }
-
- /**
- * @return int whether the form should be rather on the top or bottom of
- * the admin section. The forms are arranged in ascending order of the
- * priority values. It is required to return a value between 0 and 100.
- *
- * E.g.: 70
- */
- public function getPriority() {
- return 5;
- }
-
-}
diff --git a/apps/files/templates/admin.php b/apps/files/templates/admin.php
deleted file mode 100644
index 1cbb339fee7..00000000000
--- a/apps/files/templates/admin.php
+++ /dev/null
@@ -1,20 +0,0 @@
- <?php OCP\Util::addScript('files', 'admin'); ?>
-
- <div class="section">
- <h2><?php p($l->t('File handling')); ?></h2>
- <label for="maxUploadSize"><?php p($l->t( 'Maximum upload size' )); ?> </label>
- <span id="maxUploadSizeSettingsMsg" class="msg"></span>
- <br />
- <input type="text" name='maxUploadSize' id="maxUploadSize" value='<?php p($_['uploadMaxFilesize']) ?>' <?php if(!$_['uploadChangable']) { p('disabled'); } ?> />
- <?php if($_['displayMaxPossibleUploadSize']):?>
- (<?php p($l->t('max. possible: ')); p($_['maxPossibleUploadSize']) ?>)
- <?php endif;?>
- <input type="hidden" value="<?php p($_['requesttoken']); ?>" name="requesttoken" />
- <?php if($_['uploadChangable']): ?>
- <input type="submit" id="submitMaxUpload"
- value="<?php p($l->t( 'Save' )); ?>"/>
- <p><em><?php p($l->t('With PHP-FPM it might take 5 minutes for changes to be applied.')); ?></em></p>
- <?php else: ?>
- <p><em><?php p($l->t('Missing permissions to edit from here.')); ?></em></p>
- <?php endif; ?>
- </div>
diff --git a/apps/files/tests/Settings/AdminTest.php b/apps/files/tests/Settings/AdminTest.php
deleted file mode 100644
index 027a37d7b2f..00000000000
--- a/apps/files/tests/Settings/AdminTest.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @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\Files\Tests\Settings;
-
-use bantu\IniGetWrapper\IniGetWrapper;
-use OCA\Files\Settings\Admin;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IRequest;
-use OCP\Util;
-use Test\TestCase;
-
-class AdminTest extends TestCase {
- /** @var Admin */
- private $admin;
- /** @var IniGetWrapper */
- private $iniGetWrapper;
- /** @var IRequest */
- private $request;
-
- public function setUp() {
- parent::setUp();
- $this->iniGetWrapper = $this->getMockBuilder('\bantu\IniGetWrapper\IniGetWrapper')->disableOriginalConstructor()->getMock();
- $this->request = $this->getMockBuilder(IRequest::class)->getMock();
- $this->admin = new Admin(
- $this->iniGetWrapper,
- $this->request
- );
- }
-
- public function testGetForm() {
- $htaccessWorking = (getenv('htaccessWorking') == 'true');
- $htaccessWritable = is_writable(\OC::$SERVERROOT.'/.htaccess');
- $userIniWritable = is_writable(\OC::$SERVERROOT.'/.user.ini');
-
- $this->iniGetWrapper
- ->expects($this->at(0))
- ->method('getBytes')
- ->with('upload_max_filesize')
- ->willReturn(1234);
- $this->iniGetWrapper
- ->expects($this->at(1))
- ->method('getBytes')
- ->with('post_max_size')
- ->willReturn(1234);
- $params = [
- 'uploadChangable' => (($htaccessWorking and $htaccessWritable) or $userIniWritable ),
- 'uploadMaxFilesize' => '1 KB',
- 'displayMaxPossibleUploadSize' => PHP_INT_SIZE === 4,
- 'maxPossibleUploadSize' => Util::humanFileSize(PHP_INT_MAX),
- ];
- $expected = new TemplateResponse('files', 'admin', $params, '');
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetSection() {
- $this->assertSame('server', $this->admin->getSection());
- }
-
- public function testGetPriority() {
- $this->assertSame(5, $this->admin->getPriority());
- }
-}
diff --git a/apps/files_external/3rdparty/composer.json b/apps/files_external/3rdparty/composer.json
index 20e4b8a4d38..897234dfce0 100644
--- a/apps/files_external/3rdparty/composer.json
+++ b/apps/files_external/3rdparty/composer.json
@@ -9,6 +9,6 @@
},
"require": {
"icewind/streams": "0.6.1",
- "icewind/smb": "3.1.0"
+ "icewind/smb": "3.1.1"
}
}
diff --git a/apps/files_external/3rdparty/composer.lock b/apps/files_external/3rdparty/composer.lock
index 33c975a7d77..69da480d19f 100644
--- a/apps/files_external/3rdparty/composer.lock
+++ b/apps/files_external/3rdparty/composer.lock
@@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "ea11a8c6e4979d35dd3bdf1f057ef0e8",
+ "content-hash": "dd320be9cd87742d53b4384bf3df9c42",
"packages": [
{
"name": "icewind/smb",
- "version": "v3.1.0",
+ "version": "v3.1.1",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/SMB.git",
- "reference": "db16d4430cb75f0196eaa6377c5766b19f744c8d"
+ "reference": "26b7b8780342d0e61313b464b880d50a2ea898e2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/icewind1991/SMB/zipball/db16d4430cb75f0196eaa6377c5766b19f744c8d",
- "reference": "db16d4430cb75f0196eaa6377c5766b19f744c8d",
+ "url": "https://api.github.com/repos/icewind1991/SMB/zipball/26b7b8780342d0e61313b464b880d50a2ea898e2",
+ "reference": "26b7b8780342d0e61313b464b880d50a2ea898e2",
"shasum": ""
},
"require": {
@@ -46,7 +46,7 @@
}
],
"description": "php wrapper for smbclient and libsmbclient-php",
- "time": "2019-02-06T14:17:35+00:00"
+ "time": "2019-03-04T15:02:42+00:00"
},
{
"name": "icewind/streams",
diff --git a/apps/files_external/3rdparty/composer/autoload_classmap.php b/apps/files_external/3rdparty/composer/autoload_classmap.php
index b92bd22b4f0..9eb83e893bd 100644
--- a/apps/files_external/3rdparty/composer/autoload_classmap.php
+++ b/apps/files_external/3rdparty/composer/autoload_classmap.php
@@ -76,21 +76,6 @@ return array(
'Icewind\\Streams\\PathWrapper' => $vendorDir . '/icewind/streams/src/PathWrapper.php',
'Icewind\\Streams\\RetryWrapper' => $vendorDir . '/icewind/streams/src/RetryWrapper.php',
'Icewind\\Streams\\SeekableWrapper' => $vendorDir . '/icewind/streams/src/SeekableWrapper.php',
- 'Icewind\\Streams\\Tests\\CallbackWrapperTest' => $vendorDir . '/icewind/streams/tests/CallbackWrapperTest.php',
- 'Icewind\\Streams\\Tests\\CountWrapperTest' => $vendorDir . '/icewind/streams/tests/CountWrapperTest.php',
- 'Icewind\\Streams\\Tests\\DirectoryFilter' => $vendorDir . '/icewind/streams/tests/DirectoryFilter.php',
- 'Icewind\\Streams\\Tests\\DirectoryWrapper' => $vendorDir . '/icewind/streams/tests/DirectoryWrapper.php',
- 'Icewind\\Streams\\Tests\\DirectoryWrapperDummy' => $vendorDir . '/icewind/streams/tests/DirectoryWrapper.php',
- 'Icewind\\Streams\\Tests\\DirectoryWrapperNull' => $vendorDir . '/icewind/streams/tests/DirectoryWrapper.php',
- 'Icewind\\Streams\\Tests\\FailWrapper' => $vendorDir . '/icewind/streams/tests/RetryWrapper.php',
- 'Icewind\\Streams\\Tests\\IteratorDirectory' => $vendorDir . '/icewind/streams/tests/IteratorDirectory.php',
- 'Icewind\\Streams\\Tests\\NullWrapperTest' => $vendorDir . '/icewind/streams/tests/NullWrapperTest.php',
- 'Icewind\\Streams\\Tests\\PartialWrapper' => $vendorDir . '/icewind/streams/tests/RetryWrapper.php',
- 'Icewind\\Streams\\Tests\\PathWrapper' => $vendorDir . '/icewind/streams/tests/PathWrapper.php',
- 'Icewind\\Streams\\Tests\\RetryWrapperTest' => $vendorDir . '/icewind/streams/tests/RetryWrapper.php',
- 'Icewind\\Streams\\Tests\\SeekableWrapper' => $vendorDir . '/icewind/streams/tests/SeekableWrapper.php',
- 'Icewind\\Streams\\Tests\\UrlCallBack' => $vendorDir . '/icewind/streams/tests/UrlCallBack.php',
- 'Icewind\\Streams\\Tests\\WrapperTest' => $vendorDir . '/icewind/streams/tests/WrapperTest.php',
'Icewind\\Streams\\Url' => $vendorDir . '/icewind/streams/src/Url.php',
'Icewind\\Streams\\UrlCallback' => $vendorDir . '/icewind/streams/src/UrlCallBack.php',
'Icewind\\Streams\\Wrapper' => $vendorDir . '/icewind/streams/src/Wrapper.php',
diff --git a/apps/files_external/3rdparty/composer/autoload_static.php b/apps/files_external/3rdparty/composer/autoload_static.php
index 6d7ed9d8536..eb2329b2b05 100644
--- a/apps/files_external/3rdparty/composer/autoload_static.php
+++ b/apps/files_external/3rdparty/composer/autoload_static.php
@@ -106,21 +106,6 @@ class ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3
'Icewind\\Streams\\PathWrapper' => __DIR__ . '/..' . '/icewind/streams/src/PathWrapper.php',
'Icewind\\Streams\\RetryWrapper' => __DIR__ . '/..' . '/icewind/streams/src/RetryWrapper.php',
'Icewind\\Streams\\SeekableWrapper' => __DIR__ . '/..' . '/icewind/streams/src/SeekableWrapper.php',
- 'Icewind\\Streams\\Tests\\CallbackWrapperTest' => __DIR__ . '/..' . '/icewind/streams/tests/CallbackWrapperTest.php',
- 'Icewind\\Streams\\Tests\\CountWrapperTest' => __DIR__ . '/..' . '/icewind/streams/tests/CountWrapperTest.php',
- 'Icewind\\Streams\\Tests\\DirectoryFilter' => __DIR__ . '/..' . '/icewind/streams/tests/DirectoryFilter.php',
- 'Icewind\\Streams\\Tests\\DirectoryWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/DirectoryWrapper.php',
- 'Icewind\\Streams\\Tests\\DirectoryWrapperDummy' => __DIR__ . '/..' . '/icewind/streams/tests/DirectoryWrapper.php',
- 'Icewind\\Streams\\Tests\\DirectoryWrapperNull' => __DIR__ . '/..' . '/icewind/streams/tests/DirectoryWrapper.php',
- 'Icewind\\Streams\\Tests\\FailWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/RetryWrapper.php',
- 'Icewind\\Streams\\Tests\\IteratorDirectory' => __DIR__ . '/..' . '/icewind/streams/tests/IteratorDirectory.php',
- 'Icewind\\Streams\\Tests\\NullWrapperTest' => __DIR__ . '/..' . '/icewind/streams/tests/NullWrapperTest.php',
- 'Icewind\\Streams\\Tests\\PartialWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/RetryWrapper.php',
- 'Icewind\\Streams\\Tests\\PathWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/PathWrapper.php',
- 'Icewind\\Streams\\Tests\\RetryWrapperTest' => __DIR__ . '/..' . '/icewind/streams/tests/RetryWrapper.php',
- 'Icewind\\Streams\\Tests\\SeekableWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/SeekableWrapper.php',
- 'Icewind\\Streams\\Tests\\UrlCallBack' => __DIR__ . '/..' . '/icewind/streams/tests/UrlCallBack.php',
- 'Icewind\\Streams\\Tests\\WrapperTest' => __DIR__ . '/..' . '/icewind/streams/tests/WrapperTest.php',
'Icewind\\Streams\\Url' => __DIR__ . '/..' . '/icewind/streams/src/Url.php',
'Icewind\\Streams\\UrlCallback' => __DIR__ . '/..' . '/icewind/streams/src/UrlCallBack.php',
'Icewind\\Streams\\Wrapper' => __DIR__ . '/..' . '/icewind/streams/src/Wrapper.php',
diff --git a/apps/files_external/3rdparty/composer/installed.json b/apps/files_external/3rdparty/composer/installed.json
index ff953699268..b6c0b4d751c 100644
--- a/apps/files_external/3rdparty/composer/installed.json
+++ b/apps/files_external/3rdparty/composer/installed.json
@@ -1,17 +1,17 @@
[
{
"name": "icewind/smb",
- "version": "v3.1.0",
- "version_normalized": "3.1.0.0",
+ "version": "v3.1.1",
+ "version_normalized": "3.1.1.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/SMB.git",
- "reference": "db16d4430cb75f0196eaa6377c5766b19f744c8d"
+ "reference": "26b7b8780342d0e61313b464b880d50a2ea898e2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/icewind1991/SMB/zipball/db16d4430cb75f0196eaa6377c5766b19f744c8d",
- "reference": "db16d4430cb75f0196eaa6377c5766b19f744c8d",
+ "url": "https://api.github.com/repos/icewind1991/SMB/zipball/26b7b8780342d0e61313b464b880d50a2ea898e2",
+ "reference": "26b7b8780342d0e61313b464b880d50a2ea898e2",
"shasum": ""
},
"require": {
@@ -22,7 +22,7 @@
"friendsofphp/php-cs-fixer": "^2.13",
"phpunit/phpunit": "^5.7"
},
- "time": "2019-02-06T14:17:35+00:00",
+ "time": "2019-03-04T15:02:42+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
diff --git a/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Connection.php b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Connection.php
index de0a1de40ee..830f6fb17b0 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Connection.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Connection.php
@@ -66,7 +66,11 @@ class Connection extends RawConnection {
$this->parser->checkConnectionError($promptLine);
$output = [];
- $line = $this->readLine();
+ if (!$this->isPrompt($promptLine)) {
+ $line = $promptLine;
+ } else {
+ $line = $this->readLine();
+ }
if ($line === false) {
$this->unknownError($promptLine);
}
diff --git a/apps/files_external/lib/Command/Notify.php b/apps/files_external/lib/Command/Notify.php
index b859a825c80..556687e6930 100644
--- a/apps/files_external/lib/Command/Notify.php
+++ b/apps/files_external/lib/Command/Notify.php
@@ -2,6 +2,7 @@
/**
* @copyright Copyright (c) 2016 Robin Appelman <robin@icewind.nl>
*
+ * @author Ari Selseng <ari@selseng.net>
* @author Robin Appelman <robin@icewind.nl>
* @author Roeland Jago Douma <roeland@famdouma.nl>
*
@@ -24,6 +25,7 @@
namespace OCA\Files_External\Command;
+use Doctrine\DBAL\Exception\DriverException;
use OC\Core\Command\Base;
use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException;
use OCA\Files_External\Lib\StorageConfig;
@@ -35,6 +37,7 @@ use OCP\Files\Storage\INotifyStorage;
use OCP\Files\Storage\IStorage;
use OCP\Files\StorageNotAvailableException;
use OCP\IDBConnection;
+use OCP\ILogger;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -47,17 +50,15 @@ class Notify extends Base {
private $connection;
/** @var \OCP\DB\QueryBuilder\IQueryBuilder */
private $updateQuery;
+ /** @var ILogger */
+ private $logger;
- function __construct(GlobalStoragesService $globalService, IDBConnection $connection) {
+ function __construct(GlobalStoragesService $globalService, IDBConnection $connection, ILogger $logger) {
parent::__construct();
$this->globalService = $globalService;
$this->connection = $connection;
- // the query builder doesn't really like subqueries with parameters
- $this->updateQuery = $this->connection->prepare(
- 'UPDATE *PREFIX*filecache SET size = -1
- WHERE `path` = ?
- AND `storage` IN (SELECT storage_id FROM *PREFIX*mounts WHERE mount_id = ?)'
- );
+ $this->logger = $logger;
+ $this->updateQuery = $this->getUpdateQuery($this->connection);
}
protected function configure() {
@@ -143,9 +144,9 @@ class Notify extends Base {
$this->logUpdate($change, $output);
}
if ($change instanceof IRenameChange) {
- $this->markParentAsOutdated($mount->getId(), $change->getTargetPath());
+ $this->markParentAsOutdated($mount->getId(), $change->getTargetPath(), $output);
}
- $this->markParentAsOutdated($mount->getId(), $change->getPath());
+ $this->markParentAsOutdated($mount->getId(), $change->getPath(), $output);
});
}
@@ -154,12 +155,21 @@ class Notify extends Base {
return new $class($mount->getBackendOptions());
}
- private function markParentAsOutdated($mountId, $path) {
+ private function markParentAsOutdated($mountId, $path, OutputInterface $output) {
$parent = ltrim(dirname($path), '/');
if ($parent === '.') {
$parent = '';
}
- $this->updateQuery->execute([$parent, $mountId]);
+
+ try {
+ $this->updateQuery->execute([$parent, $mountId]);
+ } catch (DriverException $ex) {
+ $this->logger->logException($ex, ['app' => 'files_external', 'message' => 'Error while trying to mark folder as outdated', 'level' => ILogger::WARN]);
+ $this->connection = $this->reconnectToDatabase($this->connection, $output);
+ $output->writeln('<info>Needed to reconnect to the database</info>');
+ $this->updateQuery = $this->getUpdateQuery($this->connection);
+ $this->updateQuery->execute([$parent, $mountId]);
+ }
}
private function logUpdate(IChange $change, OutputInterface $output) {
@@ -188,6 +198,41 @@ class Notify extends Base {
$output->writeln($text);
}
+ /**
+ * @return \Doctrine\DBAL\Statement
+ */
+ private function getUpdateQuery(IDBConnection $connection) {
+ // the query builder doesn't really like subqueries with parameters
+ return $connection->prepare(
+ 'UPDATE *PREFIX*filecache SET size = -1
+ WHERE `path` = ?
+ AND `storage` IN (SELECT storage_id FROM *PREFIX*mounts WHERE mount_id = ?)'
+ );
+ }
+
+ /**
+ * @return \OCP\IDBConnection
+ */
+ private function reconnectToDatabase(IDBConnection $connection, OutputInterface $output) {
+ try {
+ $connection->close();
+ } catch (\Exception $ex) {
+ $this->logger->logException($ex, ['app' => 'files_external', 'message' => 'Error while disconnecting from DB', 'level' => ILogger::WARN]);
+ $output->writeln("<info>Error while disconnecting from database: {$ex->getMessage()}</info>");
+ }
+ while (!$connection->isConnected()) {
+ try {
+ $connection->connect();
+ } catch (\Exception $ex) {
+ $this->logger->logException($ex, ['app' => 'files_external', 'message' => 'Error while re-connecting to database', 'level' => ILogger::WARN]);
+ $output->writeln("<info>Error while re-connecting to database: {$ex->getMessage()}</info>");
+ sleep(60);
+ }
+ }
+ return $connection;
+ }
+
+
private function selfTest(IStorage $storage, INotifyHandler $notifyHandler, $verbose, OutputInterface $output) {
usleep(100 * 1000); //give time for the notify to start
$storage->file_put_contents('/.nc_test_file.txt', 'test content');
diff --git a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php
index 5a7212a6522..ed859a71976 100644
--- a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php
+++ b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php
@@ -36,8 +36,8 @@ class RetryJob extends Job {
private $jobList;
/** @var string */
private $lookupServer;
- /** @var int how much time should be between two tries (10 minutes) */
- private $interval = 600;
+ /** @var int how much time should be between two, will be increased for each retry */
+ private $interval = 100;
/**
* @param IClientService $clientService
@@ -75,7 +75,7 @@ class RetryJob extends Job {
}
protected function run($argument) {
- if ($argument['retryNo'] === 5 || empty($this->lookupServer)) {
+ if ($this->killBackgroundJob((int)$argument['retryNo'])) {
return;
}
@@ -108,6 +108,27 @@ class RetryJob extends Job {
* @return bool
*/
protected function shouldRun($argument) {
- return !isset($argument['lastRun']) || ((time() - $argument['lastRun']) > $this->interval);
+ $retryNo = (int)$argument['retryNo'];
+ $delay = $this->interval * 6 ** $retryNo;
+ return !isset($argument['lastRun']) || ((time() - $argument['lastRun']) > $delay);
+ }
+
+ /**
+ * check if we should kill the background job
+ *
+ * The lookup server should no longer be contacted if:
+ *
+ * - max retries are reached (set to 5)
+ * - lookup server was disabled by the admin
+ * - no valid lookup server URL given
+ *
+ * @param int $retryCount
+ * @return bool
+ */
+ protected function killBackgroundJob($retryCount) {
+ $maxTriesReached = $retryCount >= 5;
+ $lookupServerDisabled = $this->config->getAppValue('files_sharing', 'lookupServerUploadEnabled', 'yes') !== 'yes';
+
+ return $maxTriesReached || $lookupServerDisabled || empty($this->lookupServer);
}
}
diff --git a/apps/lookup_server_connector/lib/UpdateLookupServer.php b/apps/lookup_server_connector/lib/UpdateLookupServer.php
index 7902ede8816..727dff70cbb 100644
--- a/apps/lookup_server_connector/lib/UpdateLookupServer.php
+++ b/apps/lookup_server_connector/lib/UpdateLookupServer.php
@@ -46,6 +46,8 @@ class UpdateLookupServer {
private $jobList;
/** @var string URL point to lookup server */
private $lookupServer;
+ /** @var bool */
+ private $lookupServerEnabled;
/**
* @param AccountManager $accountManager
@@ -68,6 +70,8 @@ class UpdateLookupServer {
return;
}
+ $this->lookupServerEnabled = $this->config->getAppValue('files_sharing', 'lookupServerUploadEnabled', 'yes') === 'yes';
+
$this->lookupServer = $config->getSystemValue('lookup_server', 'https://lookup.nextcloud.com');
if(!empty($this->lookupServer)) {
$this->lookupServer = rtrim($this->lookupServer, '/');
@@ -79,7 +83,8 @@ class UpdateLookupServer {
* @param IUser $user
*/
public function userUpdated(IUser $user) {
- if(empty($this->lookupServer)) {
+
+ if (!$this->shouldUpdateLookupServer()) {
return;
}
@@ -150,4 +155,17 @@ class UpdateLookupServer {
);
}
}
+
+ /**
+ * check if we should update the lookup server, we only do it if
+ *
+ * * we have a valid URL
+ * * the lookup server update was enabled by the admin
+ *
+ * @return bool
+ */
+ private function shouldUpdateLookupServer() {
+ return $this->lookupServerEnabled || !empty($this->lookupServer);
+ }
+
}
diff --git a/lib/private/IntegrityCheck/Checker.php b/lib/private/IntegrityCheck/Checker.php
index 44544b6770e..0a8876381f4 100644
--- a/lib/private/IntegrityCheck/Checker.php
+++ b/lib/private/IntegrityCheck/Checker.php
@@ -158,8 +158,6 @@ class Checker {
private function generateHashes(\RecursiveIteratorIterator $iterator,
string $path): array {
$hashes = [];
- $copiedWebserverSettingFiles = false;
- $tmpFolder = '';
$baseDirectoryLength = \strlen($path);
foreach($iterator as $filename => $data) {
@@ -180,36 +178,6 @@ class Checker {
continue;
}
- // The .user.ini and the .htaccess file of ownCloud can contain some
- // custom modifications such as for example the maximum upload size
- // to ensure that this will not lead to false positives this will
- // copy the file to a temporary folder and reset it to the default
- // values.
- if($filename === $this->environmentHelper->getServerRoot() . '/.htaccess'
- || $filename === $this->environmentHelper->getServerRoot() . '/.user.ini') {
-
- if(!$copiedWebserverSettingFiles) {
- $tmpFolder = rtrim($this->tempManager->getTemporaryFolder(), '/');
- copy($this->environmentHelper->getServerRoot() . '/.htaccess', $tmpFolder . '/.htaccess');
- copy($this->environmentHelper->getServerRoot() . '/.user.ini', $tmpFolder . '/.user.ini');
- \OC_Files::setUploadLimit(
- \OCP\Util::computerFileSize('511MB'),
- [
- '.htaccess' => $tmpFolder . '/.htaccess',
- '.user.ini' => $tmpFolder . '/.user.ini',
- ]
- );
- }
- }
-
- // The .user.ini file can contain custom modifications to the file size
- // as well.
- if($filename === $this->environmentHelper->getServerRoot() . '/.user.ini') {
- $fileContent = file_get_contents($tmpFolder . '/.user.ini');
- $hashes[$relativeFileName] = hash('sha512', $fileContent);
- continue;
- }
-
// The .htaccess file in the root folder of ownCloud can contain
// custom content after the installation due to the fact that dynamic
// content is written into it at installation time as well. This
@@ -218,7 +186,7 @@ class Checker {
// "#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####" and have the
// hash generated based on this.
if($filename === $this->environmentHelper->getServerRoot() . '/.htaccess') {
- $fileContent = file_get_contents($tmpFolder . '/.htaccess');
+ $fileContent = file_get_contents($filename);
$explodedArray = explode('#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####', $fileContent);
if(\count($explodedArray) === 2) {
$hashes[$relativeFileName] = hash('sha512', $explodedArray[0]);
diff --git a/lib/private/legacy/files.php b/lib/private/legacy/files.php
index 159e18c7754..577392f1edc 100644
--- a/lib/private/legacy/files.php
+++ b/lib/private/legacy/files.php
@@ -379,88 +379,6 @@ class OC_Files {
}
/**
- * set the maximum upload size limit for apache hosts using .htaccess
- *
- * @param int $size file size in bytes
- * @param array $files override '.htaccess' and '.user.ini' locations
- * @return bool|int false on failure, size on success
- */
- public static function setUploadLimit($size, $files = []) {
- //don't allow user to break his config
- $size = (int)$size;
- if ($size < self::UPLOAD_MIN_LIMIT_BYTES) {
- return false;
- }
- $size = OC_Helper::phpFileSize($size);
-
- $phpValueKeys = array(
- 'upload_max_filesize',
- 'post_max_size'
- );
-
- // default locations if not overridden by $files
- $files = array_merge([
- '.htaccess' => OC::$SERVERROOT . '/.htaccess',
- '.user.ini' => OC::$SERVERROOT . '/.user.ini'
- ], $files);
-
- $updateFiles = [
- $files['.htaccess'] => [
- 'pattern' => '/php_value %1$s (\S)*/',
- 'setting' => 'php_value %1$s %2$s'
- ],
- $files['.user.ini'] => [
- 'pattern' => '/%1$s=(\S)*/',
- 'setting' => '%1$s=%2$s'
- ]
- ];
-
- $success = true;
-
- foreach ($updateFiles as $filename => $patternMap) {
- // suppress warnings from fopen()
- $handle = @fopen($filename, 'r+');
- if (!$handle) {
- \OCP\Util::writeLog('files',
- 'Can\'t write upload limit to ' . $filename . '. Please check the file permissions',
- ILogger::WARN);
- $success = false;
- continue; // try to update as many files as possible
- }
-
- $content = '';
- while (!feof($handle)) {
- $content .= fread($handle, 1000);
- }
-
- foreach ($phpValueKeys as $key) {
- $pattern = vsprintf($patternMap['pattern'], [$key]);
- $setting = vsprintf($patternMap['setting'], [$key, $size]);
- $hasReplaced = 0;
- $newContent = preg_replace($pattern, $setting, $content, 2, $hasReplaced);
- if ($newContent !== null) {
- $content = $newContent;
- }
- if ($hasReplaced === 0) {
- $content .= "\n" . $setting;
- }
- }
-
- // write file back
- ftruncate($handle, 0);
- rewind($handle);
- fwrite($handle, $content);
-
- fclose($handle);
- }
-
- if ($success) {
- return OC_Helper::computerFileSize($size);
- }
- return false;
- }
-
- /**
* @param string $dir
* @param $files
* @param integer $getType
diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php
index d9aa22e2935..a5ed3a3e24b 100644
--- a/lib/private/legacy/helper.php
+++ b/lib/private/legacy/helper.php
@@ -87,32 +87,6 @@ class OC_Helper {
}
/**
- * Make a php file size
- * @param int $bytes file size in bytes
- * @return string a php parseable file size
- *
- * Makes 2048 to 2k and 2^41 to 2048G
- */
- public static function phpFileSize($bytes) {
- if ($bytes < 0) {
- return "?";
- }
- if ($bytes < 1024) {
- return $bytes . "B";
- }
- $bytes = round($bytes / 1024, 1);
- if ($bytes < 1024) {
- return $bytes . "K";
- }
- $bytes = round($bytes / 1024, 1);
- if ($bytes < 1024) {
- return $bytes . "M";
- }
- $bytes = round($bytes / 1024, 1);
- return $bytes . "G";
- }
-
- /**
* Make a computer file size
* @param string $str file size in human readable format
* @return float|bool a file size in bytes
diff --git a/tests/data/integritycheck/htaccessWithValidModifiedContent/.htaccess b/tests/data/integritycheck/htaccessWithValidModifiedContent/.htaccess
index e42d92da679..1b5eb98b7f8 100644
--- a/tests/data/integritycheck/htaccessWithValidModifiedContent/.htaccess
+++ b/tests/data/integritycheck/htaccessWithValidModifiedContent/.htaccess
@@ -1,8 +1,5 @@
# Start of valid file
<IfModule mod_php7.c>
- php_value upload_max_filesize 519M
- php_value post_max_size 519M
- php_value memory_limit 512M
php_value mbstring.func_overload 0
php_value always_populate_raw_post_data -1
php_value default_charset 'UTF-8'
diff --git a/tests/data/integritycheck/htaccessWithValidModifiedContent/.user.ini b/tests/data/integritycheck/htaccessWithValidModifiedContent/.user.ini
deleted file mode 100644
index 90959b1e649..00000000000
--- a/tests/data/integritycheck/htaccessWithValidModifiedContent/.user.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-upload_max_filesize=519M
-post_max_size=519M
-memory_limit=512M
-mbstring.func_overload=0
-always_populate_raw_post_data=-1
-default_charset='UTF-8'
-output_buffering=0
diff --git a/tests/lib/FilesTest.php b/tests/lib/FilesTest.php
deleted file mode 100644
index 1d26984ee72..00000000000
--- a/tests/lib/FilesTest.php
+++ /dev/null
@@ -1,137 +0,0 @@
-<?php
-/**
- * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library 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 library. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace Test;
-
-class FilesTest extends \Test\TestCase {
-
- const UPLOAD_LIMIT_DEFAULT_STR = '511M';
- const UPLOAD_LIMIT_SETTING_STR = '2M';
- const UPLOAD_LIMIT_SETTING_BYTES = 2097152;
-
- /** @var array $tmpDirs */
- private $tmpDirs = [];
-
- /**
- * @return array
- */
- private function getUploadLimitTestFiles() {
- $dir = \OC::$server->getTempManager()->getTemporaryFolder();
- $this->tmpDirs[] = $dir;
- $result = [
- '.htaccess' => $dir . '/htaccess',
- '.user.ini' => $dir . '/user.ini'
- ];
- copy(\OC::$SERVERROOT . '/tests/data/setUploadLimit/htaccess', $result['.htaccess']);
- copy(\OC::$SERVERROOT . '/tests/data/setUploadLimit/user.ini', $result['.user.ini']);
- return $result;
- }
-
- protected function tearDown() {
- foreach ($this->tmpDirs as $dir) {
- \OC_Helper::rmdirr($dir);
- }
- parent::tearDown();
- }
-
- public function testSetUploadLimitSizeSanity() {
- $this->assertFalse(\OC_Files::setUploadLimit(PHP_INT_MAX + 10));
- $this->assertFalse(\OC_Files::setUploadLimit(\OC_Files::UPLOAD_MIN_LIMIT_BYTES - 10));
- $this->assertFalse(\OC_Files::setUploadLimit('foobar'));
- }
-
- public function setUploadLimitWriteProvider() {
- return [
- [
- // both files writable
- true, true,
- self::UPLOAD_LIMIT_SETTING_BYTES, self::UPLOAD_LIMIT_SETTING_BYTES,
- self::UPLOAD_LIMIT_SETTING_STR, self::UPLOAD_LIMIT_SETTING_STR
- ],
- [
- // neither file writable
- false, false,
- self::UPLOAD_LIMIT_SETTING_BYTES, false,
- self::UPLOAD_LIMIT_DEFAULT_STR, self::UPLOAD_LIMIT_DEFAULT_STR
- ],
- [
- // only .htaccess writable
- true, false,
- self::UPLOAD_LIMIT_SETTING_BYTES, false,
- self::UPLOAD_LIMIT_SETTING_STR, self::UPLOAD_LIMIT_DEFAULT_STR
- ],
- [
- // only .user.ini writable
- false, true,
- self::UPLOAD_LIMIT_SETTING_BYTES, false,
- self::UPLOAD_LIMIT_DEFAULT_STR, self::UPLOAD_LIMIT_SETTING_STR
- ],
- [
- // test rounding of values
- true, true,
- self::UPLOAD_LIMIT_SETTING_BYTES + 20, self::UPLOAD_LIMIT_SETTING_BYTES,
- self::UPLOAD_LIMIT_SETTING_STR, self::UPLOAD_LIMIT_SETTING_STR
- ]
- ];
- }
-
- /**
- * @dataProvider setUploadLimitWriteProvider
- */
- public function testSetUploadLimitWrite(
- $htaccessWritable, $userIniWritable,
- $setSize, $expectedSize,
- $htaccessStr, $userIniStr
- ) {
- $this->markTestSkipped('TODO: Disable because fails on drone');
-
- $files = $this->getUploadLimitTestFiles();
- chmod($files['.htaccess'], ($htaccessWritable ? 0644 : 0444));
- chmod($files['.user.ini'], ($userIniWritable ? 0644 : 0444));
-
- $htaccessSize = filesize($files['.htaccess']);
- $userIniSize = filesize($files['.user.ini']);
- $htaccessSizeMod = 2*(strlen($htaccessStr) - strlen(self::UPLOAD_LIMIT_DEFAULT_STR));
- $userIniSizeMod = 2*(strlen($userIniStr) - strlen(self::UPLOAD_LIMIT_DEFAULT_STR));
-
- $this->assertEquals($expectedSize, \OC_Files::setUploadLimit($setSize, $files));
-
- // check file contents
- $htaccess = file_get_contents($files['.htaccess']);
- $this->assertEquals(1,
- preg_match('/php_value upload_max_filesize '.$htaccessStr.'/', $htaccess)
- );
- $this->assertEquals(1,
- preg_match('/php_value post_max_size '.$htaccessStr.'/', $htaccess)
- );
- $this->assertEquals($htaccessSize + $htaccessSizeMod, filesize($files['.htaccess']));
-
- $userIni = file_get_contents($files['.user.ini']);
- $this->assertEquals(1,
- preg_match('/upload_max_filesize='.$userIniStr.'/', $userIni)
- );
- $this->assertEquals(1,
- preg_match('/post_max_size='.$userIniStr.'/', $userIni)
- );
- $this->assertEquals($userIniSize + $userIniSizeMod, filesize($files['.user.ini']));
- }
-}
diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php
index d0a40a7ad93..91d1fa36758 100644
--- a/tests/lib/IntegrityCheck/CheckerTest.php
+++ b/tests/lib/IntegrityCheck/CheckerTest.php
@@ -624,14 +624,13 @@ class CheckerTest extends TestCase {
$this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent/');
}
- public function testWriteCoreSignatureWithValidModifiedHtaccessAndUserIni() {
+ public function testWriteCoreSignatureWithValidModifiedHtaccess() {
$expectedSignatureFileData = '{
"hashes": {
- ".htaccess": "04d8d8eaa5893d2c30df955ff25d8f75e4ee7eb7d24f7f28b47e7b1d0cce2c339db47debf8de8c80b3d25b5da4da50128720564a30ad1af8d7106d48e6f07ae8",
- ".user.ini": "467d4f028c447895716a2b7859ed6e569f8ee34b87b51d73dab2e6a9ca4fbe63172c7be3e365ae864a60408286afcce852dd38ee544b61685ed4ee5e021fecb0",
+ ".htaccess": "7e6a7a4d8ee4f3fbc45dd579407c643471575a9d127d1c75f6d0a49e80766c3c587104b2139ef76d2a4bffce3f45777900605aaa49519c9532909b71e5030227",
"subfolder\/.htaccess": "2c57b1e25050e11dc3ae975832f378c452159f7b69f818e47eeeafadd6ba568517461dcb4d843b90b906cd7c89d161bc1b89dff8e3ae0eb6f5088508c47befd1"
},
- "signature": "HpDOx2nLrquRkez2BINtfAOyStlzxWKrE8NJtNdj9ZkSA4iV9GVhgnw6e38jH5Ql+mf+d+r5xM0WRgByTul3Z+9gvtv7huAYLSumwxF4g8u42Q3zC+iB6H8nurea7TQy6WOkDl9XSxXv79DqpDsd3kvLTQi4JpYt\/bI8UXo9jcfB13Yp6s4tQLbCLwLcPxGCAifviB+cHsCGvu01ewyVIFSbLeOaIgAxujXZyodDPJCKPLd5ctKfy4t9YHrCG3HYTh\/HdT3N1gJ62tCJDj+EjwpnIdxSl3aAR8wXyxCvhoGxUNe8pvT8Q9TiI5t+eSjZ8wh+4AavA9lFLipukRO\/ZElSj55nsuRPS8PhszN6Ph57mNX1pIKhgaCp6ERhmD3PGsPQAK9Ymj4j6RCJZ06Cj6+ck4Vs+FJSmvVfz2FLleGBM6tfXgHDvbSPebq9zFukCSID7K1p0p07qu4Z1uuZI9Jycgh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jgu6hIrR9IuxOBLQUxGTRZyAcXvj7obqRAEZwFAKQgFpfpqTb\r\nH+kjcbZSaAlLVSF7vBc1syyI8RGYbqpwvtREqJtl5IEIwe6huEqJ3zPnlP2th\/55\r\ncf3Fovj6JJgbb9XFxrdnsOsDOu\/tpnaRWlvv5ib4+SzG5wWFT5UUEo4Wg2STQiiX\r\nuVSRQxK1LE1yg84bs3NZk9FSQh4B8vZVuRr5FaJsZZkwlFlhRO\/\/+TJtXRbyNgsf\r\noMRZGi8DLGU2SGEAHcRH\/QZHq\/XDUWVzdxrSBYcy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
}';
$this->environmentHelper
@@ -721,7 +720,7 @@ class CheckerTest extends TestCase {
$this->assertSame([], $this->checker->verifyCoreSignature());
}
- public function testVerifyCoreSignatureWithValidModifiedHtaccessAndUserIniSignatureData() {
+ public function testVerifyCoreSignatureWithValidModifiedHtaccessSignatureData() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
@@ -738,11 +737,10 @@ class CheckerTest extends TestCase {
->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent'));
$signatureDataFile = '{
"hashes": {
- ".htaccess": "04d8d8eaa5893d2c30df955ff25d8f75e4ee7eb7d24f7f28b47e7b1d0cce2c339db47debf8de8c80b3d25b5da4da50128720564a30ad1af8d7106d48e6f07ae8",
- ".user.ini": "467d4f028c447895716a2b7859ed6e569f8ee34b87b51d73dab2e6a9ca4fbe63172c7be3e365ae864a60408286afcce852dd38ee544b61685ed4ee5e021fecb0",
+ ".htaccess": "7e6a7a4d8ee4f3fbc45dd579407c643471575a9d127d1c75f6d0a49e80766c3c587104b2139ef76d2a4bffce3f45777900605aaa49519c9532909b71e5030227",
"subfolder\/.htaccess": "2c57b1e25050e11dc3ae975832f378c452159f7b69f818e47eeeafadd6ba568517461dcb4d843b90b906cd7c89d161bc1b89dff8e3ae0eb6f5088508c47befd1"
},
- "signature": "HpDOx2nLrquRkez2BINtfAOyStlzxWKrE8NJtNdj9ZkSA4iV9GVhgnw6e38jH5Ql+mf+d+r5xM0WRgByTul3Z+9gvtv7huAYLSumwxF4g8u42Q3zC+iB6H8nurea7TQy6WOkDl9XSxXv79DqpDsd3kvLTQi4JpYt\/bI8UXo9jcfB13Yp6s4tQLbCLwLcPxGCAifviB+cHsCGvu01ewyVIFSbLeOaIgAxujXZyodDPJCKPLd5ctKfy4t9YHrCG3HYTh\/HdT3N1gJ62tCJDj+EjwpnIdxSl3aAR8wXyxCvhoGxUNe8pvT8Q9TiI5t+eSjZ8wh+4AavA9lFLipukRO\/ZElSj55nsuRPS8PhszN6Ph57mNX1pIKhgaCp6ERhmD3PGsPQAK9Ymj4j6RCJZ06Cj6+ck4Vs+FJSmvVfz2FLleGBM6tfXgHDvbSPebq9zFukCSID7K1p0p07qu4Z1uuZI9JycghrWoVchQYjx1GndizTSaa55JtVY\/c1yLSHXBXlxt7M8Dc26vvGW+Dpn2aVtoG2N0eigyY7KMukgsBy9jUqEI7094kxtdIaCew7lLf0lRqpKEc+RweR+ielfpP+2r3hmVLYHQ+6Cbroht8clfbkEYpRBOGwf9Bg+uqdDqS6EIhKtFE0wp7QzRSiqGT3\/wiS\/UqM5MV1BM3R5JWRH54=",
+ "signature": "YVwQvl9Dh8UebCumfgzFxfz3NiZJLmYG8oJVTfEBhulI4KXBnTG1jZTprf4XxG2XIriEYAZXsoXpu9xWsUFe9QfdncwoEpqJtGq7l6aVDTofX5Be5b03MQFJr4cflgllqW77QZ84D9O9qWF\/v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ZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
}';
$this->fileAccessHelper
diff --git a/tests/lib/LegacyHelperTest.php b/tests/lib/LegacyHelperTest.php
index 76f38706b4c..96cd190fd62 100644
--- a/tests/lib/LegacyHelperTest.php
+++ b/tests/lib/LegacyHelperTest.php
@@ -47,28 +47,6 @@ class LegacyHelperTest extends \Test\TestCase {
}
/**
- * @dataProvider phpFileSizeProvider
- */
- public function testPhpFileSize($expected, $input)
- {
- $result = OC_Helper::phpFileSize($input);
- $this->assertEquals($expected, $result);
- }
-
- public function phpFileSizeProvider()
- {
- return array(
- array('0B', 0),
- array('1K', 1024),
- array('9.5M', 10000000),
- array('1.3G', 1395864371),
- array('465.7G', 500000000000),
- array('465661.3G', 500000000000000),
- array('465661287.3G', 500000000000000000),
- );
- }
-
- /**
* @dataProvider providesComputerFileSize
*/
function testComputerFileSize($expected, $input) {