mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 20:13:28 +00:00
Merge branch '3.8'
This commit is contained in:
@@ -33,27 +33,26 @@ class XSendFileConfigurationDumper extends Command
|
|||||||
$output->writeln('');
|
$output->writeln('');
|
||||||
|
|
||||||
if (!$this->container['phraseanet.xsendfile-factory']->isXSendFileModeEnabled()) {
|
if (!$this->container['phraseanet.xsendfile-factory']->isXSendFileModeEnabled()) {
|
||||||
$output->writeln('XSendFile support is <error>disabled</error>');
|
$output->writeln('XSendFile support is <error>disabled</error>, enable it to use this feature.');
|
||||||
|
$ret = 1;
|
||||||
return 1;
|
} else {
|
||||||
|
$output->writeln('XSendFile support is <info>enabled</info>');
|
||||||
|
$ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output->writeln('XSendFile support is <info>enabled</info>');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$configuration = $this->container['phraseanet.xsendfile-factory']->getMode(true)->getVirtualHostConfiguration();
|
$configuration = $this->container['phraseanet.xsendfile-factory']->getMode(true, true)->getVirtualHostConfiguration();
|
||||||
$output->writeln('XSendFile configuration seems <info>OK</info>');
|
$output->writeln('XSendFile configuration seems <info>OK</info>');
|
||||||
$output->writeln($configuration);
|
$output->writeln($configuration);
|
||||||
|
|
||||||
return 0;
|
|
||||||
} catch (RuntimeException $e) {
|
} catch (RuntimeException $e) {
|
||||||
$output->writeln('XSendFile configuration seems <error>invalid</error>');
|
$output->writeln('XSendFile configuration seems <error>invalid</error>');
|
||||||
|
|
||||||
return 1;
|
$ret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output->writeln('');
|
$output->writeln('');
|
||||||
|
|
||||||
return 0;
|
return $ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -56,13 +56,15 @@ class XSendFileMappingGenerator extends Command
|
|||||||
$this->container['conf']->set('xsendfile', $conf);
|
$this->container['conf']->set('xsendfile', $conf);
|
||||||
$output->writeln(" <info>OK</info>");
|
$output->writeln(" <info>OK</info>");
|
||||||
$output->writeln("");
|
$output->writeln("");
|
||||||
$output->write("It is now strongly recommended to use <info>xsendfile:dump-configuration</info> command to upgrade your virtual-host");
|
$output->writeln("It is now strongly recommended to use <info>xsendfile:dump-configuration</info> command to upgrade your virtual-host");
|
||||||
} else {
|
} else {
|
||||||
$output->writeln("Configuration will <info>not</info> be written, use <info>--write</info> option to write it");
|
$output->writeln("Configuration will <info>not</info> be written, use <info>--write</info> option to write it");
|
||||||
$output->writeln("");
|
$output->writeln("");
|
||||||
$output->writeln(Yaml::dump(['xsendfile' => $conf], 4));
|
$output->writeln(Yaml::dump(['xsendfile' => $conf], 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$output->writeln("");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,9 +66,9 @@ class XSendFileFactory
|
|||||||
*
|
*
|
||||||
* @throws InvalidArgumentException if mode type is unknown
|
* @throws InvalidArgumentException if mode type is unknown
|
||||||
*/
|
*/
|
||||||
public function getMode($throwException = false)
|
public function getMode($throwException = false, $forceMode = false)
|
||||||
{
|
{
|
||||||
if (false === $this->enabled) {
|
if (false === $this->enabled && true !== $forceMode) {
|
||||||
return new NullMode();
|
return new NullMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -95,6 +95,9 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
|||||||
*/
|
*/
|
||||||
protected $is_physically_present = false;
|
protected $is_physically_present = false;
|
||||||
|
|
||||||
|
/** @var integer */
|
||||||
|
private $size = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Players types constants
|
* Players types constants
|
||||||
*/
|
*/
|
||||||
@@ -162,6 +165,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
|||||||
$this->mime = $datas['mime'];
|
$this->mime = $datas['mime'];
|
||||||
$this->width = $datas['width'];
|
$this->width = $datas['width'];
|
||||||
$this->height = $datas['height'];
|
$this->height = $datas['height'];
|
||||||
|
$this->size = $datas['size'];
|
||||||
$this->etag = $datas['etag'];
|
$this->etag = $datas['etag'];
|
||||||
$this->path = $datas['path'];
|
$this->path = $datas['path'];
|
||||||
$this->url = $datas['url'];
|
$this->url = $datas['url'];
|
||||||
@@ -197,6 +201,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
|||||||
if ($row) {
|
if ($row) {
|
||||||
|
|
||||||
$this->width = (int) $row['width'];
|
$this->width = (int) $row['width'];
|
||||||
|
$this->size = (int) $row['size'];
|
||||||
$this->height = (int) $row['height'];
|
$this->height = (int) $row['height'];
|
||||||
$this->mime = $row['mime'];
|
$this->mime = $row['mime'];
|
||||||
$this->file = $row['file'];
|
$this->file = $row['file'];
|
||||||
@@ -222,6 +227,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
|||||||
$datas = [
|
$datas = [
|
||||||
'mime' => $this->mime
|
'mime' => $this->mime
|
||||||
, 'width' => $this->width
|
, 'width' => $this->width
|
||||||
|
, 'size' => $this->size
|
||||||
, 'height' => $this->height
|
, 'height' => $this->height
|
||||||
, 'etag' => $this->etag
|
, 'etag' => $this->etag
|
||||||
, 'path' => $this->path
|
, 'path' => $this->path
|
||||||
@@ -441,7 +447,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
|||||||
*/
|
*/
|
||||||
public function get_size()
|
public function get_size()
|
||||||
{
|
{
|
||||||
return (int) @filesize($this->get_pathfile());
|
return $this->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user