Commit 6ff91682 authored by Ujjwal Bhardwaj's avatar Ujjwal Bhardwaj Committed by GitHub

Merge branch 'master' into master

parents 2395e2c9 7fbc9358
......@@ -26,6 +26,7 @@
!/apps/systemtags
!/apps/testing
!/apps/updatenotification
!/apps/example-theme
/apps/files_external/3rdparty/irodsphp/PHPUnitTest
/apps/files_external/3rdparty/irodsphp/web
/apps/files_external/3rdparty/irodsphp/prods/test
......
......@@ -14,6 +14,8 @@ env:
global:
- TEST_DAV=$(tests/travis/changed_app.sh dav)
- TC=litmus-v2
- SRV_HOST_NAME=owncloud
- SRV_HOST_PORT=8888
matrix:
- DB=sqlite
......@@ -26,15 +28,20 @@ addons:
apt:
packages:
- realpath
hosts:
- owncloud
sauce_connect:
before_install:
- make
- sh -c "if [ '$TEST_DAV' = '1' ]; then bash tests/travis/before_install.sh $DB; fi"
- sh -c "if [ '$TEST_DAV' = '1' ] || [ '$TC' = 'selenium' ]; then bash tests/travis/before_install.sh $DB; fi"
install:
- sh -c "if [ '$TEST_DAV' = '1' ]; then bash tests/travis/install.sh $DB; fi"
- sh -c "if [ '$TEST_DAV' = '1' ] || [ '$TC' = 'selenium' ]; then bash tests/travis/install.sh $DB; fi"
- sh -c "if [ '$TEST_DAV' = '1' ]; then bash apps/dav/tests/travis/$TC/install.sh; fi"
before_script:
- sh -c "if [ '$TC' = 'selenium' ]; then bash tests/travis/start_php_dev_server.sh; fi"
script:
- sh -c "if [ '$TC' = 'syntax' ]; then make test-php-lint ; fi"
......@@ -42,6 +49,7 @@ script:
- sh -c "if [ '$TEST_DAV' = '1' ]; then echo \"Testing DAV\"; fi"
- sh -c "if [ '$TEST_DAV' = '1' ]; then bash apps/dav/tests/travis/$TC/script.sh; fi"
- sh -c "if [ '$TC' = 'selenium' ] && [ ! -z "$SAUCE_USERNAME" ] && [ ! -z "$SAUCE_ACCESS_KEY" ]; then bash tests/travis/start_behat_tests.sh; fi"
matrix:
include:
......@@ -51,6 +59,8 @@ matrix:
env: DB=sqlite;TC=carddav
- php: 5.6
env: DB=sqlite;TC=caldav
- php: 5.6
env: DB=pgsql;TC=selenium;TEST_DAV=0
- php: 5.6
env: DB=sqlite;TC=syntax;TEST_DAV=0
- php: 7.0
......
......@@ -127,31 +127,22 @@ timestampedNode('SLAVE') {
}
stage 'Integration Testing'
executeAndReport('build/integration/output/*.xml') {
executeAndReport('tests/integration/output/*.xml') {
sh '''phpenv local 7.0
rm -rf config/config.php data/*
./occ maintenance:install --admin-pass=admin
make clean-test-integration
make test-integration
make test-integration OC_TEST_ALT_HOME=1
'''
}
if (isOnReleaseBranch()) {
executeAndReport('build/integration/output/*.xml') {
executeAndReport('tests/integration/output/*.xml') {
sh '''phpenv local 7.0
rm -rf config/config.php data/*
./occ maintenance:install --admin-pass=admin
make clean-test-integration
make test-integration OC_TEST_ALT_HOME=1
'''
}
executeAndReport('build/integration/output/*.xml') {
sh '''phpenv local 7.0
rm -rf config/config.php data/*
./occ maintenance:install --admin-pass=admin
make clean-test-integration
make test-integration OC_TEST_ENCRYPTION_ENABLED=1
make test-integration OC_TEST_ALT_HOME=1 OC_TEST_ENCRYPTION_ENABLED=1
'''
}
executeAndReport('build/integration/output/*.xml') {
......@@ -159,7 +150,7 @@ timestampedNode('SLAVE') {
rm -rf config/config.php data/*
./occ maintenance:install --admin-pass=admin
make clean-test-integration
make test-integration OC_TEST_ALT_HOME=1 OC_TEST_ENCRYPTION_ENABLED=1
make test-integration OC_TEST_ALT_HOME=1 OC_TEST_ENCRYPTION_MASTER_KEY_ENABLED=1
'''
}
}
......
......@@ -66,10 +66,44 @@ dist_dir=build/dist
# Catch-all rules
#
.PHONY: all
all: $(composer_dev_deps) $(core_vendor) $(nodejs_deps)
all: help-hint $(composer_dev_deps) $(core_vendor) $(nodejs_deps)
.PHONY: clean
clean: clean-composer-deps clean-nodejs-deps clean-js-deps clean-test-results clean-dist
clean: clean-composer-deps clean-nodejs-deps clean-js-deps clean-test clean-dist
.PHONY: help-hint
help-hint:
@echo "Building core"
@echo
@echo "Note: You can type 'make help' for more targets"
@echo
.PHONY: help
help:
@echo "Please use 'make <target>' where <target> is one of the following:"
@echo
@echo -e "Dependencies:\n"
@echo -e "make clean\t\t\tclean everything"
@echo -e "make install-composer-deps\tinstall composer dependencies"
@echo -e "make update-composer\t\tupdate composer.lock"
@echo -e "make install-js-deps\t\tinstall Javascript dependencies"
@echo
@echo -e "Note that running 'make' without arguments already installs all required dependencies"
@echo
@echo -e "Testing:\n"
@echo -e "make test\t\t\trun all tests"
@echo -e "make test-php\t\t\trun all PHP tests"
@echo -e "make test-js\t\t\trun Javascript tests"
@echo -e "make test-js-debug\t\trun Javascript tests in debug mode (continuous)"
@echo -e "make test-integration\t\trun integration tests"
@echo -e "make clean-test\t\t\tclean test results"
@echo
@echo It is also possible to run individual PHP test files with the following command:
@echo -e "make test-php TEST_DATABASE=mysql TEST_PHP_SUITE=path/to/testfile.php"
@echo
@echo -e "Tools:\n"
@echo -e "make update-php-license-header\tUpdate license headers"
#
# Basic required tools
......@@ -150,9 +184,16 @@ test-external: $(composer_dev_deps)
test-js: $(nodejs_deps) $(js_deps) $(core_vendor)
NODE_PATH='$(NODE_PREFIX)/node_modules' $(KARMA) start tests/karma.config.js --single-run
.PHONY: test-js-debug
test-js-debug: $(nodejs_deps) $(js_deps) $(core_vendor)
NODE_PATH='$(NODE_PREFIX)/node_modules' $(KARMA) start tests/karma.config.js
.PHONY: test-integration
test-integration: $(composer_dev_deps)
$(MAKE) -C build/integration OC_TEST_ALT_HOME=$(OC_TEST_ALT_HOME) OC_TEST_ENCRYPTION_ENABLED=$(OC_TEST_ENCRYPTION_ENABLED)
$(MAKE) -C tests/integration \
OC_TEST_ALT_HOME=$(OC_TEST_ALT_HOME) \
OC_TEST_ENCRYPTION_ENABLED=$(OC_TEST_ENCRYPTION_ENABLED) \
OC_TEST_ENCRYPTION_MASTER_KEY_ENABLED=$(OC_TEST_ENCRYPTION_MASTER_KEY_ENABLED)
.PHONY: test-php-lint
test-php-lint: $(composer_dev_deps)
......@@ -163,12 +204,15 @@ test: test-php-lint test-php test-js test-integration
.PHONY: clean-test-integration
clean-test-integration:
$(MAKE) -C build/integration clean
$(MAKE) -C tests/integration clean
.PHONY: clean-test-results
clean-test-results:
rm -Rf tests/autotest-*results*.xml
$(MAKE) -C build/integration clean-test-results
$(MAKE) -C tests/integration clean
.PHONY: clean-test
clean-test: clean-test-integration clean-test-results
#
# Documentation
......
......@@ -5,6 +5,7 @@
[![codecov.io](https://codecov.io/github/owncloud/core/coverage.svg?branch=master)](https://codecov.io/github/owncloud/core?branch=master)
[![Dependency Status](https://www.versioneye.com/user/projects/54f4a2384f3108959a000a16/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54f4a2384f3108959a000a16)
[![Dependency Status](https://www.versioneye.com/user/projects/54d1f76f3ca0840b190000c0/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54d1f76f3ca0840b190000c0)
[![Build Status](https://saucelabs.com/buildstatus/DeepDiver1975)](https://saucelabs.com/beta/builds/358889d1dc0a45ff927e3d6b844cabf0)
**[ownCloud](http://ownCloud.org) gives you freedom and control over your own data.
A personal cloud which runs on your own server.**
......
......@@ -6,6 +6,7 @@ OC.L10N.register(
"Post" : "Enviar",
"Cancel" : "Cancelar",
"Edit comment" : "Editar comentario",
"[Deleted user]" : "[Eliminar usuario]",
"Comments" : "COmentarios",
"No other comments available" : "No hay otros comentarios disponibles",
"More comments..." : "Más comentarios...",
......@@ -16,6 +17,7 @@ OC.L10N.register(
"Error occurred while posting comment" : "Se produjo un error al enviar comentario",
"{count} unread comments" : "{count} comtarios no leidos",
"Comment" : "Comentario",
"<strong>Comments</strong> for files <em>(always listed in stream)</em>" : "<strong>Comentarios</strong>para archivos <em>(siempre en la lista)</em>",
"You commented" : "Has comentado",
"%1$s commented" : "%1$s ha comentado",
"You commented on %2$s" : "Has comentado en %2$s",
......
......@@ -4,6 +4,7 @@
"Post" : "Enviar",
"Cancel" : "Cancelar",
"Edit comment" : "Editar comentario",
"[Deleted user]" : "[Eliminar usuario]",
"Comments" : "COmentarios",
"No other comments available" : "No hay otros comentarios disponibles",
"More comments..." : "Más comentarios...",
......@@ -14,6 +15,7 @@
"Error occurred while posting comment" : "Se produjo un error al enviar comentario",
"{count} unread comments" : "{count} comtarios no leidos",
"Comment" : "Comentario",
"<strong>Comments</strong> for files <em>(always listed in stream)</em>" : "<strong>Comentarios</strong>para archivos <em>(siempre en la lista)</em>",
"You commented" : "Has comentado",
"%1$s commented" : "%1$s ha comentado",
"You commented on %2$s" : "Has comentado en %2$s",
......
......@@ -12,8 +12,12 @@ OC.L10N.register(
"More comments..." : "Fleiri athugasemdir...",
"Save" : "Vista",
"Allowed characters {count} of {max}" : "Leyfður stafafjöldi {count} af {max}",
"Error occurred while retrieving comment with id {id}" : "Villa kom upp við að reyna að ná í athugasemd með auðkenninu {id}",
"Error occurred while updating comment with id {id}" : "Villa kom upp við að reyna að uppfæra athugasemd með auðkenninu {id}",
"Error occurred while posting comment" : "Villa kom upp við að senda inn athugasemd",
"{count} unread comments" : "{count} ólesnar athugasemdir",
"Comment" : "Athugasemd",
"<strong>Comments</strong> for files <em>(always listed in stream)</em>" : "<strong>Athugasemdir</strong> við skrár <em>(alltaf á lista í streymi)</em>",
"You commented" : "Þú settir inn athugasemd",
"%1$s commented" : "%1$s setti inn athugasemd",
"You commented on %2$s" : "Þú settir inn athugasemd við %2$s",
......
......@@ -10,8 +10,12 @@
"More comments..." : "Fleiri athugasemdir...",
"Save" : "Vista",
"Allowed characters {count} of {max}" : "Leyfður stafafjöldi {count} af {max}",
"Error occurred while retrieving comment with id {id}" : "Villa kom upp við að reyna að ná í athugasemd með auðkenninu {id}",
"Error occurred while updating comment with id {id}" : "Villa kom upp við að reyna að uppfæra athugasemd með auðkenninu {id}",
"Error occurred while posting comment" : "Villa kom upp við að senda inn athugasemd",
"{count} unread comments" : "{count} ólesnar athugasemdir",
"Comment" : "Athugasemd",
"<strong>Comments</strong> for files <em>(always listed in stream)</em>" : "<strong>Athugasemdir</strong> við skrár <em>(alltaf á lista í streymi)</em>",
"You commented" : "Þú settir inn athugasemd",
"%1$s commented" : "%1$s setti inn athugasemd",
"You commented on %2$s" : "Þú settir inn athugasemd við %2$s",
......
<?php
/**
* @author Victor Dubiniuk <dubiniuk@owncloud.com>
*
* @copyright Copyright (c) 2017, ownCloud GmbH
* @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 OCA\DAV\Migrations;
use OCP\Migration\ISchemaMigration;
use Doctrine\DBAL\Schema\Schema;
/*
* Create initial properties table
* Add fileid field to this table if needed
*/
class Version20170116170538 implements ISchemaMigration {
/**
* @param Schema $schema
* @param string $prefix
*/
private function createPropertiesTable(Schema $schema, $prefix) {
$table = $schema->createTable("${prefix}properties");
$table->addColumn('id', 'integer', [
'autoincrement' => true,
'notnull' => true,
'length' => 4,
]);
$table->addColumn('fileid', 'integer', [
'notnull' => true,
'unsigned' => true,
'length' => 20,
]);
$table->addColumn('propertyname', 'string', [
'notnull' => true,
'length' => 255,
'default' => '',
]);
$table->addColumn('propertyvalue', 'string', [
'notnull' => true,
'length' => 255,
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['fileid'], 'fileid_index');
}
/**
* @param Schema $schema
* @param array $options
*/
public function changeSchema(Schema $schema, array $options) {
$prefix = $options['tablePrefix'];
if (!$schema->hasTable("${prefix}properties")) {
// install
$this->createPropertiesTable($schema, $prefix);
} else {
// We allow fileid column to be nullable on update
// otherwise migration will fail for some DB engines
$table = $schema->getTable("${prefix}properties");
if (!$table->hasColumn('fileid')) {
$table->addColumn('fileid', 'integer', [
'notnull' => false,
'unsigned' => true,
'length' => 20,
]);
}
if (!$table->hasIndex('fileid_index')){
$table->addIndex(['fileid'], 'fileid_index');
}
}
}
}
<?php
/**
* @author Victor Dubiniuk <dubiniuk@owncloud.com>
*
* @copyright Copyright (c) 2017, ownCloud GmbH
* @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 OCA\DAV\Migrations;
use \OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\Node;
use OCP\IDBConnection;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Migration\ISqlMigration;
/*
* Resolve userid/propertypath into fileid
* Update all entries with actual fileid if possible
* Drop all entries that can't be resolved
*/
class Version20170202213905 implements ISqlMigration {
/** @var IUserManager */
private $userManager;
/** @var string[] */
private $statements = [];
public function __construct(IUserManager $userManager) {
$this->userManager = $userManager;
}
/**
* @param IDBConnection $connection
* @return array
*/
public function sql(IDBConnection $connection) {
$qb = $connection->getQueryBuilder();
$qb->select('*')
->from('properties', 'props')
->setMaxResults(1);
$result = $qb->execute();
$row = $result->fetch();
// There is nothing to do if table is empty or has no userid field
if (!$row || !isset($row['userid'])) {
return $this->statements;
}
$qb->resetQueryParts()
->setMaxResults(null)
->select('userid', 'propertypath')
->from('properties', 'props')
->groupBy('userid')
->addGroupBy('propertypath')
->orderBy('userid')
->addOrderBy('propertypath');
$selectResult = $qb->execute();
while ($row = $selectResult->fetch()) {
try {
$sql = $this->getRepairEntrySql($qb, $row);
if (!is_null($sql)) {
$this->statements[] = $sql;
}
} catch (\Exception $e) {
}
}
//Mounted FS can have side effects on further migrations
\OC_Util::tearDownFS();
// drop entries with empty fileid
$dropQuery = $qb->resetQueryParts()
->delete('properties')
->where(
$qb->expr()->eq('fileid', $qb->expr()->literal('0'))
)
->orWhere(
$qb->expr()->isNull('fileid')
);
$this->statements[] = $dropQuery->getSQL();
return $this->statements;
}
/**
* @param IQueryBuilder $qb
* @param $entry
* @return string|null
*/
private function getRepairEntrySql(IQueryBuilder $qb, $entry) {
$userId = $entry['userid'];
$user = $this->userManager->get($userId);
if (!($user instanceof IUser)) {
return null;
}
$node = \OC::$server->getUserFolder($userId)->get($entry['propertypath']);
if ($node instanceof Node && $node->getId()) {
$fileId = $node->getId();
$updateQuery = $this->getRepairQuery($qb, $fileId, $userId, $entry['propertypath']);
return $updateQuery->getSQL();
}
return null;
}
/**
* @param IQueryBuilder $qb
* @param int $fileId
* @param string $userId
* @param string $propertyPath
* @return IQueryBuilder
*/
private function getRepairQuery(IQueryBuilder $qb, $fileId, $userId, $propertyPath){
return $qb->resetQueryParts()
->update('properties')
->set(
'fileid',
$qb->expr()->literal($fileId)
)
->where(
$qb->expr()->eq('userid', $qb->expr()->literal($userId))
)
->andWhere(
$qb->expr()->eq(
'propertypath',
$qb->expr()->literal($propertyPath)
)
);
}
}
<?php
/**
* @author Victor Dubiniuk <dubiniuk@owncloud.com>
*
* @copyright Copyright (c) 2017, ownCloud GmbH
* @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 OCA\DAV\Migrations;
use OCP\Migration\ISchemaMigration;
use Doctrine\DBAL\Schema\Schema;
/*
* Drop property_index index if exists
* Drop userid and propertypath columns
* Add NOT NULL constraint to fileid column
*/
class Version20170202220512 implements ISchemaMigration {
/**
* @param Schema $schema
* @param array $options
*/
public function changeSchema(Schema $schema, array $options) {
$prefix = $options['tablePrefix'];
$table = $schema->getTable("${prefix}properties");
if ($table->hasIndex('property_index')) {
$table->dropIndex('property_index');
}
if ($table->hasColumn('userid')) {
$table->dropColumn('userid');
}
if ($table->hasColumn('propertypath')) {
$table->dropColumn('propertypath');
}
$table->changeColumn('fileid', [
'notnull' => false,
'unsigned' => true,
'length' => 20,
]);
}
}
......@@ -55,5 +55,9 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authBackend, func
return \OC\Files\Filesystem::getView();
});
// allow setup of additional auth backends
$event = new \OCP\SabrePluginEvent($server);
\OC::$server->getEventDispatcher()->dispatch('OCA\DAV\Connector\Sabre::authInit', $event);
// And off we go!
$server->exec();
......@@ -5,6 +5,7 @@ OC.L10N.register(
"Personal" : "Personal",
"Contacts" : "Contactos",
"Technical details" : "Detalles técnnicos",
"Remote Address: %s" : "Dirección Remota: %s"
"Remote Address: %s" : "Dirección Remota: %s",
"Request ID: %s" : "ID de Solicitud: %s"
},
"nplurals=2; plural=(n != 1);");
......@@ -3,6 +3,7 @@
"Personal" : "Personal",
"Contacts" : "Contactos",
"Technical details" : "Detalles técnnicos",
"Remote Address: %s" : "Dirección Remota: %s"
"Remote Address: %s" : "Dirección Remota: %s",
"Request ID: %s" : "ID de Solicitud: %s"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
......@@ -30,6 +30,7 @@ use Sabre\DAV\PropertyStorage\Backend\BackendInterface;
use Sabre\DAV\PropFind;
use Sabre\DAV\PropPatch;
use Sabre\DAV\Tree;
use Sabre\Dav\Exception\Forbidden;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\Exception\ServiceUnavailable;
......@@ -169,13 +170,14 @@ class CustomPropertiesBackend implements BackendInterface {