mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 04:23:19 +00:00
Fix document substitution
This commit is contained in:
@@ -537,6 +537,7 @@ class Application extends SilexApplication
|
||||
$this['root.path'] = realpath(__DIR__ . '/../../..');
|
||||
// temporary resources default path such as download zip, quarantined documents etc ..
|
||||
$this['tmp.path'] = getenv('PHRASEANET_TMP') ?: $this['root.path'].'/tmp';
|
||||
|
||||
// plugin path
|
||||
$this['plugin.path'] = $this['root.path'].'/plugins';
|
||||
// thumbnails path
|
||||
|
@@ -46,8 +46,10 @@ class TaskManagerController extends Controller
|
||||
|
||||
$this->getDispatcher()->addListener(KernelEvents::TERMINATE, function () use ($cmdLine) {
|
||||
$process = new Process($cmdLine);
|
||||
|
||||
$process->setTimeout(0);
|
||||
$process->disableOutput();
|
||||
|
||||
set_time_limit(0);
|
||||
ignore_user_abort(true);
|
||||
|
||||
@@ -65,6 +67,7 @@ class TaskManagerController extends Controller
|
||||
|
||||
$info = $this->getLiveInformationRequest();
|
||||
$data = $info->getManager();
|
||||
|
||||
if (null !== $pid = $data['process-id']) {
|
||||
if (substr(php_uname(), 0, 7) == "Windows"){
|
||||
exec(sprintf('TaskKill /PID %d', $pid));
|
||||
|
@@ -186,8 +186,10 @@ class ToolsController extends Controller
|
||||
try {
|
||||
|
||||
$tempoDir = tempnam(sys_get_temp_dir(), 'substit');
|
||||
|
||||
unlink($tempoDir);
|
||||
mkdir($tempoDir);
|
||||
|
||||
$tempoFile = $tempoDir . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
if (false === rename($file->getPathname(), $tempoFile)) {
|
||||
|
@@ -115,6 +115,7 @@ class FilesystemService
|
||||
* @param \databox $databox
|
||||
* @param string $source
|
||||
* @param string $filename
|
||||
* @return string
|
||||
*/
|
||||
public function writeMediaSourceFile(\databox $databox, $source, $filename)
|
||||
{
|
||||
@@ -122,6 +123,8 @@ class FilesystemService
|
||||
|
||||
$this->filesystem->copy($source, $realPath, true);
|
||||
$this->filesystem->chmod($realPath, 0760);
|
||||
|
||||
return $realPath;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -67,9 +67,9 @@ class SubdefSubstituer
|
||||
$source = $file->getRealPath();
|
||||
$target = $this->fs->generateDocumentFilename($record, $file);
|
||||
|
||||
$this->fs->writeMediaSourceFile($record->getDatabox(), $source, $target);
|
||||
$target = $this->fs->writeMediaSourceFile($record->getDatabox(), $source, $target);
|
||||
|
||||
$media = $this->mediavorus->guess($source);
|
||||
$media = $this->mediavorus->guess($target);
|
||||
|
||||
$this->createMediaSubdef($record, 'document', $media);
|
||||
|
||||
|
@@ -656,10 +656,12 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
||||
$params['height'] = $media->getHeight();
|
||||
}
|
||||
|
||||
/** @var callable $factoryProvider */
|
||||
$factoryProvider = $app['provider.factory.media_subdef'];
|
||||
$factory = $factoryProvider($record->getDataboxId());
|
||||
|
||||
$subdef = $factory($params);
|
||||
|
||||
Assertion::isInstanceOf($subdef, \media_subdef::class);
|
||||
|
||||
$repository = self::getMediaSubdefRepository($app, $record->getDataboxId());
|
||||
|
Reference in New Issue
Block a user