PHRAS-1164_Backport-PHRAS-1158-to-4.0

#time 20m
This commit is contained in:
Jean-Yves Gaulier
2016-06-16 16:02:26 +02:00
parent 1e900543f7
commit 9e891d4ae9
4 changed files with 41 additions and 10 deletions

View File

@@ -1292,6 +1292,29 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
return null;
}
public function clearStampCache()
{
$connection = $this->getDataboxConnection();
$sql = "SELECT path, file FROM record r INNER JOIN subdef s USING(record_id)\n"
. "WHERE r.type='image' AND s.name IN ('preview', 'document') AND record_id = :record_id";
$params = [
':record_id' => $this->getRecordId()
];
$stmt = $connection->prepare($sql);
$stmt->execute($params);
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
@unlink(\p4string::addEndSlash($row['path']) . 'stamp_' . $row['file']);
}
$stmt->closeCursor();
return $this;
}
/**
* @return array[] list of deleted files real paths
*/