[Pkg-owncloud-commits] [owncloud] 01/134: Concatenate string in SQL instead of PHP, use doctrine to construct concat expression
David Prévot
taffit at moszumanska.debian.org
Fri Apr 18 21:43:54 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 3520529430c399e86ae083e7cd7b2bd2e96271e2
Author: Jörn Friedrich Dreyer <jfd at butonic.de>
Date: Wed Feb 19 12:06:04 2014 +0100
Concatenate string in SQL instead of PHP, use doctrine to construct concat expression
---
apps/files/appinfo/update.php | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/apps/files/appinfo/update.php b/apps/files/appinfo/update.php
index 3503678..f920f84 100644
--- a/apps/files/appinfo/update.php
+++ b/apps/files/appinfo/update.php
@@ -3,17 +3,14 @@
// fix webdav properties,add namespace in front of the property, update for OC4.5
$installedVersion=OCP\Config::getAppValue('files', 'installed_version');
if (version_compare($installedVersion, '1.1.6', '<')) {
- $query = OC_DB::prepare( 'SELECT `propertyname`, `propertypath`, `userid` FROM `*PREFIX*properties`' );
- $result = $query->execute();
- $updateQuery = OC_DB::prepare('UPDATE `*PREFIX*properties`'
- .' SET `propertyname` = ?'
- .' WHERE `userid` = ?'
- .' AND `propertypath` = ?');
- while( $row = $result->fetchRow()) {
- if ( $row['propertyname'][0] != '{' ) {
- $updateQuery->execute(array('{DAV:}' + $row['propertyname'], $row['userid'], $row['propertypath']));
- }
- }
+ $concat = OC_DB::getConnection()->getDatabasePlatform()->
+ getConcatExpression( '\'{DAV:}\'', '`propertyname`' );
+ $query = OC_DB::prepare('
+ UPDATE `*PREFIX*properties`
+ SET `propertyname` = ' . $concat . '
+ WHERE `propertyname` NOT LIKE \'{%\'
+ ');
+ $query->execute();
}
//update from OC 3
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list