the rest of the schema updates - WARNING: some third party plugins may fail; e.g. embedphotos and chess. $item['object'] is now $item['obj'] and $photo['type'] is $photo['mimetype'], $photo['scale'] is $photo['imgscale'] and $photo['data'] is now $photo['content']. There are a number of other changes, but these are the ones noted to cause issues with third-party plugins. The project plugins have been updated. Please note any new issues as this effort touched a lot of code in a lot of files.

This commit is contained in:
redmatrix
2016-06-01 21:48:54 -07:00
parent b1259876bf
commit a9d7acda27
42 changed files with 541 additions and 616 deletions

View File

@@ -974,6 +974,11 @@ function sync_files($channel,$files) {
$attachment_stored = false;
foreach($f['attach'] as $att) {
if(array_key_exists('data',$att)) {
$att['content'] = $att['data'];
unset($att['data']);
}
if($att['deleted']) {
attach_delete($channel,$att['hash']);
continue;
@@ -1043,7 +1048,7 @@ function sync_files($channel,$files) {
// @fixme - update attachment structures if they are modified rather than created
$att['data'] = $newfname;
$att['content'] = $newfname;
// Note: we use $att['hash'] below after it has been escaped to
// fetch the file contents.
@@ -1125,6 +1130,15 @@ function sync_files($channel,$files) {
$p['aid'] = $channel['channel_account_id'];
$p['uid'] = $channel['channel_id'];
if(array_key_exists('data',$p)) {
$p['content'] = $p['data'];
unset($p['data']);
}
if(array_key_exists('scale',$p)) {
$p['imgscale'] = $p['scale'];
unset($p['scale']);
}
// if this is a profile photo, undo the profile photo bit
// for any other photo which previously held it.
@@ -1150,15 +1164,15 @@ function sync_files($channel,$files) {
);
}
if($p['scale'] === 0 && $p['os_storage'])
$p['data'] = $store_path;
if($p['imgscale'] === 0 && $p['os_storage'])
$p['content'] = $store_path;
else
$p['data'] = base64_decode($p['data']);
$p['content'] = base64_decode($p['content']);
$exists = q("select * from photo where resource_id = '%s' and scale = %d and uid = %d limit 1",
$exists = q("select * from photo where resource_id = '%s' and imgscale = %d and uid = %d limit 1",
dbesc($p['resource_id']),
intval($p['scale']),
intval($p['imgscale']),
intval($channel['channel_id'])
);