aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_encryption/appinfo/info.xml1
-rw-r--r--apps/files_encryption/appinfo/version2
-rw-r--r--apps/files_external/appinfo/info.xml1
-rw-r--r--apps/files_external/appinfo/version2
-rw-r--r--apps/files_sharing/appinfo/info.xml1
-rw-r--r--apps/files_sharing/appinfo/version2
-rw-r--r--apps/files_sharing/js/external.js35
-rw-r--r--apps/files_sharing/js/sharedfilelist.js9
-rw-r--r--apps/files_sharing/tests/js/sharedfilelistSpec.js42
-rw-r--r--apps/files_trashbin/appinfo/info.xml1
-rw-r--r--apps/files_trashbin/appinfo/version2
-rw-r--r--apps/files_versions/appinfo/info.xml1
-rw-r--r--apps/files_versions/appinfo/version2
-rw-r--r--apps/user_ldap/appinfo/info.xml1
-rw-r--r--apps/user_ldap/appinfo/version2
-rwxr-xr-xapps/user_webdavauth/appinfo/info.xml1
-rw-r--r--apps/user_webdavauth/appinfo/version2
-rwxr-xr-xconfig/config.sample.php8
-rw-r--r--core/css/jquery.ocdialog.css11
-rw-r--r--core/js/jquery.ocdialog.js7
-rw-r--r--core/js/oc-dialogs.js42
-rw-r--r--lib/base.php14
-rw-r--r--lib/private/app.php3
-rw-r--r--lib/private/repair.php1
-rwxr-xr-xlib/private/request.php2
-rw-r--r--lib/repair/innodb.php51
-rw-r--r--settings/js/users/users.js1
-rw-r--r--tests/lib/repair/repairinnodb.php65
28 files changed, 267 insertions, 45 deletions
diff --git a/apps/files_encryption/appinfo/info.xml b/apps/files_encryption/appinfo/info.xml
index b11272f63e7..a6d2950d705 100644
--- a/apps/files_encryption/appinfo/info.xml
+++ b/apps/files_encryption/appinfo/info.xml
@@ -15,4 +15,5 @@
<types>
<filesystem/>
</types>
+ <ocsid>166047</ocsid>
</info>
diff --git a/apps/files_encryption/appinfo/version b/apps/files_encryption/appinfo/version
index 5a2a5806df6..ee6cdce3c29 100644
--- a/apps/files_encryption/appinfo/version
+++ b/apps/files_encryption/appinfo/version
@@ -1 +1 @@
-0.6
+0.6.1
diff --git a/apps/files_external/appinfo/info.xml b/apps/files_external/appinfo/info.xml
index 2698706c090..b8bada8e743 100644
--- a/apps/files_external/appinfo/info.xml
+++ b/apps/files_external/appinfo/info.xml
@@ -10,4 +10,5 @@
<types>
<filesystem/>
</types>
+ <ocsid>166048</ocsid>
</info>
diff --git a/apps/files_external/appinfo/version b/apps/files_external/appinfo/version
index 2f4536184bc..7dff5b89211 100644
--- a/apps/files_external/appinfo/version
+++ b/apps/files_external/appinfo/version
@@ -1 +1 @@
-0.2 \ No newline at end of file
+0.2.1 \ No newline at end of file
diff --git a/apps/files_sharing/appinfo/info.xml b/apps/files_sharing/appinfo/info.xml
index 077433a53ab..c32a24ecd29 100644
--- a/apps/files_sharing/appinfo/info.xml
+++ b/apps/files_sharing/appinfo/info.xml
@@ -15,4 +15,5 @@
<files>public.php</files>
<webdav>publicwebdav.php</webdav>
</public>
+ <ocsid>166050</ocsid>
</info>
diff --git a/apps/files_sharing/appinfo/version b/apps/files_sharing/appinfo/version
index cb0c939a936..be14282b7ff 100644
--- a/apps/files_sharing/appinfo/version
+++ b/apps/files_sharing/appinfo/version
@@ -1 +1 @@
-0.5.2
+0.5.3
diff --git a/apps/files_sharing/js/external.js b/apps/files_sharing/js/external.js
index 969a2b184d4..e743d2e2d32 100644
--- a/apps/files_sharing/js/external.js
+++ b/apps/files_sharing/js/external.js
@@ -42,13 +42,40 @@
}
};
if (!passwordProtected) {
- OC.dialogs.confirm(t('files_sharing', 'Add {name} from {owner}@{remote}', {name: name, owner: owner, remote: remoteClean})
- , t('files_sharing','Add Share'), callback, true);
+ OC.dialogs.confirm(
+ t(
+ 'files_sharing',
+ 'Do you want to add the remote share {name} from {owner}@{remote}?',
+ {name: name, owner: owner, remote: remoteClean}
+ ),
+ t('files_sharing','Remote share'),
+ callback,
+ true
+ ).then(this._adjustDialog);
} else {
- OC.dialogs.prompt(t('files_sharing', 'Add {name} from {owner}@{remote}', {name: name, owner: owner, remote: remoteClean})
- , t('files_sharing','Add Share'), callback, true, t('files_sharing','Password'), true);
+ OC.dialogs.prompt(
+ t(
+ 'files_sharing',
+ 'Do you want to add the remote share {name} from {owner}@{remote}?',
+ {name: name, owner: owner, remote: remoteClean}
+ ),
+ t('files_sharing','Remote share'),
+ callback,
+ true,
+ t('files_sharing','Remote share password'),
+ true
+ ).then(this._adjustDialog);
}
};
+
+ OCA.Sharing._adjustDialog = function() {
+ var $dialog = $('.oc-dialog:visible');
+ var $buttons = $dialog.find('button');
+ // hack the buttons
+ $dialog.find('.ui-icon').remove();
+ $buttons.eq(0).text(t('core', 'Cancel'));
+ $buttons.eq(1).text(t('core', 'Add remote share'));
+ };
})();
$(document).ready(function () {
diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js
index e643618e774..861bbaff5de 100644
--- a/apps/files_sharing/js/sharedfilelist.js
+++ b/apps/files_sharing/js/sharedfilelist.js
@@ -179,7 +179,9 @@
file.permissions = share.permissions;
}
else {
- file.share.targetDisplayName = share.share_with_displayname;
+ if (share.share_type !== OC.Share.SHARE_TYPE_LINK) {
+ file.share.targetDisplayName = share.share_with_displayname;
+ }
file.name = OC.basename(share.path);
file.path = OC.dirname(share.path);
file.permissions = OC.PERMISSION_ALL;
@@ -238,12 +240,11 @@
);
delete data.recipientsCount;
})
- // Sort by expected sort comparator
- .sortBy(this._sortComparator)
// Finish the chain by getting the result
.value();
- return files;
+ // Sort by expected sort comparator
+ return files.sort(this._sortComparator);
}
});
diff --git a/apps/files_sharing/tests/js/sharedfilelistSpec.js b/apps/files_sharing/tests/js/sharedfilelistSpec.js
index 4e130885500..41c8a1f05d8 100644
--- a/apps/files_sharing/tests/js/sharedfilelistSpec.js
+++ b/apps/files_sharing/tests/js/sharedfilelistSpec.js
@@ -499,6 +499,48 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
expect($tr.attr('data-mime')).toEqual('text/plain');
expect($tr.attr('data-mtime')).toEqual('11111000');
+ expect($tr.attr('data-share-recipients')).not.toBeDefined();
+ expect($tr.attr('data-share-owner')).not.toBeDefined();
+ expect($tr.attr('data-share-id')).toEqual('7');
+ expect($tr.find('a.name').attr('href')).toEqual(
+ OC.webroot +
+ '/index.php/apps/files/ajax/download.php' +
+ '?dir=%2Flocal%20path&files=local%20name.txt');
+
+ expect($tr.find('.nametext').text().trim()).toEqual('local name.txt');
+ });
+ it('does not show virtual token recipient as recipient when password was set', function() {
+ /* jshint camelcase: false */
+ var request;
+ // when a password is set, share_with contains an auth token
+ ocsResponse.ocs.data[0].share_with = 'abc01234/01234abc';
+ ocsResponse.ocs.data[0].share_with_displayname = 'abc01234/01234abc';
+ expect(fakeServer.requests.length).toEqual(1);
+ request = fakeServer.requests[0];
+ expect(request.url).toEqual(
+ OC.linkToOCS('apps/files_sharing/api/v1') +
+ 'shares?format=json&shared_with_me=false'
+ );
+
+ fakeServer.requests[0].respond(
+ 200,
+ { 'Content-Type': 'application/json' },
+ JSON.stringify(ocsResponse)
+ );
+
+ // only renders the link share entry
+ var $rows = fileList.$el.find('tbody tr');
+ var $tr = $rows.eq(0);
+ expect($rows.length).toEqual(1);
+ expect($tr.attr('data-id')).toEqual('49');
+ expect($tr.attr('data-type')).toEqual('file');
+ expect($tr.attr('data-file')).toEqual('local name.txt');
+ expect($tr.attr('data-path')).toEqual('/local path');
+ expect($tr.attr('data-size')).not.toBeDefined();
+ expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
+ expect($tr.attr('data-mime')).toEqual('text/plain');
+ expect($tr.attr('data-mtime')).toEqual('11111000');
+ expect($tr.attr('data-share-recipients')).not.toBeDefined();
expect($tr.attr('data-share-owner')).not.toBeDefined();
expect($tr.attr('data-share-id')).toEqual('7');
expect($tr.find('a.name').attr('href')).toEqual(
diff --git a/apps/files_trashbin/appinfo/info.xml b/apps/files_trashbin/appinfo/info.xml
index 860d6b1242a..41b14c21a06 100644
--- a/apps/files_trashbin/appinfo/info.xml
+++ b/apps/files_trashbin/appinfo/info.xml
@@ -24,4 +24,5 @@
<types>
<filesystem/>
</types>
+ <ocsid>166052</ocsid>
</info>
diff --git a/apps/files_trashbin/appinfo/version b/apps/files_trashbin/appinfo/version
index ee6cdce3c29..b6160487433 100644
--- a/apps/files_trashbin/appinfo/version
+++ b/apps/files_trashbin/appinfo/version
@@ -1 +1 @@
-0.6.1
+0.6.2
diff --git a/apps/files_versions/appinfo/info.xml b/apps/files_versions/appinfo/info.xml
index 5d536638fe8..d16c1bd1a24 100644
--- a/apps/files_versions/appinfo/info.xml
+++ b/apps/files_versions/appinfo/info.xml
@@ -29,4 +29,5 @@
<filesystem/>
</types>
<default_enable/>
+ <ocsid>166053</ocsid>
</info>
diff --git a/apps/files_versions/appinfo/version b/apps/files_versions/appinfo/version
index ee90284c27f..90a27f9cea6 100644
--- a/apps/files_versions/appinfo/version
+++ b/apps/files_versions/appinfo/version
@@ -1 +1 @@
-1.0.4
+1.0.5
diff --git a/apps/user_ldap/appinfo/info.xml b/apps/user_ldap/appinfo/info.xml
index b70f0c54355..cf98b2dbe4e 100644
--- a/apps/user_ldap/appinfo/info.xml
+++ b/apps/user_ldap/appinfo/info.xml
@@ -17,4 +17,5 @@
<documentation>
<admin>http://doc.owncloud.org/server/6.0/go.php?to=admin-ldap</admin>
</documentation>
+ <ocsid>166061</ocsid>
</info>
diff --git a/apps/user_ldap/appinfo/version b/apps/user_ldap/appinfo/version
index 2b7c5ae0184..17b2ccd9bf9 100644
--- a/apps/user_ldap/appinfo/version
+++ b/apps/user_ldap/appinfo/version
@@ -1 +1 @@
-0.4.2
+0.4.3
diff --git a/apps/user_webdavauth/appinfo/info.xml b/apps/user_webdavauth/appinfo/info.xml
index 16e6942505b..4e82b818b8b 100755
--- a/apps/user_webdavauth/appinfo/info.xml
+++ b/apps/user_webdavauth/appinfo/info.xml
@@ -12,4 +12,5 @@
<types>
<authentication/>
</types>
+ <ocsid>166062</ocsid>
</info>
diff --git a/apps/user_webdavauth/appinfo/version b/apps/user_webdavauth/appinfo/version
index a6bbdb5ff48..238afc2b279 100644
--- a/apps/user_webdavauth/appinfo/version
+++ b/apps/user_webdavauth/appinfo/version
@@ -1 +1 @@
-1.1.0.0
+1.1.0.1
diff --git a/config/config.sample.php b/config/config.sample.php
index e613609bcef..1bfae366fff 100755
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -41,16 +41,16 @@ $CONFIG = array(
/* Blacklist a specific file and disallow the upload of files with this name - WARNING: USE THIS ONLY IF YOU KNOW WHAT YOU ARE DOING. */
"blacklisted_files" => array('.htaccess'),
-/* The automatic hostname detection of ownCloud can fail in certain reverse proxy situations. This option allows to manually override the automatic detection. You can also add a port. For example "www.example.com:88" */
+/* The automatic hostname detection of ownCloud can fail in certain reverse proxy and CLI/cron situations. This option allows to manually override the automatic detection. You can also add a port. For example "www.example.com:88" */
"overwritehost" => "",
-/* The automatic protocol detection of ownCloud can fail in certain reverse proxy situations. This option allows to manually override the protocol detection. For example "https" */
+/* The automatic protocol detection of ownCloud can fail in certain reverse proxy and CLI/cron situations. This option allows to manually override the protocol detection. For example "https" */
"overwriteprotocol" => "",
-/* The automatic webroot detection of ownCloud can fail in certain reverse proxy situations. This option allows to manually override the automatic detection. For example "/domain.tld/ownCloud". The value "/" can be used to remove the root. */
+/* The automatic webroot detection of ownCloud can fail in certain reverse proxy and CLI/cron situations. This option allows to manually override the automatic detection. For example "/domain.tld/ownCloud". The value "/" can be used to remove the root. */
"overwritewebroot" => "",
-/* The automatic detection of ownCloud can fail in certain reverse proxy situations. This option allows to define a manually override condition as regular expression for the remote ip address. For example "^10\.0\.0\.[1-3]$" */
+/* The automatic detection of ownCloud can fail in certain reverse proxy and CLI/cron situations. This option allows to define a manually override condition as regular expression for the remote ip address. For example "^10\.0\.0\.[1-3]$" */
"overwritecondaddr" => "",
/* A proxy to use to connect to the internet. For example "myproxy.org:88" */
diff --git a/core/css/jquery.ocdialog.css b/core/css/jquery.ocdialog.css
index a1221137bc4..93930bf435f 100644
--- a/core/css/jquery.ocdialog.css
+++ b/core/css/jquery.ocdialog.css
@@ -31,6 +31,17 @@
margin-top: 10px;
width: 100%;
}
+/* align primary button to right, other buttons to left */
+.oc-dialog-buttonrow.twobuttons button:nth-child(1) {
+ float: left;
+}
+.oc-dialog-buttonrow.twobuttons button:nth-child(2) {
+ float: right;
+}
+
+.oc-dialog-buttonrow.onebutton button {
+ float: right;
+}
.oc-dialog-close {
position:absolute;
diff --git a/core/js/jquery.ocdialog.js b/core/js/jquery.ocdialog.js
index af32591ce52..e48e3e8df6a 100644
--- a/core/js/jquery.ocdialog.js
+++ b/core/js/jquery.ocdialog.js
@@ -111,6 +111,13 @@
var $buttonrow = $('<div class="oc-dialog-buttonrow" />');
this.$buttonrow = $buttonrow.appendTo(this.$dialog);
}
+ if (value.length === 1) {
+ this.$buttonrow.addClass('onebutton');
+ } else if (value.length === 2) {
+ this.$buttonrow.addClass('twobuttons');
+ } else if (value.length === 3) {
+ this.$buttonrow.addClass('threebuttons');
+ }
$.each(value, function(idx, val) {
var $button = $('<button>').text(val.text);
if (val.classes) {
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index a76f9170dc8..9920cc58e23 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -19,7 +19,7 @@
*
*/
-/* global OC, t, alert, $ */
+/* global alert */
/**
* this class to ease the usage of jquery dialogs
@@ -66,7 +66,7 @@ var OCdialogs = {
* @param modal make the dialog modal
*/
confirm:function(text, title, callback, modal) {
- this.message(
+ return this.message(
text,
title,
'notice',
@@ -86,7 +86,7 @@ var OCdialogs = {
* @param password whether the input should be a password input
*/
prompt: function (text, title, callback, modal, name, password) {
- $.when(this._getMessageTemplate()).then(function ($tmpl) {
+ return $.when(this._getMessageTemplate()).then(function ($tmpl) {
var dialogName = 'oc-dialog-' + OCdialogs.dialogsCounter + '-content';
var dialogId = '#' + dialogName;
var $dlg = $tmpl.octemplate({
@@ -104,8 +104,15 @@ var OCdialogs = {
modal = false;
}
$('body').append($dlg);
- var buttonlist = [
- {
+ var buttonlist = [{
+ text : t('core', 'No'),
+ click: function () {
+ if (callback !== undefined) {
+ callback(false, input.val());
+ }
+ $(dialogId).ocdialog('close');
+ }
+ }, {
text : t('core', 'Yes'),
click : function () {
if (callback !== undefined) {
@@ -114,15 +121,6 @@ var OCdialogs = {
$(dialogId).ocdialog('close');
},
defaultButton: true
- },
- {
- text : t('core', 'No'),
- click: function () {
- if (callback !== undefined) {
- callback(false, input.val());
- }
- $(dialogId).ocdialog('close');
- }
}
];
@@ -237,7 +235,7 @@ var OCdialogs = {
* You better use a wrapper instead ...
*/
message:function(content, title, dialogType, buttons, callback, modal) {
- $.when(this._getMessageTemplate()).then(function($tmpl) {
+ return $.when(this._getMessageTemplate()).then(function($tmpl) {
var dialogName = 'oc-dialog-' + OCdialogs.dialogsCounter + '-content';
var dialogId = '#' + dialogName;
var $dlg = $tmpl.octemplate({
@@ -254,23 +252,23 @@ var OCdialogs = {
switch (buttons) {
case OCdialogs.YES_NO_BUTTONS:
buttonlist = [{
- text: t('core', 'Yes'),
+ text: t('core', 'No'),
click: function(){
if (callback !== undefined) {
- callback(true);
+ callback(false);
}
$(dialogId).ocdialog('close');
- },
- defaultButton: true
+ }
},
{
- text: t('core', 'No'),
+ text: t('core', 'Yes'),
click: function(){
if (callback !== undefined) {
- callback(false);
+ callback(true);
}
$(dialogId).ocdialog('close');
- }
+ },
+ defaultButton: true
}];
break;
case OCdialogs.OK_BUTTON:
diff --git a/lib/base.php b/lib/base.php
index b526840a97d..840d9044711 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -117,10 +117,18 @@ class OC {
}
}
- OC::$WEBROOT = substr($scriptName, 0, strlen($scriptName) - strlen(OC::$SUBURI));
+ if (substr($scriptName, 0 - strlen(OC::$SUBURI)) === OC::$SUBURI) {
+ OC::$WEBROOT = substr($scriptName, 0, 0 - strlen(OC::$SUBURI));
- if (OC::$WEBROOT != '' and OC::$WEBROOT[0] !== '/') {
- OC::$WEBROOT = '/' . OC::$WEBROOT;
+ if (OC::$WEBROOT != '' && OC::$WEBROOT[0] !== '/') {
+ OC::$WEBROOT = '/' . OC::$WEBROOT;
+ }
+ } else {
+ // The scriptName is not ending with OC::$SUBURI
+ // This most likely means that we are calling from CLI.
+ // However some cron jobs still need to generate
+ // a web URL, so we use overwritewebroot as a fallback.
+ OC::$WEBROOT = OC_Config::getValue('overwritewebroot', '');
}
// search the 3rdparty folder
diff --git a/lib/private/app.php b/lib/private/app.php
index b7d58c72340..4343ab0d1b4 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -1186,6 +1186,9 @@ class OC_App {
//set remote/public handlers
$appData = self::getAppInfo($appid);
+ if (array_key_exists('ocsid', $appData)) {
+ OC_Appconfig::setValue($appid, 'ocsid', $appData['ocsid']);
+ }
foreach ($appData['remote'] as $name => $path) {
OCP\CONFIG::setAppValue('core', 'remote_' . $name, $appid . '/' . $path);
}
diff --git a/lib/private/repair.php b/lib/private/repair.php
index 14a917be32c..89886dd9316 100644
--- a/lib/private/repair.php
+++ b/lib/private/repair.php
@@ -81,6 +81,7 @@ class Repair extends BasicEmitter {
*/
public static function getBeforeUpgradeRepairSteps() {
return array(
+ new \OC\Repair\InnoDB()
);
}
diff --git a/lib/private/request.php b/lib/private/request.php
index 619eae3e9b5..5fd5b3a7197 100755
--- a/lib/private/request.php
+++ b/lib/private/request.php
@@ -95,7 +95,7 @@ class OC_Request {
* reverse proxies
*/
public static function serverHost() {
- if(OC::$CLI) {
+ if (OC::$CLI && defined('PHPUNIT_RUN')) {
return 'localhost';
}
diff --git a/lib/repair/innodb.php b/lib/repair/innodb.php
new file mode 100644
index 00000000000..4d58bf64a9e
--- /dev/null
+++ b/lib/repair/innodb.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Copyright (c) 2014 Thomas Müller <deepdiver@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Repair;
+
+use Doctrine\DBAL\Platforms\MySqlPlatform;
+use OC\Hooks\BasicEmitter;
+
+class InnoDB extends BasicEmitter implements \OC\RepairStep {
+
+ public function getName() {
+ return 'Repair MySQL database engine';
+ }
+
+ /**
+ * Fix mime types
+ */
+ public function run() {
+ $connection = \OC_DB::getConnection();
+ if (!$connection->getDatabasePlatform() instanceof MySqlPlatform) {
+ $this->emit('\OC\Repair', 'info', array('Not a mysql database -> nothing to no'));
+ return;
+ }
+
+ $tables = $this->getAllMyIsamTables($connection);
+ foreach ($tables as $table) {
+ $connection->exec("ALTER TABLE $table ENGINE=InnoDB;");
+ $this->emit('\OC\Repair', 'info', array("Fixed $table"));
+ }
+ }
+
+ /**
+ * @param \Doctrine\DBAL\Connection $connection
+ * @return string[]
+ */
+ private function getAllMyIsamTables($connection) {
+ $dbName = \OC::$server->getConfig()->getSystemValue("dbname");
+ $result = $connection->fetchArray(
+ "SELECT table_name FROM information_schema.tables WHERE table_schema = ? AND engine = 'MyISAM'",
+ array($dbName)
+ );
+
+ return $result;
+ }
+}
+
diff --git a/settings/js/users/users.js b/settings/js/users/users.js
index 1c0f3eef840..f84d67b75bc 100644
--- a/settings/js/users/users.js
+++ b/settings/js/users/users.js
@@ -618,6 +618,7 @@ $(document).ready(function () {
if(!UserList.has(username)) {
UserList.add(username, username, result.data.groups, null, 'default', result.data.storageLocation, 0, true);
}
+ $('#newusername').focus();
}
}
);
diff --git a/tests/lib/repair/repairinnodb.php b/tests/lib/repair/repairinnodb.php
new file mode 100644
index 00000000000..e7d2442f127
--- /dev/null
+++ b/tests/lib/repair/repairinnodb.php
@@ -0,0 +1,65 @@
+<?php
+/**
+ * Copyright (c) 2014 Thomas Müller <deepdiver@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+/**
+ * Tests for the converting of MySQL tables to InnoDB engine
+ *
+ * @see \OC\Repair\RepairMimeTypes
+ */
+class TestRepairInnoDB extends PHPUnit_Framework_TestCase {
+
+ /** @var \OC\RepairStep */
+ private $repair;
+
+ /** @var \Doctrine\DBAL\Connection */
+ private $connection;
+
+ /** @var string */
+ private $tableName;
+
+ public function setUp() {
+ $this->connection = \OC_DB::getConnection();
+ if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) {
+ $this->markTestSkipped("Test only relevant on MySql");
+ }
+
+ $dbPrefix = \OC::$server->getConfig()->getSystemValue("dbtableprefix");
+ $this->tableName = uniqid($dbPrefix . "_innodb_test");
+ $this->connection->exec("CREATE TABLE $this->tableName(id INT) ENGINE MyISAM");
+
+ $this->repair = new \OC\Repair\InnoDB();
+ }
+
+ public function tearDown() {
+ $this->connection->getSchemaManager()->dropTable($this->tableName);
+ }
+
+ public function testInnoDBConvert() {
+ $result = $this->countMyIsamTables();
+ $this->assertEquals(1, $result);
+
+ $this->repair->run();
+
+ $result = $this->countMyIsamTables();
+ $this->assertEquals(0, $result);
+ }
+
+ /**
+ * @param $dbName
+ * @return mixed
+ */
+ private function countMyIsamTables() {
+ $dbName = \OC::$server->getConfig()->getSystemValue("dbname");
+
+ $result = $this->connection->fetchColumn(
+ "SELECT count(*) FROM information_schema.tables WHERE table_schema = ? and table_name = ? AND engine = 'MyISAM'",
+ array($dbName, $this->tableName)
+ );
+ return $result;
+ }
+}