Commit a72eecc3 authored by Leonardo Arena's avatar Leonardo Arena

main/owncloud: fix upgrade on postgres. Fixes #2436

(cherry picked from commit 6e524d21)
parent 43ab9a95
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname="owncloud"
pkgver="5.0.13"
pkgrel=0
pkgrel=1
pkgdesc="Your own WebDAV-based cloud service"
url="http://owncloud.org"
arch="noarch"
......@@ -16,13 +16,18 @@ subpackages="$pkgname-pgsql $pkgname-sqlite $pkgname-mysql
replaces="$pkgname-plugins"
source="http://download.owncloud.org/community/$pkgname-$pkgver.tar.bz2
owncloud.config.php
owncloud-5.0.13-remove-shares-where-files-do-not-exist-postgres.patch
"
_builddir="$srcdir"/$pkgname
prepare() {
cd "$_builddir"
return 0
for i in $source; do
case $i in
*.patch) msg "Applying patch $i"; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
}
build() {
......@@ -88,8 +93,11 @@ videoviewer() {
md5sums="4ce4cf5de3fdf1f70666549c5ecfda7a owncloud-5.0.13.tar.bz2
7d90d633c7ef408773854dbacab6d33b owncloud.config.php"
7d90d633c7ef408773854dbacab6d33b owncloud.config.php
e033c3211983429ef811ffea8159bb46 owncloud-5.0.13-remove-shares-where-files-do-not-exist-postgres.patch"
sha256sums="8a64ab8cc2ae4c71713a2922e5fbcda029de8ab2cf4dee04e15f041be48aa326 owncloud-5.0.13.tar.bz2
8f63333fd298fcf806f1faaed49e472ef076678d012324015fb518d266fcad10 owncloud.config.php"
8f63333fd298fcf806f1faaed49e472ef076678d012324015fb518d266fcad10 owncloud.config.php
0dc56930cc725def606aabdb3ba380fc38daa203b4544ddde523a7d1f962ade8 owncloud-5.0.13-remove-shares-where-files-do-not-exist-postgres.patch"
sha512sums="53256c5afb6ea2537f5dcc685db59b1af5ed6a5a4a0608af8a106f67db3179eae4bff07b7a2c84e0416720c1b7f12686acde7121dbdd21dedeb36c49e569c195 owncloud-5.0.13.tar.bz2
5c3cbc93e2720a5aaf64fee44d64b4679984b3b18ab3be31c1b30b6db5d7c34db784bd78a2355d5cbb690e8c4cb5299ae9da42197b21f0aee9e8e7be78c92c25 owncloud.config.php"
5c3cbc93e2720a5aaf64fee44d64b4679984b3b18ab3be31c1b30b6db5d7c34db784bd78a2355d5cbb690e8c4cb5299ae9da42197b21f0aee9e8e7be78c92c25 owncloud.config.php
1c05b9c96c92e74d0b603fe76facb4fc9510dbb18dc210cd0b073ca2776886416303abb28d66266982a60e67aa6c7ba06c2ad45dfd926f3a6260f58f1a90e882 owncloud-5.0.13-remove-shares-where-files-do-not-exist-postgres.patch"
From 8509994c2a7f3cdddbb48b8a1f6a952b437a315c Mon Sep 17 00:00:00 2001
From: Jamie McClelland <jm@mayfirst.org>
Date: Sat, 23 Nov 2013 19:47:45 -0500
Subject: [PATCH] fix update to remove shares where file doesn't exist on
postgres
Without patch, breaks with: Failed to upgrade "files_sharing".
Exception="SQLSTATE[22P02]: Invalid text representation: 7 ERROR:
invalid input syntax for integer: "5,179""
See: https://github.com/owncloud/core/issues/5758
---
apps/files_sharing/appinfo/update.php | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/apps/files_sharing/appinfo/update.php b/apps/files_sharing/appinfo/update.php
index 0d827da..721b53e 100644
--- a/apps/files_sharing/appinfo/update.php
+++ b/apps/files_sharing/appinfo/update.php
@@ -71,18 +71,7 @@
// clean up oc_share table from files which are no longer exists
if (version_compare($installedVersion, '0.3.5', '<')) {
-
- // get all shares where the original file no longer exists
- $findShares = \OC_DB::prepare('SELECT `file_source` FROM `*PREFIX*share` LEFT JOIN `*PREFIX*filecache` ON `file_source` = `*PREFIX*filecache`.`fileid` WHERE `*PREFIX*filecache`.`fileid` IS NULL AND `*PREFIX*share`.`item_type` IN (\'file\', \'folder\')');
- $sharesFound = $findShares->execute(array())->fetchAll();
-
- // delete those shares from the oc_share table
- if (is_array($sharesFound) && !empty($sharesFound)) {
- $delArray = array();
- foreach ($sharesFound as $share) {
- $delArray[] = $share['file_source'];
- }
- $removeShares = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `file_source` IN (?)');
- $result = $removeShares->execute(array(implode(',', $delArray)));
- }
+ // delete all shares where the original file no longer exists
+ $removeShares = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `file_source` IN (SELECT `file_source` FROM `*PREFIX*share` LEFT JOIN `*PREFIX*filecache` ON `file_source` = `*PREFIX*filecache`.`fileid` WHERE `*PREFIX*filecache`.`fileid` IS NULL AND `*PREFIX*share`.`item_type` IN (\'file\', \'folder\'))');
+ $result = $removeShares->execute(array(implode(',', $delArray)));
}
--
1.8.4
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment