]> source.dussan.org Git - nextcloud-server.git/commitdiff
Actually we want to update the mimetype of all files ending with the suffix
authorJoas Schilling <coding@schilljs.com>
Thu, 11 May 2017 08:57:20 +0000 (10:57 +0200)
committerJoas Schilling <coding@schilljs.com>
Thu, 11 May 2017 08:58:21 +0000 (10:58 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Files/Type/Loader.php

index bc3c2f1c9e647ef7fe26fcf3085fbb47b1403d68..41093689094dc1468a245e9b103253541184b7dd 100644 (file)
@@ -158,7 +158,7 @@ class Loader implements IMimeTypeLoader {
         * @return int number of changed rows
         */
        public function updateFilecache($ext, $mimetypeId) {
-               $is_folderId = $this->getId('httpd/unix-directory');
+               $isFolderId = $this->getId('httpd/unix-directory');
                $update = $this->dbConnection->getQueryBuilder();
                $update->update('filecache')
                        ->set('mimetype', $update->createNamedParameter($mimetypeId))
@@ -166,10 +166,11 @@ class Loader implements IMimeTypeLoader {
                                'mimetype', $update->createNamedParameter($mimetypeId)
                        ))
                        ->andwhere($update->expr()->neq(
-                               'mimetype', $update->createNamedParameter($is_folderId)
+                               'mimetype', $update->createNamedParameter($isFolderId)
                        ))
                        ->andWhere($update->expr()->like(
-                               $update->createFunction('LOWER(`name`)'), $update->createNamedParameter($ext)
+                               $update->createFunction('LOWER(' . $update->getColumnName('name') . ')'),
+                               '%' . $this->dbConnection->escapeLikeParameter($update->createNamedParameter('.' . $ext))
                        ));
                return $update->execute();
        }