Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions apps/dav/appinfo/Migrations/Version20170607100912.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
namespace OCA\dav\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
use OCP\Migration\ISchemaMigration;

/**
* changes mtime fields to be able to store 64bit time stamps
*/
class Version20170607100912 implements ISchemaMigration {

public function changeSchema(Schema $schema, array $options) {
$prefix = $options['tablePrefix'];
$table = $schema->getTable("${prefix}filecache");
foreach ( ['mtime','storage_mtime'] as $column ) {
if ($table->getColumn($column)->getType()->getName() === Type::INTEGER) {
$table->getColumn($column)->setType(Type::getType(Type::BIGINT));
}
}
}
}
2 changes: 1 addition & 1 deletion apps/dav/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<description>ownCloud WebDAV endpoint</description>
<licence>AGPL</licence>
<author>owncloud.org</author>
<version>0.3.0</version>
<version>0.3.1</version>
<default_enable/>
<use-migrations>true</use-migrations>
<types>
Expand Down
16 changes: 16 additions & 0 deletions apps/dav/tests/unit/Connector/Sabre/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,22 @@ public function legalMtimeProvider() {
'HTTP_X_OC_MTIME' => -34.43,
'expected result' => -34
],
"long int" => [
'HTTP_X_OC_MTIME' => PHP_INT_MAX,
'expected result' => PHP_INT_MAX
],
"too long int" => [
'HTTP_X_OC_MTIME' => PHP_INT_MAX + 1,
'expected result' => PHP_INT_MAX
],
"long negative int" => [
'HTTP_X_OC_MTIME' => PHP_INT_MAX * - 1,
'expected result' => (PHP_INT_MAX * - 1)
],
"too long negative int" => [
'HTTP_X_OC_MTIME' => (PHP_INT_MAX * - 1) - 1,
'expected result' => (PHP_INT_MAX * - 1)
],
];
}

Expand Down