Merge pull request #4799 from owncloud/tune_legacy_cache_webdav_properties_prefixing_master

Concatenate string in SQL instead of PHP
This commit is contained in:
Jan-Christoph Borchardt 2014-02-19 11:58:48 +01:00
commit 7330f61a94
1 changed files with 8 additions and 11 deletions

View File

@ -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