perform attach_upgrade()

This commit is contained in:
zotlabs
2017-03-20 21:53:39 -07:00
committed by Mario Vavti
parent d95f7efea7
commit 515f1e76b0
2 changed files with 26 additions and 0 deletions

View File

@@ -2320,3 +2320,26 @@ function attach_syspaths($channel_id,$attach_hash) {
}
function attach_upgrade() {
$r = q("select id, uid, hash from attach where os_path = '' and display_path = '' limit 100");
if($r) {
foreach($r as $rv) {
$x = attach_syspaths($rv['uid'],$rv['hash']);
if($x) {
$w = q("update attach set os_path = '%s', display_path = '%s' where id = %d",
dbesc($x['os_path']),
dbesc($x['path']),
intval($rv['id'])
);
$y = q("update photo set os_path = '%s', display_path = '%s' where uid = %d and resource_id = '%s'",
dbesc($x['os_path']),
dbesc($x['path']),
intval($rv['uid']),
dbesc($rv['hash'])
);
}
}
}
}