1 <?php # vim:ts=2:sw=2:et:
2 # Convert attachments so that a copy of blob lives in the db
4 echo "Migrating attachments\n";
5 $q = $db->prepare('update attachments set payload = ? where hash = ?');
7 foreach ($db->query('select hash from attachments')->fetchAll() as $row) {
8 $path = MTrackAttachment::local_path($row['hash']);
9 $fp = fopen($path, 'rb');
10 $q->bindValue(1, $fp, PDO::PARAM_LOB);
11 $q->bindValue(2, $row['hash']);