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 // fix webdav properties,add namespace in front of the property, update for OC4.5
$installedVersion=OCP\Config::getAppValue('files', 'installed_version'); $installedVersion=OCP\Config::getAppValue('files', 'installed_version');
if (version_compare($installedVersion, '1.1.6', '<')) { if (version_compare($installedVersion, '1.1.6', '<')) {
$query = OC_DB::prepare( 'SELECT `propertyname`, `propertypath`, `userid` FROM `*PREFIX*properties`' ); $concat = OC_DB::getConnection()->getDatabasePlatform()->
$result = $query->execute(); getConcatExpression( '\'{DAV:}\'', '`propertyname`' );
$updateQuery = OC_DB::prepare('UPDATE `*PREFIX*properties`' $query = OC_DB::prepare('
.' SET `propertyname` = ?' UPDATE `*PREFIX*properties`
.' WHERE `userid` = ?' SET `propertyname` = ' . $concat . '
.' AND `propertypath` = ?'); WHERE `propertyname` NOT LIKE \'{%\'
while( $row = $result->fetchRow()) { ');
if ( $row['propertyname'][0] != '{' ) { $query->execute();
$updateQuery->execute(array('{DAV:}' + $row['propertyname'], $row['userid'], $row['propertypath']));
}
}
} }
//update from OC 3 //update from OC 3