summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-02-28 11:05:28 +0100
committerMorris Jobke <hey@morrisjobke.de>2019-03-04 12:14:22 +0100
commitc6a69ba92514587814d0f03b51e1d1f026a49350 (patch)
treeb7162fff445ea0595280b535b95a60b689f742dd /apps
parent814bf0de20b05ef44d4558d49cc3dc655da1c58d (diff)
downloadnextcloud-server-c6a69ba92514587814d0f03b51e1d1f026a49350.tar.gz
nextcloud-server-c6a69ba92514587814d0f03b51e1d1f026a49350.zip
Remove the upload and memory setting
* Remove unneeded private method phpFileSize() * Bump autoloader * Remove setUploadLimit tests * Remove integrity check hacks for upload limit Signed-off-by: Joas Schilling <coding@schilljs.com> Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps')
-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
9 files changed, 0 insertions, 325 deletions
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());
- }
-}