diff options
34 files changed, 263 insertions, 300 deletions
diff --git a/.htaccess b/.htaccess index df074f7f806..5bf7b321f0c 100644 --- a/.htaccess +++ b/.htaccess @@ -59,23 +59,6 @@ RewriteRule ^(build|tests|config|lib|3rdparty|templates)/.* - [R=404,L] RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.* RewriteRule ^(\.|autotest|occ|issue|indie|db_|console).* - [R=404,L] - - # Rewrite rules for `front_controller_active` - Options -MultiViews - RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1] - RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1] - RewriteCond %{REQUEST_FILENAME} !\.(css|js|svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ - RewriteCond %{REQUEST_FILENAME} !core/img/favicon.ico$ - RewriteCond %{REQUEST_FILENAME} !/remote.php - RewriteCond %{REQUEST_FILENAME} !/public.php - RewriteCond %{REQUEST_FILENAME} !/cron.php - RewriteCond %{REQUEST_FILENAME} !/core/ajax/update.php - RewriteCond %{REQUEST_FILENAME} !/status.php - RewriteCond %{REQUEST_FILENAME} !/ocs/v1.php - RewriteCond %{REQUEST_FILENAME} !/ocs/v2.php - RewriteCond %{REQUEST_FILENAME} !/updater/ - RewriteCond %{REQUEST_FILENAME} !/ocs-provider/ - RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.* </IfModule> <IfModule mod_mime.c> AddType image/svg+xml svg svgz diff --git a/apps/files/l10n/en@pirate.js b/apps/files/l10n/en@pirate.js deleted file mode 100644 index 5c456a089fe..00000000000 --- a/apps/files/l10n/en@pirate.js +++ /dev/null @@ -1,6 +0,0 @@ -OC.L10N.register( - "files", - { - "Download" : "Download" -}, -"nplurals=2; plural=(n != 1);"); diff --git a/apps/files/l10n/en@pirate.json b/apps/files/l10n/en@pirate.json deleted file mode 100644 index a8fb4073298..00000000000 --- a/apps/files/l10n/en@pirate.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "translations": { - "Download" : "Download" -},"pluralForm" :"nplurals=2; plural=(n != 1);" -}
\ No newline at end of file diff --git a/apps/files_external/l10n/en@pirate.js b/apps/files_external/l10n/en@pirate.js deleted file mode 100644 index 7345429f750..00000000000 --- a/apps/files_external/l10n/en@pirate.js +++ /dev/null @@ -1,6 +0,0 @@ -OC.L10N.register( - "files_external", - { - "Password" : "Secret Code" -}, -"nplurals=2; plural=(n != 1);"); diff --git a/apps/files_external/l10n/en@pirate.json b/apps/files_external/l10n/en@pirate.json deleted file mode 100644 index bde5153f309..00000000000 --- a/apps/files_external/l10n/en@pirate.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "translations": { - "Password" : "Secret Code" -},"pluralForm" :"nplurals=2; plural=(n != 1);" -}
\ No newline at end of file diff --git a/apps/files_sharing/l10n/en@pirate.js b/apps/files_sharing/l10n/en@pirate.js deleted file mode 100644 index 84e0fabadc6..00000000000 --- a/apps/files_sharing/l10n/en@pirate.js +++ /dev/null @@ -1,7 +0,0 @@ -OC.L10N.register( - "files_sharing", - { - "Password" : "Secret Code", - "Download" : "Download" -}, -"nplurals=2; plural=(n != 1);"); diff --git a/apps/files_sharing/l10n/en@pirate.json b/apps/files_sharing/l10n/en@pirate.json deleted file mode 100644 index ec5b5f4b272..00000000000 --- a/apps/files_sharing/l10n/en@pirate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ "translations": { - "Password" : "Secret Code", - "Download" : "Download" -},"pluralForm" :"nplurals=2; plural=(n != 1);" -}
\ No newline at end of file diff --git a/apps/files_sharing/tests/etagpropagation.php b/apps/files_sharing/tests/etagpropagation.php index 55972dd9221..67c5410dc80 100644 --- a/apps/files_sharing/tests/etagpropagation.php +++ b/apps/files_sharing/tests/etagpropagation.php @@ -126,7 +126,8 @@ class EtagPropagation extends PropagationTestCase { public function testOwnerWritesToSingleFileShare() { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::file_put_contents('/foo.txt', 'longer_bar'); - Filesystem::touch('/foo.txt', time() - 1); + $t = (int)Filesystem::filemtime('/foo.txt') - 1; + Filesystem::touch('/foo.txt', $t); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4, self::TEST_FILES_SHARING_API_USER3]); $this->assertEtagsChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2]); diff --git a/apps/user_ldap/l10n/en@pirate.js b/apps/user_ldap/l10n/en@pirate.js deleted file mode 100644 index 0670deb5fbc..00000000000 --- a/apps/user_ldap/l10n/en@pirate.js +++ /dev/null @@ -1,6 +0,0 @@ -OC.L10N.register( - "user_ldap", - { - "Password" : "Passcode" -}, -"nplurals=2; plural=(n != 1);"); diff --git a/apps/user_ldap/l10n/en@pirate.json b/apps/user_ldap/l10n/en@pirate.json deleted file mode 100644 index 6f74658eb82..00000000000 --- a/apps/user_ldap/l10n/en@pirate.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "translations": { - "Password" : "Passcode" -},"pluralForm" :"nplurals=2; plural=(n != 1);" -}
\ No newline at end of file diff --git a/autotest.sh b/autotest.sh index ba6ec383866..1fa9df18d75 100755 --- a/autotest.sh +++ b/autotest.sh @@ -239,7 +239,7 @@ function execute_tests { # Try to connect to the OCI host via sqlplus to ensure that the connection is already running for i in {1..48} do - if sqlplus "system/oracle@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=$DATABASEHOST)(Port=1521))(CONNECT_DATA=(SID=XE)))" < /dev/null | grep 'Connected to'; then + if sqlplus "autotest/owncloud@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=$DATABASEHOST)(Port=1521))(CONNECT_DATA=(SID=XE)))" < /dev/null | grep 'Connected to'; then break; fi sleep 5 diff --git a/config/config.sample.php b/config/config.sample.php index 4321e5bab83..2bc19098877 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -362,6 +362,31 @@ $CONFIG = array( 'overwrite.cli.url' => '', /** + * To have clean URLs without `/index.php` this parameter needs to be configured. + * + * This parameter will be written as "RewriteBase" on update and installation of + * ownCloud to your `.htaccess` file. While this value is often simply the URL + * path of the ownCloud installation it cannot be set automatically properly in + * every scenario and needs thus some manual configuration. + * + * In a standard Apache setup this usually equals the folder that ownCloud is + * accessible at. So if ownCloud is accessible via "https://mycloud.org/owncloud" + * the correct value would most likely be "/owncloud". If ownCloud is running + * under "https://mycloud.org/" then it would be "/". + * + * Note that above rule is not valid in every case, there are some rare setup + * cases where this may not apply. However, to avoid any update problems this + * configuration value is explicitly opt-in. + * + * After setting this value run `occ maintenance:update:htaccess` and when following + * conditions are met ownCloud uses URLs without index.php in it: + * + * - `mod_rewrite` is installed + * - `mod_env` is installed + */ +'htaccess.RewriteBase' => '/', + +/** * The URL of your proxy server, for example ``proxy.example.com:8081``. */ 'proxy' => '', @@ -472,6 +497,11 @@ $CONFIG = array( 'updatechecker' => true, /** + * URL that ownCloud should use to look for updates + */ +'updater.server.url' => 'https://updates.owncloud.com/server/', + +/** * Is ownCloud connected to the Internet or running in a closed network? */ 'has_internet_connection' => true, diff --git a/console.php b/console.php index 72f961515d7..fc571b03f1e 100644 --- a/console.php +++ b/console.php @@ -79,6 +79,10 @@ try { exit(1); } + if (!function_exists('pcntl_signal') && !in_array('--no-warnings', $argv)) { + echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php" . PHP_EOL; + } + $application = new Application(\OC::$server->getConfig(), \OC::$server->getEventDispatcher(), \OC::$server->getRequest()); $application->loadCommands(new ArgvInput(), new ConsoleOutput()); $application->run(); diff --git a/core/command/maintenance/updatehtaccess.php b/core/command/maintenance/updatehtaccess.php new file mode 100644 index 00000000000..ad5bf5d8bde --- /dev/null +++ b/core/command/maintenance/updatehtaccess.php @@ -0,0 +1,44 @@ +<?php +/** + * @author Lukas Reschke <lukas@owncloud.com> + * + * @copyright Copyright (c) 2016, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * 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, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ +namespace OC\Core\Command\Maintenance; + +use InvalidArgumentException; +use OC\Setup; +use OCP\IConfig; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +class UpdateHtaccess extends Command { + + protected function configure() { + $this + ->setName('maintenance:update:htaccess') + ->setDescription('Updates the .htaccess file'); + } + + protected function execute(InputInterface $input, OutputInterface $output) { + \OC\Setup::updateHtaccess(); + $output->writeln('.htaccess has been updated'); + return 0; + } +} diff --git a/core/l10n/en@pirate.js b/core/l10n/en@pirate.js deleted file mode 100644 index adc62c8c962..00000000000 --- a/core/l10n/en@pirate.js +++ /dev/null @@ -1,6 +0,0 @@ -OC.L10N.register( - "core", - { - "Password" : "Passcode" -}, -"nplurals=2; plural=(n != 1);"); diff --git a/core/l10n/en@pirate.json b/core/l10n/en@pirate.json deleted file mode 100644 index 6f74658eb82..00000000000 --- a/core/l10n/en@pirate.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "translations": { - "Password" : "Passcode" -},"pluralForm" :"nplurals=2; plural=(n != 1);" -}
\ No newline at end of file diff --git a/core/register_command.php b/core/register_command.php index e06ff436f50..b074339f4c3 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -113,6 +113,7 @@ if (\OC::$server->getConfig()->getSystemValue('installed', false)) { $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig())); $application->add(new OC\Core\Command\Maintenance\Repair(new \OC\Repair(\OC\Repair::getRepairSteps()), \OC::$server->getConfig())); $application->add(new OC\Core\Command\Maintenance\SingleUser(\OC::$server->getConfig())); + $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess()); $application->add(new OC\Core\Command\Upgrade( \OC::$server->getConfig(), diff --git a/lib/l10n/en@pirate.js b/lib/l10n/en@pirate.js deleted file mode 100644 index ade0ad04df4..00000000000 --- a/lib/l10n/en@pirate.js +++ /dev/null @@ -1,6 +0,0 @@ -OC.L10N.register( - "lib", - { - "web services under your control" : "web services under your control" -}, -"nplurals=2; plural=(n != 1);"); diff --git a/lib/l10n/en@pirate.json b/lib/l10n/en@pirate.json deleted file mode 100644 index 8bbc4280fae..00000000000 --- a/lib/l10n/en@pirate.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "translations": { - "web services under your control" : "web services under your control" -},"pluralForm" :"nplurals=2; plural=(n != 1);" -}
\ No newline at end of file diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php index ec9b537a358..a72a63e076f 100644 --- a/lib/private/files/filesystem.php +++ b/lib/private/files/filesystem.php @@ -58,6 +58,7 @@ namespace OC\Files; +use OC\Cache\CappedMemoryCache; use OC\Files\Config\MountProviderCollection; use OC\Files\Mount\MountPoint; use OC\Files\Storage\StorageFactory; @@ -81,7 +82,7 @@ class Filesystem { static private $usersSetup = array(); - static private $normalizedPathCache = array(); + static private $normalizedPathCache = null; static private $listeningForProviders = false; @@ -794,6 +795,10 @@ class Filesystem { * @return string */ public static function normalizePath($path, $stripTrailingSlash = true, $isAbsolutePath = false) { + if (is_null(self::$normalizedPathCache)) { + self::$normalizedPathCache = new CappedMemoryCache(); + } + /** * FIXME: This is a workaround for existing classes and files which call * this function with another type than a valid string. This diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 4421a016356..02c12c80a20 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -726,7 +726,7 @@ class View { $result = false; } // moving a file/folder within the same mount point - } elseif ($storage1 == $storage2) { + } elseif ($storage1 === $storage2) { if ($storage1) { $result = $storage1->rename($internalPath1, $internalPath2); } else { diff --git a/lib/private/repair.php b/lib/private/repair.php index 63b569b2ed3..c1f94562de5 100644 --- a/lib/private/repair.php +++ b/lib/private/repair.php @@ -31,9 +31,9 @@ namespace OC; use OC\Hooks\BasicEmitter; use OC\Hooks\Emitter; use OC\Repair\AssetCache; -use OC\Repair\BrokenUpdaterRepair; use OC\Repair\CleanTags; use OC\Repair\Collation; +use OC\Repair\CopyRewriteBaseToConfig; use OC\Repair\DropOldJobs; use OC\Repair\OldGroupMembershipShares; use OC\Repair\RemoveGetETagEntries; @@ -115,7 +115,6 @@ class Repair extends BasicEmitter { new RemoveGetETagEntries(\OC::$server->getDatabaseConnection()), new UpdateOutdatedOcsIds(\OC::$server->getConfig()), new RepairInvalidShares(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()), - new BrokenUpdaterRepair(), ]; } @@ -144,6 +143,7 @@ class Repair extends BasicEmitter { new Collation(\OC::$server->getConfig(), $connection), new SqliteAutoincrement($connection), new SearchLuceneTables(), + new CopyRewriteBaseToConfig(\OC::$server->getConfig()), ]; //There is no need to delete all previews on every single update diff --git a/lib/private/repair/brokenupdaterrepair.php b/lib/private/repair/brokenupdaterrepair.php deleted file mode 100644 index 0e4431f6ba3..00000000000 --- a/lib/private/repair/brokenupdaterrepair.php +++ /dev/null @@ -1,110 +0,0 @@ -<?php -/** - * @author Lukas Reschke <lukas@owncloud.com> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * 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, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OC\Repair; - -use OC\Hooks\BasicEmitter; - -/** - * Class BrokenUpdaterRepair fixes some issues caused by bugs in the ownCloud - * updater below version 9.0.2. - * - * FIXME: This file should be removed after the 9.0.2 release. The update server - * is instructed to deliver 9.0.2 for 9.0.0 and 9.0.1. - * - * @package OC\Repair - */ -class BrokenUpdaterRepair extends BasicEmitter implements \OC\RepairStep { - - public function getName() { - return 'Manually copies the third-party folder changes since 9.0.0 due ' . - 'to a bug in the updater.'; - } - - /** - * Manually copy the third-party files that have changed since 9.0.0 because - * the old updater does not copy over third-party changes. - * - * @return bool True if action performed, false otherwise - */ - private function manuallyCopyThirdPartyFiles() { - $resourceDir = __DIR__ . '/../../../resources/updater-fixes/'; - $thirdPartyDir = __DIR__ . '/../../../3rdparty/'; - - $filesToCopy = [ - // Composer updates - 'composer.json', - 'composer.lock', - 'composer/autoload_classmap.php', - 'composer/installed.json', - 'composer/LICENSE', - // Icewind stream library - 'icewind/streams/src/DirectoryFilter.php', - 'icewind/streams/src/DirectoryWrapper.php', - 'icewind/streams/src/RetryWrapper.php', - 'icewind/streams/src/SeekableWrapper.php', - // Sabre update - 'sabre/dav/CHANGELOG.md', - 'sabre/dav/composer.json', - 'sabre/dav/lib/CalDAV/Plugin.php', - 'sabre/dav/lib/CardDAV/Backend/PDO.php', - 'sabre/dav/lib/DAV/CorePlugin.php', - 'sabre/dav/lib/DAV/Version.php', - ]; - - // Check the hash for the autoload_classmap.php file, if the hash does match - // the expected value then the third-party folder has already been copied - // properly. - if(hash_file('sha512', $thirdPartyDir . '/composer/autoload_classmap.php') === 'abe09be19b6d427283cbfa7c4156d2c342cd9368d7d0564828a00ae02c435b642e7092cef444f94635f370dbe507eb6b2aa05109b32d8fb5d8a65c3a5a1c658f') { - $this->emit('\OC\Repair', 'info', ['Third-party files seem already to have been copied. No repair necessary.']); - return false; - } - - foreach($filesToCopy as $file) { - $state = copy($resourceDir . '/' . $file, $thirdPartyDir . '/' . $file); - if($state === true) { - $this->emit('\OC\Repair', 'info', ['Successfully replaced '.$file.' with new version.']); - } else { - $this->emit('\OC\Repair', 'warning', ['Could not replace '.$file.' with new version.']); - } - } - return true; - } - - /** - * Rerun the integrity check after the update since the repair step has - * repaired some invalid copied files. - */ - private function recheckIntegrity() { - \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); - } - - public function run() { - if($this->manuallyCopyThirdPartyFiles()) { - $this->emit('\OC\Repair', 'info', ['Start integrity recheck.']); - $this->recheckIntegrity(); - $this->emit('\OC\Repair', 'info', ['Finished integrity recheck.']); - } else { - $this->emit('\OC\Repair', 'info', ['Rechecking code integrity not necessary.']); - } - } -} - diff --git a/lib/private/repair/copyrewritebasetoconfig.php b/lib/private/repair/copyrewritebasetoconfig.php new file mode 100644 index 00000000000..e5e03f9d437 --- /dev/null +++ b/lib/private/repair/copyrewritebasetoconfig.php @@ -0,0 +1,89 @@ +<?php +/** + * @author Lukas Reschke <lukas@owncloud.com> + * + * @copyright Copyright (c) 2016, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * 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, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OC\Repair; + +use OC\Hooks\BasicEmitter; +use OC\RepairStep; +use OCP\IConfig; + +/** + * Class CopyRewriteBaseToConfig + * + * @package OC\Repair + */ +class CopyRewriteBaseToConfig extends BasicEmitter implements RepairStep { + /** @var IConfig */ + private $config; + + /** + * @param IConfig $config + */ + public function __construct(IConfig $config) { + $this->config = $config; + } + + /** + * {@inheritdoc} + */ + public function getName() { + return 'Copy the rewrite base to the config file'; + } + + /** + * {@inheritdoc} + */ + public function run() { + $ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0'); + + $versionsToApplyFrom = [ + '9.0.0.19', + '9.0.1.3', + '9.0.2.2', + ]; + + if(in_array($ocVersionFromBeforeUpdate, $versionsToApplyFrom, true)) { + // For CLI read the value from overwrite.cli.url + if(\OC::$CLI) { + $webRoot = $this->config->getSystemValue('overwrite.cli.url', ''); + if($webRoot === '') { + return; + } + $webRoot = parse_url($webRoot, PHP_URL_PATH); + $webRoot = rtrim($webRoot, '/'); + } else { + $webRoot = !empty(\OC::$WEBROOT) ? \OC::$WEBROOT : '/'; + } + + // ownCloud may be configured to live at the root folder without a + // trailing slash being specified. In this case manually set the + // rewrite base to `/` + $rewriteBase = $webRoot; + if($webRoot === '') { + $rewriteBase = '/'; + } + + $this->config->setSystemValue('htaccess.RewriteBase', $rewriteBase); + \OC\Setup::updateHtaccess(); + } + + } +} diff --git a/lib/private/setup.php b/lib/private/setup.php index 196ae8a8bce..a38f594ff7f 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -420,37 +420,47 @@ class Setup { $htaccessContent = file_get_contents($setupHelper->pathToHtaccess()); $content = "#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####\n"; - if(strpos($htaccessContent, $content) === false) { - //custom 403 error page - $content.= "\nErrorDocument 403 ".$webRoot."/core/templates/403.php"; + $htaccessContent = explode($content, $htaccessContent, 2)[0]; - //custom 404 error page - $content.= "\nErrorDocument 404 ".$webRoot."/core/templates/404.php"; + //custom 403 error page + $content.= "\nErrorDocument 403 ".$webRoot."/core/templates/403.php"; - // ownCloud may be configured to live at the root folder without a - // trailing slash being specified. In this case manually set the - // rewrite base to `/` - $rewriteBase = $webRoot; - if($webRoot === '') { - $rewriteBase = '/'; - } + //custom 404 error page + $content.= "\nErrorDocument 404 ".$webRoot."/core/templates/404.php"; - // Add rewrite base + // Add rewrite rules if the RewriteBase is configured + $rewriteBase = $config->getSystemValue('htaccess.RewriteBase', ''); + if($rewriteBase !== '') { $content .= "\n<IfModule mod_rewrite.c>"; + $content .= "\n Options -MultiViews"; + $content .= "\n RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]"; + $content .= "\n RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !\\.(css|js|svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !core/img/favicon.ico$"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !/remote.php"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !/public.php"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !/cron.php"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !/core/ajax/update.php"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !/status.php"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocs/v1.php"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocs/v2.php"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !/updater/"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocs-provider/"; + $content .= "\n RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*"; $content .= "\n RewriteRule . index.php [PT,E=PATH_INFO:$1]"; - $content .= "\n RewriteBase ".$rewriteBase; + $content .= "\n RewriteBase " . $rewriteBase; $content .= "\n <IfModule mod_env.c>"; $content .= "\n SetEnv front_controller_active true"; $content .= "\n <IfModule mod_dir.c>"; $content .= "\n DirectorySlash off"; $content .= "\n </IfModule>"; - $content.="\n </IfModule>"; - $content.="\n</IfModule>"; + $content .= "\n </IfModule>"; + $content .= "\n</IfModule>"; + } - if ($content !== '') { - //suppress errors in case we don't have permissions for it - @file_put_contents($setupHelper->pathToHtaccess(), $content . "\n", FILE_APPEND); - } + if ($content !== '') { + //suppress errors in case we don't have permissions for it + @file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent.$content . "\n"); } } diff --git a/lib/private/updater.php b/lib/private/updater.php index 0d567b8dfb9..55d9a5bed2b 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -134,19 +134,16 @@ class Updater extends BasicEmitter { /** * Check if a new version is available * - * @param string $updaterUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php' * @return array|bool */ - public function check($updaterUrl = null) { + public function check() { // Look up the cache - it is invalidated all 30 minutes if (((int)$this->config->getAppValue('core', 'lastupdatedat') + 1800) > time()) { return json_decode($this->config->getAppValue('core', 'lastupdateResult'), true); } - if (is_null($updaterUrl)) { - $updaterUrl = 'https://updates.owncloud.com/server/'; - } + $updaterUrl = $this->config->getSystemValue('updater.server.url', 'https://updates.owncloud.com/server/'); $this->config->setAppValue('core', 'lastupdatedat', time()); diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php index 7967f877024..4371be134aa 100644 --- a/lib/private/user/manager.php +++ b/lib/private/user/manager.php @@ -147,14 +147,19 @@ class Manager extends PublicEmitter implements IUserManager { * * @param string $uid * @param \OCP\UserInterface $backend + * @param bool $cacheUser If false the newly created user object will not be cached * @return \OC\User\User */ - protected function getUserObject($uid, $backend) { + protected function getUserObject($uid, $backend, $cacheUser = true) { if (isset($this->cachedUsers[$uid])) { return $this->cachedUsers[$uid]; } - $this->cachedUsers[$uid] = new User($uid, $backend, $this, $this->config); - return $this->cachedUsers[$uid]; + + $user = new User($uid, $backend, $this, $this->config); + if ($cacheUser) { + $this->cachedUsers[$uid] = $user; + } + return $user; } /** @@ -335,11 +340,11 @@ class Manager extends PublicEmitter implements IUserManager { $offset = 0; do { $users = $backend->getUsers($search, $limit, $offset); - foreach ($users as $user) { - $user = $this->get($user); - if (is_null($user)) { + foreach ($users as $uid) { + if (!$backend->userExists($uid)) { continue; } + $user = $this->getUserObject($uid, $backend, false); $return = $callback($user); if ($return === false) { break; diff --git a/settings/controller/userscontroller.php b/settings/controller/userscontroller.php index f5b7f2d2e5d..5f74eaa82fb 100644 --- a/settings/controller/userscontroller.php +++ b/settings/controller/userscontroller.php @@ -355,9 +355,13 @@ class UsersController extends Controller { try { $user = $this->userManager->createUser($username, $password); } catch (\Exception $exception) { + $message = $exception->getMessage(); + if (!$message) { + $message = $this->l10n->t('Unable to create user.'); + } return new DataResponse( array( - 'message' => (string)$this->l10n->t('Unable to create user.') + 'message' => (string) $message, ), Http::STATUS_FORBIDDEN ); diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 261d9a8eb52..02d3a25be70 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -825,7 +825,7 @@ $(document).ready(function () { }).fail(function(result) { OC.Notification.showTemporary(t('settings', 'Error creating user: {message}', { message: result.responseJSON.message - })); + }, undefined, {escape: false})); }).success(function(){ $('#newuser').get(0).reset(); }); diff --git a/settings/l10n/en@pirate.js b/settings/l10n/en@pirate.js deleted file mode 100644 index f9293f8094c..00000000000 --- a/settings/l10n/en@pirate.js +++ /dev/null @@ -1,6 +0,0 @@ -OC.L10N.register( - "settings", - { - "Password" : "Passcode" -}, -"nplurals=2; plural=(n != 1);"); diff --git a/settings/l10n/en@pirate.json b/settings/l10n/en@pirate.json deleted file mode 100644 index 6f74658eb82..00000000000 --- a/settings/l10n/en@pirate.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "translations": { - "Password" : "Passcode" -},"pluralForm" :"nplurals=2; plural=(n != 1);" -}
\ No newline at end of file diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 9693f1afe18..11dc0d7881b 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -160,7 +160,7 @@ if($_['passwordChangeSupported']) { <?php endforeach;?> </select> <?php if (OC_Util::getEditionString() === ''): ?> - <a href="https://www.transifex.com/projects/p/owncloud/team/<?php p($_['activelanguage']['code']);?>/" + <a href="https://www.transifex.com/projects/p/owncloud/" target="_blank" rel="noreferrer"> <em><?php p($l->t('Help translate'));?></em> </a> diff --git a/tests/lib/updater.php b/tests/lib/updater.php index 8ee77b9f81e..4b6205a42c7 100644 --- a/tests/lib/updater.php +++ b/tests/lib/updater.php @@ -221,20 +221,25 @@ class UpdaterTest extends \Test\TestCase { ->will($this->returnValue(0)); $this->config ->expects($this->at(1)) + ->method('getSystemValue') + ->with('updater.server.url', 'https://updates.owncloud.com/server/') + ->willReturn('https://updates.owncloud.com/server/'); + $this->config + ->expects($this->at(2)) ->method('setAppValue') ->with('core', 'lastupdatedat', $this->isType('integer')); $this->config - ->expects($this->at(3)) + ->expects($this->at(4)) ->method('getAppValue') ->with('core', 'installedat') ->will($this->returnValue('installedat')); $this->config - ->expects($this->at(4)) + ->expects($this->at(5)) ->method('getAppValue') ->with('core', 'lastupdatedat') ->will($this->returnValue('lastupdatedat')); $this->config - ->expects($this->at(5)) + ->expects($this->at(6)) ->method('setAppValue') ->with('core', 'lastupdateResult', json_encode($expectedResult)); @@ -262,20 +267,25 @@ class UpdaterTest extends \Test\TestCase { ->will($this->returnValue(0)); $this->config ->expects($this->at(1)) + ->method('getSystemValue') + ->with('updater.server.url', 'https://updates.owncloud.com/server/') + ->willReturn('https://updates.owncloud.com/server/'); + $this->config + ->expects($this->at(2)) ->method('setAppValue') ->with('core', 'lastupdatedat', $this->isType('integer')); $this->config - ->expects($this->at(3)) + ->expects($this->at(4)) ->method('getAppValue') ->with('core', 'installedat') ->will($this->returnValue('installedat')); $this->config - ->expects($this->at(4)) + ->expects($this->at(5)) ->method('getAppValue') ->with('core', 'lastupdatedat') ->will($this->returnValue('lastupdatedat')); $this->config - ->expects($this->at(5)) + ->expects($this->at(6)) ->method('setAppValue') ->with('core', 'lastupdateResult', 'false'); @@ -289,54 +299,6 @@ class UpdaterTest extends \Test\TestCase { $this->assertSame([], $this->updater->check()); } - public function testCheckWithUpdateUrl() { - $expectedResult = [ - 'version' => '8.0.4.2', - 'versionstring' => 'ownCloud 8.0.4', - 'url' => 'https://download.owncloud.org/community/owncloud-8.0.4.zip', - 'web' => 'http://doc.owncloud.org/server/8.0/admin_manual/maintenance/upgrade.html', - ]; - - $this->config - ->expects($this->at(0)) - ->method('getAppValue') - ->with('core', 'lastupdatedat') - ->will($this->returnValue(0)); - $this->config - ->expects($this->at(1)) - ->method('setAppValue') - ->with('core', 'lastupdatedat', $this->isType('integer')); - $this->config - ->expects($this->at(3)) - ->method('getAppValue') - ->with('core', 'installedat') - ->will($this->returnValue('installedat')); - $this->config - ->expects($this->at(4)) - ->method('getAppValue') - ->with('core', 'lastupdatedat') - ->will($this->returnValue('lastupdatedat')); - $this->config - ->expects($this->at(5)) - ->method('setAppValue') - ->with('core', 'lastupdateResult', json_encode($expectedResult)); - - $updateXml = '<?xml version="1.0"?> -<owncloud> - <version>8.0.4.2</version> - <versionstring>ownCloud 8.0.4</versionstring> - <url>https://download.owncloud.org/community/owncloud-8.0.4.zip</url> - <web>http://doc.owncloud.org/server/8.0/admin_manual/maintenance/upgrade.html</web> -</owncloud>'; - $this->httpHelper - ->expects($this->once()) - ->method('getUrlContent') - ->with($this->buildUpdateUrl('https://myupdater.com/')) - ->will($this->returnValue($updateXml)); - - $this->assertSame($expectedResult, $this->updater->check('https://myupdater.com/')); - } - public function testCheckWithEmptyValidXmlResponse() { $expectedResult = [ 'version' => '', @@ -352,15 +314,20 @@ class UpdaterTest extends \Test\TestCase { ->will($this->returnValue(0)); $this->config ->expects($this->at(1)) + ->method('getSystemValue') + ->with('updater.server.url', 'https://updates.owncloud.com/server/') + ->willReturn('https://updates.owncloud.com/server/'); + $this->config + ->expects($this->at(2)) ->method('setAppValue') ->with('core', 'lastupdatedat', $this->isType('integer')); $this->config - ->expects($this->at(3)) + ->expects($this->at(4)) ->method('getAppValue') ->with('core', 'installedat') ->will($this->returnValue('installedat')); $this->config - ->expects($this->at(4)) + ->expects($this->at(5)) ->method('getAppValue') ->with('core', 'lastupdatedat') ->will($this->returnValue('lastupdatedat')); @@ -391,20 +358,25 @@ class UpdaterTest extends \Test\TestCase { ->will($this->returnValue(0)); $this->config ->expects($this->at(1)) + ->method('getSystemValue') + ->with('updater.server.url', 'https://updates.owncloud.com/server/') + ->willReturn('https://updates.owncloud.com/server/'); + $this->config + ->expects($this->at(2)) ->method('setAppValue') ->with('core', 'lastupdatedat', $this->isType('integer')); $this->config - ->expects($this->at(3)) + ->expects($this->at(4)) ->method('getAppValue') ->with('core', 'installedat') ->will($this->returnValue('installedat')); $this->config - ->expects($this->at(4)) + ->expects($this->at(5)) ->method('getAppValue') ->with('core', 'lastupdatedat') ->will($this->returnValue('lastupdatedat')); $this->config - ->expects($this->at(5)) + ->expects($this->at(6)) ->method('setAppValue') ->with('core', 'lastupdateResult', json_encode($expectedResult)); diff --git a/version.php b/version.php index 849173f8796..c90e84a79c7 100644 --- a/version.php +++ b/version.php @@ -26,10 +26,10 @@ // We only can count up. The 4. digit is only for the internal patchlevel to trigger DB upgrades // between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel // when updating major/minor version number. -$OC_Version = array(9, 0, 2, 1); +$OC_Version = array(9, 0, 2, 2); // The human readable string -$OC_VersionString = '9.0.2 RC2'; +$OC_VersionString = '9.0.2'; $OC_VersionCanBeUpgradedFrom = array(8, 2); |