mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Merge with 3.7
This commit is contained in:
@@ -414,16 +414,17 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
),
|
||||
),
|
||||
'binary' => array(
|
||||
'phpCli' => $app['phraseanet.registry']->get('GV_cli'),
|
||||
'phpCli' => $app['phraseanet.registry']->get('php_binary'),
|
||||
'phpIni' => $app['phraseanet.registry']->get('GV_PHP_INI'),
|
||||
'imagick' => $app['phraseanet.registry']->get('GV_imagick'),
|
||||
'swfExtract' => $app['phraseanet.registry']->get('GV_swf_extract'),
|
||||
'pdf2swf' => $app['phraseanet.registry']->get('GV_pdf2swf'),
|
||||
'swfRender' => $app['phraseanet.registry']->get('GV_swf_render'),
|
||||
'unoconv' => $app['phraseanet.registry']->get('GV_unoconv'),
|
||||
'ffmpeg' => $app['phraseanet.registry']->get('GV_ffmpeg'),
|
||||
'mp4box' => $app['phraseanet.registry']->get('GV_mp4box'),
|
||||
'pdftotext' => $app['phraseanet.registry']->get('GV_pdftotext'),
|
||||
'imagick' => $app['phraseanet.registry']->get('convert_binary'),
|
||||
'swfExtract' => $app['phraseanet.registry']->get('swf_extract_binary'),
|
||||
'pdf2swf' => $app['phraseanet.registry']->get('pdf2swf_binary'),
|
||||
'swfRender' => $app['phraseanet.registry']->get('swf_render_binary'),
|
||||
'unoconv' => $app['phraseanet.registry']->get('unoconv_binary'),
|
||||
'ffmpeg' => $app['phraseanet.registry']->get('ffmpeg_binary'),
|
||||
'ffprobe' => $app['phraseanet.registry']->get('ffprobe_binary'),
|
||||
'mp4box' => $app['phraseanet.registry']->get('mp4box_binary'),
|
||||
'pdftotext' => $app['phraseanet.registry']->get('pdftotext_binary'),
|
||||
'pdfmaxpages' => $app['phraseanet.registry']->get('GV_pdfmaxpages'),),
|
||||
'mainConfiguration' => array(
|
||||
'adminMail' => $app['phraseanet.registry']->get('GV_adminMail'),
|
||||
|
@@ -82,7 +82,7 @@ class connection
|
||||
}
|
||||
$string .= "\nPOST datas :\n ";
|
||||
foreach ($_POST as $key => $value) {
|
||||
$string .= "\t\t" . $key . ' = ' . $value . "\n";
|
||||
$string .= "\t\t" . $key . ' = ' . (is_scalar($value) ? $value : 'non-scalar value') . "\n";
|
||||
}
|
||||
$string .= "\n\n\n\n";
|
||||
|
||||
|
@@ -15,9 +15,11 @@
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Process\ProcessBuilder;
|
||||
|
||||
class module_console_sphinxGenerateSuggestion extends Command
|
||||
{
|
||||
@@ -59,15 +61,21 @@ class module_console_sphinxGenerateSuggestion extends Command
|
||||
return 1;
|
||||
}
|
||||
|
||||
$builder = ProcessBuilder::create(array('/usr/local/bin/indexer'));
|
||||
$builder->add('metadatas' . $index)
|
||||
->add('--buildstops')
|
||||
->add($tmp_file)
|
||||
->add(1000000)
|
||||
->add('--buildfreqs');
|
||||
|
||||
$builder->getProcess()->run();
|
||||
|
||||
if ( ! file_exists($tmp_file)) {
|
||||
$output->writeln("<error> file '" . $tmp_file . "' does not exist</error>");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
$cmd = '/usr/local/bin/indexer metadatas' . $index . ' --buildstops ' . $tmp_file . ' 1000000 --buildfreqs';
|
||||
exec($cmd);
|
||||
|
||||
try {
|
||||
$connbas = connection::getPDOConnection($this->container, $sbas_id);
|
||||
} catch (Exception $e) {
|
||||
|
@@ -18,6 +18,7 @@
|
||||
use Alchemy\Phrasea\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Process\ProcessBuilder;
|
||||
|
||||
class module_console_systemBackupDB extends Command
|
||||
{
|
||||
@@ -64,18 +65,22 @@ class module_console_systemBackupDB extends Command
|
||||
|
||||
$output->write(sprintf('Generating %s ... ', $filename));
|
||||
|
||||
$command = sprintf(
|
||||
'mysqldump --host %s --port %s --user %s --password=%s'
|
||||
. ' --database %s --default-character-set=utf8 > %s'
|
||||
, $base->get_host()
|
||||
, $base->get_port()
|
||||
, $base->get_user()
|
||||
, $base->get_passwd()
|
||||
, $base->get_dbname()
|
||||
, escapeshellarg($filename)
|
||||
);
|
||||
$builder = ProcessBuilder::create(array(
|
||||
'mysqldump',
|
||||
'--host='.$base->get_host(),
|
||||
'--port='.$base->get_port(),
|
||||
'--user='.$base->get_user(),
|
||||
'--password='.$base->get_passwd(),
|
||||
'--databases', $base->get_dbname(),
|
||||
'--default-character-set=utf8'
|
||||
));
|
||||
|
||||
system($command);
|
||||
$proces = $builder->getProcess();
|
||||
$proces->run();
|
||||
|
||||
if ($proces->isSuccessful()) {
|
||||
file_put_contents($filename, $proces->getOutput());
|
||||
}
|
||||
|
||||
if (file_exists($filename) && filesize($filename) > 0) {
|
||||
$output->writeln('OK');
|
||||
|
135
lib/classes/patch/373.class.php
Normal file
135
lib/classes/patch/373.class.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
use Symfony\Component\Yaml\Dumper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class patch_373 implements patchInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.7.3';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
private $concern = array(base::APPLICATION_BOX);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_release()
|
||||
{
|
||||
return $this->release;
|
||||
}
|
||||
|
||||
public function require_all_upgrades()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Array
|
||||
*/
|
||||
public function concern()
|
||||
{
|
||||
return $this->concern;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param base $databox
|
||||
*/
|
||||
public function apply(base &$appbox)
|
||||
{
|
||||
$sql = 'SELECT * FROM registry WHERE `key` = :key';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
|
||||
$Regbinaries = array(
|
||||
'GV_cli',
|
||||
'GV_imagick',
|
||||
'GV_pathcomposite',
|
||||
'GV_swf_extract',
|
||||
'GV_pdf2swf',
|
||||
'GV_swf_render',
|
||||
'GV_unoconv',
|
||||
'GV_ffmpeg',
|
||||
'GV_ffprobe',
|
||||
'GV_mp4box',
|
||||
'GV_pdftotext',
|
||||
);
|
||||
|
||||
$mapping = array(
|
||||
'GV_cli' => 'php_binary',
|
||||
'GV_imagick' => 'convert_binary',
|
||||
'GV_pathcomposite' => 'composite_binary',
|
||||
'GV_swf_extract' => 'swf_extract_binary',
|
||||
'GV_pdf2swf' => 'pdf2swf_binary',
|
||||
'GV_swf_render' => 'swf_render_binary',
|
||||
'GV_unoconv' => 'unoconv_binary',
|
||||
'GV_ffmpeg' => 'ffmpeg_binary',
|
||||
'GV_ffprobe' => 'ffprobe_binary',
|
||||
'GV_mp4box' => 'mp4box_binary',
|
||||
'GV_pdftotext' => 'pdftotext_binary',
|
||||
);
|
||||
|
||||
foreach ($Regbinaries as $name) {
|
||||
$stmt->execute(array(':key' => $name));
|
||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$value = is_executable($row['value']) ? $row['value'] : '';
|
||||
|
||||
$binaries[$mapping[$name]] = $value;
|
||||
}
|
||||
|
||||
$stmt->closeCursor();
|
||||
|
||||
$configuration = Configuration::build();
|
||||
$configuration->setBinaries(array('binaries' => $binaries));
|
||||
|
||||
$sql = 'DELETE FROM registry WHERE `key` = :key';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
|
||||
foreach ($Regbinaries as $name) {
|
||||
$stmt->execute(array(':key' => $name));
|
||||
}
|
||||
|
||||
$stmt->closeCursor();
|
||||
|
||||
$GV_sit = null;
|
||||
|
||||
$sql = 'SELECT value FROM registry WHERE `key` = :key';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':key'=>'GV_sit'));
|
||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$configs = $configuration->getConfigurations();
|
||||
$configs['key'] = $row['value'];
|
||||
$configuration->setConfigurations($configs);
|
||||
|
||||
$sql = 'DELETE FROM registry WHERE `key` = :key';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':key'=>'GV_sit'));
|
||||
$stmt->closeCursor();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Symfony\Component\Process\ProcessBuilder;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -83,7 +84,7 @@ class recordutils_image extends recordutils
|
||||
return $subdef->get_pathfile();
|
||||
}
|
||||
|
||||
if ( ! $app['phraseanet.registry']->get('GV_imagick')) {
|
||||
if ( ! $app['phraseanet.registry']->get('convert_binary')) {
|
||||
return $subdef->get_pathfile();
|
||||
}
|
||||
|
||||
@@ -286,15 +287,15 @@ class recordutils_image extends recordutils
|
||||
|
||||
$newh = $image_height + $stampheight;
|
||||
|
||||
$cmd = $app['phraseanet.registry']->get('GV_imagick');
|
||||
$cmd .= ' -extent "' . $image_width . 'x' . $newh
|
||||
. '" -draw "image SrcOver 0,' . $image_height . ' '
|
||||
. $image_width . ',' . $stampheight . '\'' . $pathTmpStamp . '\'"';
|
||||
$builder = ProcessBuilder::create(array($app['phraseanet.registry']->get('convert_binary')));
|
||||
$builder->add('-extent')
|
||||
->add($image_width . 'x' . $newh)
|
||||
->add('-draw')
|
||||
->add('image SrcOver 0,' . $image_height . ' ' . $image_width . ',' . $stampheight . '"' . $pathTmpStamp . '"')
|
||||
->add($pathIn)
|
||||
->add($pathOut);
|
||||
|
||||
$cmd.= " \"" . $pathIn . "\""; # <<-- le doc original
|
||||
$cmd.= " \"" . $pathOut . "\""; # <-- le doc stampe
|
||||
|
||||
exec($cmd);
|
||||
$builder->getProcess()->run();
|
||||
|
||||
unlink($pathTmpStamp);
|
||||
|
||||
@@ -302,7 +303,7 @@ class recordutils_image extends recordutils
|
||||
return $pathOut;
|
||||
}
|
||||
|
||||
return $subdef->get_pathfile();;
|
||||
return $subdef->get_pathfile();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,7 +331,7 @@ class recordutils_image extends recordutils
|
||||
|
||||
$pathOut = $subdef->get_path() . 'watermark_' . $subdef->get_file();
|
||||
|
||||
if ( ! is_file($pathIn)) {
|
||||
if (!is_file($pathIn)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -339,32 +340,19 @@ class recordutils_image extends recordutils
|
||||
}
|
||||
|
||||
if ($app['phraseanet.registry']->get('GV_pathcomposite') &&
|
||||
file_exists($app['phraseanet.registry']->get('GV_RootPath') . 'config/wm/' . $base_id)) { // si il y a un WM
|
||||
$cmd = $app['phraseanet.registry']->get('GV_pathcomposite') . " ";
|
||||
$cmd .= $app['phraseanet.registry']->get('GV_RootPath') . 'config/wm/' . $base_id . " ";
|
||||
$cmd .= " \"" . $pathIn . "\" "; # <<-- la preview original
|
||||
$cmd .= " -strip -watermark 90% -gravity center ";
|
||||
$cmd .= " \"" . $pathOut . "\""; # <-- la preview temporaire
|
||||
file_exists($app['phraseanet.registry']->get('GV_RootPath') . 'config/wm/' . $base_id)) {
|
||||
|
||||
$descriptorspec = array(0 => array("pipe", "r"),
|
||||
1 => array("pipe", "w"),
|
||||
2 => array("pipe", "w")
|
||||
);
|
||||
$process = proc_open($cmd, $descriptorspec, $pipes);
|
||||
if (is_resource($process)) {
|
||||
fclose($pipes[0]);
|
||||
$err = "";
|
||||
while ( ! feof($pipes[1]))
|
||||
$out = fgets($pipes[1], 1024);
|
||||
fclose($pipes[1]);
|
||||
while ( ! feof($pipes[2]))
|
||||
$err .= fgets($pipes[2], 1024);
|
||||
fclose($pipes[2]);
|
||||
$return_value = proc_close($process);
|
||||
}
|
||||
} elseif ($app['phraseanet.registry']->get('GV_imagick')) {
|
||||
$builder = ProcessBuilder::create(array(
|
||||
$app['phraseanet.registry']->get('composite_binary'),
|
||||
$app['phraseanet.registry']->get('GV_RootPath') . 'config/wm/' . $base_id,
|
||||
$pathIn,
|
||||
'-strip', '-watermark', '90%', '-gravity', 'center',
|
||||
$pathOut
|
||||
));
|
||||
|
||||
$builder->getProcess()->run();
|
||||
} elseif ($app['phraseanet.registry']->get('convert_binary')) {
|
||||
$collname = phrasea::bas_names($base_id, $app);
|
||||
$cmd = $app['phraseanet.registry']->get('GV_imagick');
|
||||
$tailleimg = @getimagesize($pathIn);
|
||||
$max = ($tailleimg[0] > $tailleimg[1] ? $tailleimg[0] : $tailleimg[1]);
|
||||
|
||||
@@ -378,50 +366,23 @@ class recordutils_image extends recordutils
|
||||
else
|
||||
$decalage = 1;
|
||||
|
||||
$cmd .= " -fill white -draw \"line 0,0 "
|
||||
. $tailleimg[0] . "," . $tailleimg[1] . "\"";
|
||||
$cmd .= " -fill black -draw \"line 1,0 "
|
||||
. ($tailleimg[0] + 1) . "," . ($tailleimg[1]) . "\"";
|
||||
$builder = ProcessBuilder::create(array(
|
||||
$app['phraseanet.registry']->get('convert_binary'),
|
||||
'-fill', 'white', '-draw', 'line 0,0 ' . $tailleimg[0] . ',' . $tailleimg[1] . '',
|
||||
'-fill', 'black', '-draw', 'line 1,0 ' . $tailleimg[0] + 1 . ',' . $tailleimg[1] . '',
|
||||
'-fill', 'white', '-draw', 'line ' . $tailleimg[0] . ',0 0,' . $tailleimg[1] . '',
|
||||
'-fill', 'black', '-draw', 'line ' . ($tailleimg[0] + 1) . ',0 0,' . $tailleimg[1] . '',
|
||||
'-fill', 'white', '-gravity', 'NorthWest', '-pointsize', $tailleText, '-draw', 'text 0,0 ' . $collname,
|
||||
'-fill', 'black', '-gravity', 'NorthWest', '-pointsize', $tailleText, '-draw', 'text ' . $decalage . ', 1 ' . $collname,
|
||||
'-fill', 'white', '-gravity', 'center', '-pointsize', $tailleText, '-draw', 'text 0,0 ' . $collname,
|
||||
'-fill', 'black', '-gravity', 'center', '-pointsize', $tailleText, '-draw', 'text ' . $decalage . ', 1 ' . $collname,
|
||||
'-fill', 'white', '-gravity', 'SouthEast', '-pointsize', $tailleText, '-draw', 'text 0,0 ' . $collname,
|
||||
'-fill', 'black', '-gravity', 'SouthEast', '-pointsize', $tailleText, '-draw', 'text ' . $decalage . ', 1 ' . $collname,
|
||||
$pathIn, $pathOut
|
||||
));
|
||||
|
||||
$cmd .= " -fill white -draw \"line "
|
||||
. $tailleimg[0] . ",0 0," . $tailleimg[1] . "\"";
|
||||
$cmd .= " -fill black -draw \"line "
|
||||
. ($tailleimg[0] + 1) . ",0 1," . ($tailleimg[1]) . "\"";
|
||||
|
||||
$cmd .= " -fill white -gravity NorthWest -pointsize "
|
||||
. " $tailleText -draw \"text 0,0 '$collname'\"";
|
||||
$cmd .= " -fill black -gravity NorthWest -pointsize "
|
||||
. " $tailleText -draw \"text $decalage,1 '$collname'\"";
|
||||
|
||||
$cmd .= " -fill white -gravity center -pointsize "
|
||||
. " $tailleText -draw \"text 0,0 '$collname'\"";
|
||||
$cmd .= " -fill black -gravity center -pointsize "
|
||||
. " $tailleText -draw \"text $decalage,1 '$collname'\"";
|
||||
|
||||
$cmd .= " -fill white -gravity SouthEast -pointsize "
|
||||
. " $tailleText -draw \"text 0,0 '$collname'\"";
|
||||
$cmd .= " -fill black -gravity SouthEast -pointsize "
|
||||
. " $tailleText -draw \"text $decalage,1 '$collname'\"";
|
||||
|
||||
$cmd.= " \"" . $pathIn . "\""; # <<-- la preview original
|
||||
$cmd.= " \"" . $pathOut . "\""; # <-- la preview temporaire
|
||||
|
||||
$descriptorspec = array(0 => array("pipe", "r"),
|
||||
1 => array("pipe", "w"),
|
||||
2 => array("pipe", "w")
|
||||
);
|
||||
$process = proc_open($cmd, $descriptorspec, $pipes);
|
||||
if (is_resource($process)) {
|
||||
fclose($pipes[0]);
|
||||
$err = "";
|
||||
while ( ! feof($pipes[1]))
|
||||
$out = fgets($pipes[1], 1024);
|
||||
fclose($pipes[1]);
|
||||
while ( ! feof($pipes[2]))
|
||||
$err .= fgets($pipes[2], 1024);
|
||||
fclose($pipes[2]);
|
||||
$return_value = proc_close($process);
|
||||
}
|
||||
$process = $builder->getProcess();
|
||||
$process->run();
|
||||
}
|
||||
|
||||
if (is_file($pathOut)) {
|
||||
|
@@ -28,10 +28,13 @@ class registry implements registryInterface
|
||||
protected $app;
|
||||
|
||||
const TYPE_BOOLEAN = 'boolean';
|
||||
const TYPE_ARRAY = 'array';
|
||||
const TYPE_ENUM_MULTI = 'enum_multi';
|
||||
const TYPE_INTEGER = 'integer';
|
||||
const TYPE_ENUM = 'enum';
|
||||
const TYPE_STRING = 'string';
|
||||
const TYPE_TEXT = 'text';
|
||||
const TYPE_TIMEZONE = 'timezone';
|
||||
const TYPE_BINARY = 'binary';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -48,6 +51,19 @@ class registry implements registryInterface
|
||||
$this->cache->save('GV_ServerName', $app['phraseanet.configuration']->getPhraseanet()->get('servername'));
|
||||
$this->cache->save('GV_debug', $app['phraseanet.configuration']->isDebug());
|
||||
$this->cache->save('GV_maintenance', $app['phraseanet.configuration']->isMaintained());
|
||||
|
||||
$config = $app['phraseanet.configuration']->getConfigurations();
|
||||
|
||||
if (isset($config['key'])) {
|
||||
$this->cache->save('GV_sit', $config['key']);
|
||||
}
|
||||
|
||||
$binaries = $app['phraseanet.configuration']->getBinaries();
|
||||
if (isset($binaries['binaries'])) {
|
||||
foreach ($binaries['binaries'] as $name => $path) {
|
||||
$this->cache->save($name, $path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -86,10 +102,13 @@ class registry implements registryInterface
|
||||
$value = (int) $row['value'];
|
||||
break;
|
||||
case self::TYPE_ENUM_MULTI:
|
||||
case self::TYPE_ARRAY:
|
||||
$value = unserialize($row['value']);
|
||||
break;
|
||||
case self::TYPE_STRING:
|
||||
case self::TYPE_ENUM:
|
||||
case self::TYPE_TIMEZONE:
|
||||
case self::TYPE_TEXT:
|
||||
case self::TYPE_BINARY:
|
||||
default:
|
||||
$value = $row['value'];
|
||||
break;
|
||||
@@ -132,12 +151,15 @@ class registry implements registryInterface
|
||||
$this->load();
|
||||
|
||||
switch ($type) {
|
||||
case self::TYPE_ARRAY:
|
||||
case self::TYPE_ENUM_MULTI:
|
||||
$sql_value = serialize($value);
|
||||
$value = (array) $value;
|
||||
break;
|
||||
case self::TYPE_STRING;
|
||||
case self::TYPE_ENUM:
|
||||
case self::TYPE_TIMEZONE:
|
||||
case self::TYPE_TEXT:
|
||||
case self::TYPE_BINARY:
|
||||
default:
|
||||
$sql_value = (string) $value;
|
||||
$value = (string) $value;
|
||||
@@ -152,7 +174,11 @@ class registry implements registryInterface
|
||||
break;
|
||||
}
|
||||
|
||||
$conn = connection::getPDOConnection($this->app);
|
||||
if ($type == self::TYPE_BINARY) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$conn = connection::getPDOConnection();
|
||||
|
||||
$sql = 'REPLACE INTO registry (`id`, `key`, `value`, `type`)
|
||||
VALUES (null, :key, :value, :type)';
|
||||
|
@@ -97,13 +97,15 @@ class setup
|
||||
}
|
||||
}
|
||||
|
||||
$type = 'string';
|
||||
$type = $variable['type'];
|
||||
switch ($variable['type']) {
|
||||
case 'string':
|
||||
case 'password':
|
||||
case \registry::TYPE_STRING:
|
||||
case \registry::TYPE_BINARY:
|
||||
case \registry::TYPE_TEXT:
|
||||
case \registry::TYPE_TIMEZONE:
|
||||
$datas[$variable['name']] = (string) trim($datas[$variable['name']]);
|
||||
break;
|
||||
case 'enum':
|
||||
case \registry::TYPE_ENUM:
|
||||
if (!isset($variable['available'])) {
|
||||
$variable['error'] = 'avalaibility';
|
||||
} elseif (!is_array($variable['available'])) {
|
||||
@@ -112,25 +114,16 @@ class setup
|
||||
$variable['error'] = 'avalaibility';
|
||||
}
|
||||
break;
|
||||
case 'enum_multi':
|
||||
case \registry::TYPE_ENUM_MULTI:
|
||||
if (!isset($datas[$variable['name']]))
|
||||
$datas[$variable['name']] = null;
|
||||
$datas[$variable['name']] = ($datas[$variable['name']]);
|
||||
$type = 'array';
|
||||
break;
|
||||
case 'boolean':
|
||||
case \registry::TYPE_BOOLEAN:
|
||||
$datas[$variable['name']] = strtolower($datas[$variable['name']]) === 'true' ? '1' : '0';
|
||||
$type = 'boolean';
|
||||
break;
|
||||
case 'integer':
|
||||
case \registry::TYPE_INTEGER:
|
||||
$datas[$variable['name']] = (int) trim($datas[$variable['name']]);
|
||||
$type = 'integer';
|
||||
break;
|
||||
case 'text':
|
||||
$datas[$variable['name']] = trim($datas[$variable['name']]);
|
||||
break;
|
||||
case 'timezone':
|
||||
$datas[$variable['name']] = trim($datas[$variable['name']]);
|
||||
break;
|
||||
default:
|
||||
$error = true;
|
||||
@@ -180,17 +173,17 @@ class setup
|
||||
$finder = new \Symfony\Component\Process\ExecutableFinder();
|
||||
|
||||
$binaries = array(
|
||||
'PHP CLI' => $registry->get('GV_cli', $finder->find('php')),
|
||||
'ImageMagick (convert)' => $registry->get('GV_imagick', $finder->find('convert')),
|
||||
'PDF 2 SWF' => $registry->get('GV_pdf2swf', $finder->find('pdf2swf')),
|
||||
'Unoconv' => $registry->get('GV_unoconv', $finder->find('unoconv')),
|
||||
'SWFextract' => $registry->get('GV_swf_extract', $finder->find('swfextract')),
|
||||
'SWFrender' => $registry->get('GV_swf_render', $finder->find('swfrender')),
|
||||
'MP4Box' => $registry->get('GV_mp4box', $finder->find('MP4Box')),
|
||||
'xpdf (pdf2text)' => $registry->get('GV_pdftotext', $finder->find('pdftotext')),
|
||||
'ImageMagick (composite)' => $registry->get('GV_pathcomposite', $finder->find('composite')),
|
||||
'FFmpeg' => $registry->get('GV_ffmpeg', $finder->find('ffmpeg')),
|
||||
'FFprobe' => $registry->get('GV_ffprobe', $finder->find('ffprobe')),
|
||||
'PHP CLI' => $registry->get('php_binary', $finder->find('php')),
|
||||
'ImageMagick (convert)' => $registry->get('convert_binary', $finder->find('convert')),
|
||||
'PDF 2 SWF' => $registry->get('pdf2swf_binary', $finder->find('pdf2swf')),
|
||||
'Unoconv' => $registry->get('unoconv_binary', $finder->find('unoconv')),
|
||||
'SWFextract' => $registry->get('swf_extract_binary', $finder->find('swfextract')),
|
||||
'SWFrender' => $registry->get('swf_render_binary', $finder->find('swfrender')),
|
||||
'MP4Box' => $registry->get('mp4box_binary', $finder->find('MP4Box')),
|
||||
'xpdf (pdf2text)' => $registry->get('pdftotext_binary', $finder->find('pdftotext')),
|
||||
'ImageMagick (composite)' => $registry->get('composite_binary', $finder->find('composite')),
|
||||
'FFmpeg' => $registry->get('ffmpeg_binary', $finder->find('ffmpeg')),
|
||||
'FFprobe' => $registry->get('ffprobe_binary', $finder->find('ffprobe')),
|
||||
'phraseanet_indexer' => $finder->find('phraseanet_indexer'),
|
||||
);
|
||||
|
||||
|
@@ -53,7 +53,7 @@ class task_Scheduler
|
||||
public function run()
|
||||
{
|
||||
//prevent scheduler to fail if GV_cli is not provided
|
||||
if ( ! is_executable($this->dependencyContainer['phraseanet.registry']->get('GV_cli'))) {
|
||||
if ( ! is_executable($this->dependencyContainer['phraseanet.registry']->get('php_binary'))) {
|
||||
throw new \RuntimeException('PHP cli is not provided in registry');
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ class task_Scheduler
|
||||
$taskPoll[$tkey] = array(
|
||||
"task" => $task,
|
||||
"current_status" => $status,
|
||||
"cmd" => $this->dependencyContainer['phraseanet.registry']->get('GV_cli'),
|
||||
"cmd" => $this->dependencyContainer['phraseanet.registry']->get('php_binary'),
|
||||
"args" => array(
|
||||
'-f',
|
||||
$this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'bin/console',
|
||||
@@ -325,7 +325,7 @@ class task_Scheduler
|
||||
$descriptors[2] = array('file', $nullfile, 'a+');
|
||||
|
||||
$taskPoll[$tkey]["process"] = proc_open(
|
||||
$taskPoll[$tkey]["cmd"] . ' ' . implode(' ', $taskPoll[$tkey]["args"])
|
||||
escapeshellarg($taskPoll[$tkey]["cmd"]) . ' ' . implode(' ', array_map('escapeshellarg', $taskPoll[$tkey]["args"]))
|
||||
, $descriptors
|
||||
, $taskPoll[$tkey]["pipes"]
|
||||
, $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . "bin/"
|
||||
|
@@ -899,18 +899,4 @@ abstract class task_abstract
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape a shell command.
|
||||
*
|
||||
* As this function is buggy under windows, this method check the
|
||||
* environment
|
||||
*
|
||||
* @param string $command
|
||||
* @return string
|
||||
*/
|
||||
protected static function escapeShellCmd($command)
|
||||
{
|
||||
return defined('PHP_WINDOWS_VERSION_BUILD') ? escapeshellarg($command) : escapeshellcmd($command);
|
||||
}
|
||||
}
|
||||
|
@@ -472,17 +472,11 @@ class task_period_cindexer extends task_abstract
|
||||
|
||||
$pipes = array();
|
||||
|
||||
$logcmd = self::escapeShellCmd($cmd);
|
||||
foreach ($args_nopwd as $arg) {
|
||||
$logcmd .= ' ' . escapeshellarg($arg);
|
||||
}
|
||||
$logcmd = escapeshellarg($cmd).' '.implode(' ', array_map('escapeshellarg', $args_nopwd));
|
||||
$execmd = escapeshellarg($cmd).' '.implode(' ', array_map('escapeshellarg', $args));
|
||||
|
||||
$this->log(sprintf('cmd=\'%s\'', self::escapeShellCmd($logcmd)));
|
||||
$this->log(sprintf('cmd=\'%s\'', $logcmd));
|
||||
|
||||
$execmd = self::escapeShellCmd($cmd);
|
||||
foreach ($args as $arg) {
|
||||
$execmd .= ' ' . escapeshellarg($arg);
|
||||
}
|
||||
$process = proc_open($execmd, $descriptors, $pipes, $this->binpath, null, array('bypass_shell' => true));
|
||||
|
||||
$pid = NULL;
|
||||
|
Reference in New Issue
Block a user