cloudsuite: Construct more reasonable names + copy mtime.
So that we are able to use the cloudsuite tile caching.
This commit is contained in:
parent
91e49449f3
commit
e587fce1da
@ -145,9 +145,19 @@ class DocumentController extends Controller{
|
|||||||
|
|
||||||
$content = $view->file_get_contents($path);
|
$content = $view->file_get_contents($path);
|
||||||
|
|
||||||
$filename = tempnam(dirname(__DIR__) . self::CLOUDSUITE_TMP_PATH, 'ccs-');
|
// copy; the first user gets a predictable filename so that cloudsuite
|
||||||
|
// uses the tile cache, others get tempnam
|
||||||
|
$filename = dirname(__DIR__) . self::CLOUDSUITE_TMP_PATH . 'ccs-' . $fileId;
|
||||||
|
if (file_exists($filename))
|
||||||
|
$filename = tempnam(dirname(__DIR__) . self::CLOUDSUITE_TMP_PATH, 'ccs-' . $fileId . '-');
|
||||||
|
|
||||||
file_put_contents($filename, $content);
|
file_put_contents($filename, $content);
|
||||||
|
|
||||||
|
// set the needed attribs
|
||||||
chmod($filename, 0660);
|
chmod($filename, 0660);
|
||||||
|
$modified = $view->filemtime($path);
|
||||||
|
if ($modified !== false)
|
||||||
|
touch($filename, $modified);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'status' => 'success', 'filename' => $filename,
|
'status' => 'success', 'filename' => $filename,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user