aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_encryption/exception/encryptionexception.php2
-rw-r--r--apps/files_encryption/lib/stream.php2
-rw-r--r--lib/private/tags.php2
-rw-r--r--tests/lib/tags.php32
4 files changed, 32 insertions, 6 deletions
diff --git a/apps/files_encryption/exception/encryptionexception.php b/apps/files_encryption/exception/encryptionexception.php
index 2fb679e91d2..24ffaff6f73 100644
--- a/apps/files_encryption/exception/encryptionexception.php
+++ b/apps/files_encryption/exception/encryptionexception.php
@@ -40,7 +40,7 @@ namespace OCA\Files_Encryption\Exception;
class EncryptionException extends \Exception {
const GENERIC = 10;
const UNEXPECTED_END_OF_ENCRYPTION_HEADER = 20;
- const UNEXPECTED_BLOG_SIZE = 30;
+ const UNEXPECTED_BLOCK_SIZE = 30;
const ENCRYPTION_HEADER_TO_LARGE = 40;
const UNKNOWN_CIPHER = 50;
const ENCRYPTION_FAILED = 60;
diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index b039e808c24..644ac895a8f 100644
--- a/apps/files_encryption/lib/stream.php
+++ b/apps/files_encryption/lib/stream.php
@@ -260,7 +260,7 @@ class Stream {
if ($count !== Crypt::BLOCKSIZE) {
\OCP\Util::writeLog('Encryption library', 'PHP "bug" 21641 no longer holds, decryption system requires refactoring', \OCP\Util::FATAL);
- throw new EncryptionException('expected a blog size of 8192 byte', EncryptionException::UNEXPECTED_BLOG_SIZE);
+ throw new EncryptionException('expected a block size of 8192 byte', EncryptionException::UNEXPECTED_BLOCK_SIZE);
}
// Get the data from the file handle
diff --git a/lib/private/tags.php b/lib/private/tags.php
index 9ff433b6984..4d737e47e07 100644
--- a/lib/private/tags.php
+++ b/lib/private/tags.php
@@ -211,7 +211,7 @@ class Tags implements \OCP\ITags {
try {
$conn = \OC_DB::getConnection();
- $chunks = array_chunk($objIds, 1000, false);
+ $chunks = array_chunk($objIds, 900, false);
foreach ($chunks as $chunk) {
$result = $conn->executeQuery(
'SELECT `category`, `categoryid`, `objid` ' .
diff --git a/tests/lib/tags.php b/tests/lib/tags.php
index 71296d2e346..547cd302d5d 100644
--- a/tests/lib/tags.php
+++ b/tests/lib/tags.php
@@ -30,7 +30,7 @@ class Test_Tags extends \Test\TestCase {
protected $backupGlobals = FALSE;
/** @var \OC\Tagging\TagMapper */
protected $tagMapper;
- /** @var \OC\TagManager */
+ /** @var \OCP\ITagManager */
protected $tagMgr;
protected function setUp() {
@@ -55,8 +55,9 @@ class Test_Tags extends \Test\TestCase {
}
protected function tearDown() {
- //$query = OC_DB::prepare('DELETE FROM `*PREFIX*vcategories` WHERE `item_type` = ?');
- //$query->execute(array('test'));
+ $conn = \OC_DB::getConnection();
+ $conn->executeQuery('DELETE FROM `*PREFIX*vcategory_to_object`');
+ $conn->executeQuery('DELETE FROM `*PREFIX*vcategory`');
parent::tearDown();
}
@@ -176,6 +177,31 @@ class Test_Tags extends \Test\TestCase {
);
}
+ public function testGetTagsForObjectsMassiveResults() {
+ $defaultTags = array('tag1');
+ $tagger = $this->tagMgr->load($this->objectType, $defaultTags);
+ $tagData = $tagger->getTags();
+ $tagId = $tagData[0]['id'];
+ $tagType = $tagData[0]['type'];
+
+ $conn = \OC_DB::getConnection();
+ $statement = $conn->prepare(
+ 'INSERT INTO `*PREFIX*vcategory_to_object` ' .
+ '(`objid`, `categoryid`, `type`) VALUES ' .
+ '(?, ?, ?)'
+ );
+
+ // insert lots of entries
+ $idsArray = array();
+ for($i = 1; $i <= 1500; $i++) {
+ $statement->execute(array($i, $tagId, $tagType));
+ $idsArray[] = $i;
+ }
+
+ $tags = $tagger->getTagsForObjects($idsArray);
+ $this->assertEquals(1500, count($tags));
+ }
+
public function testDeleteTags() {
$defaultTags = array('Friends', 'Family', 'Work', 'Other');
$tagger = $this->tagMgr->load($this->objectType, $defaultTags);