prepare SQL query only once, that's what prepared statements are for. Should improve upgrade time with larger setups

remotes/origin/stable5
Arthur Schiwon 12 years ago
parent 972243d564
commit 85d6a08ae9
  1. 4
      apps/files/appinfo/update.php

@ -5,10 +5,10 @@ $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] != '{' ) {
$query = OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertyname` = ? WHERE `userid` = ? AND `propertypath` = ?' );
$query->execute( array( '{DAV:}' + $row["propertyname"], $row["userid"], $row["propertypath"] ));
$updateQuery->execute(array('{DAV:}' + $row["propertyname"], $row["userid"], $row["propertypath"]));
}
}
}

Loading…
Cancel
Save