mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 13:33:14 +00:00
Move phraseanet_indexer setting in configuration
This commit is contained in:
@@ -253,6 +253,7 @@ class Install extends Command
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'php_binary' => $this->executableFinder->find('php'),
|
'php_binary' => $this->executableFinder->find('php'),
|
||||||
|
'phraseanet_indexer' => $this->executableFinder->find('phraseanet_indexer'),
|
||||||
'convert_binary' => $this->executableFinder->find('convert'),
|
'convert_binary' => $this->executableFinder->find('convert'),
|
||||||
'composite_binary' => $this->executableFinder->find('composite'),
|
'composite_binary' => $this->executableFinder->find('composite'),
|
||||||
'pdf2swf_binary' => $this->executableFinder->find('pdf2swf'),
|
'pdf2swf_binary' => $this->executableFinder->find('pdf2swf'),
|
||||||
|
@@ -146,6 +146,7 @@ class Setup implements ControllerProviderInterface
|
|||||||
$binaryData = array();
|
$binaryData = array();
|
||||||
foreach (array(
|
foreach (array(
|
||||||
'php_binary' => $request->request->get('binary_php'),
|
'php_binary' => $request->request->get('binary_php'),
|
||||||
|
'phraseanet_indexer' => $request->request->get('binary_phraseanet_indexer'),
|
||||||
'convert_binary' => $request->request->get('binary_convert'),
|
'convert_binary' => $request->request->get('binary_convert'),
|
||||||
'composite_binary' => $request->request->get('binary_composite'),
|
'composite_binary' => $request->request->get('binary_composite'),
|
||||||
'swf_extract_binary' => $request->request->get('binary_swfextract'),
|
'swf_extract_binary' => $request->request->get('binary_swfextract'),
|
||||||
|
@@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core;
|
|||||||
*/
|
*/
|
||||||
class Version
|
class Version
|
||||||
{
|
{
|
||||||
protected static $number = '3.8.0.a7';
|
protected static $number = '3.8.0.a8';
|
||||||
protected static $name = 'Carnosaurus';
|
protected static $name = 'Carnosaurus';
|
||||||
|
|
||||||
public static function getNumber()
|
public static function getNumber()
|
||||||
|
72
lib/classes/patch/3808.php
Normal file
72
lib/classes/patch/3808.php
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<?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\Application;
|
||||||
|
|
||||||
|
class patch_3808 implements patchInterface
|
||||||
|
{
|
||||||
|
/** @var string */
|
||||||
|
private $release = '3.8.0.a8';
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function get_release()
|
||||||
|
{
|
||||||
|
return $this->release;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function require_all_upgrades()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function apply(base $appbox, Application $app)
|
||||||
|
{
|
||||||
|
$conn = $appbox->get_connection();
|
||||||
|
|
||||||
|
$sql = 'SELECT settings FROM task2 WHERE class="task_period_cindexer" LIMIT 1';
|
||||||
|
$stmt = $conn->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
if (!$row) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sxe = simplexml_load_string($row['settings']);
|
||||||
|
$indexer = $sxe->binpath . '/phraseanet_indexer';
|
||||||
|
|
||||||
|
$binaries = $app['phraseanet.configuration']['binaries'];
|
||||||
|
$binaries['phraseanet_indexer'] = $indexer;
|
||||||
|
$app['phraseanet.configuration']['binaries'] = $binaries;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@@ -8,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Symfony\Component\Process\ExecutableFinder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
@@ -103,12 +105,6 @@ class task_period_cindexer extends task_abstract
|
|||||||
*/
|
*/
|
||||||
protected $winsvc_run;
|
protected $winsvc_run;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $binpath;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
@@ -137,13 +133,13 @@ class task_period_cindexer extends task_abstract
|
|||||||
$request = http_request::getInstance();
|
$request = http_request::getInstance();
|
||||||
|
|
||||||
$parm2 = $request->get_parms(
|
$parm2 = $request->get_parms(
|
||||||
'binpath', 'host', 'port', 'base', 'user', 'password', 'socket', 'use_sbas', 'nolog', 'clng', 'winsvc_run', 'charset', 'debugmask', 'stem', 'sortempty'
|
'host', 'port', 'base', 'user', 'password', 'socket', 'use_sbas', 'nolog', 'clng', 'winsvc_run', 'charset', 'debugmask', 'stem', 'sortempty'
|
||||||
);
|
);
|
||||||
$dom = new DOMDocument();
|
$dom = new DOMDocument();
|
||||||
$dom->formatOutput = true;
|
$dom->formatOutput = true;
|
||||||
if ($dom->loadXML($oldxml)) {
|
if ($dom->loadXML($oldxml)) {
|
||||||
$xmlchanged = false;
|
$xmlchanged = false;
|
||||||
foreach (array("str:binpath", "str:host", "str:port", "str:base", "str:user", "str:password", "str:socket", "boo:use_sbas", "boo:nolog", "str:clng", "boo:winsvc_run", "str:charset", 'str:debugmask', 'str:stem', 'str:sortempty') as $pname) {
|
foreach (array("str:host", "str:port", "str:base", "str:user", "str:password", "str:socket", "boo:use_sbas", "boo:nolog", "str:clng", "boo:winsvc_run", "str:charset", 'str:debugmask', 'str:stem', 'str:sortempty') as $pname) {
|
||||||
$ptype = substr($pname, 0, 3);
|
$ptype = substr($pname, 0, 3);
|
||||||
$pname = substr($pname, 4);
|
$pname = substr($pname, 4);
|
||||||
$pvalue = $parm2[$pname];
|
$pvalue = $parm2[$pname];
|
||||||
@@ -179,10 +175,6 @@ class task_period_cindexer extends task_abstract
|
|||||||
*/
|
*/
|
||||||
public function printInterfaceJS()
|
public function printInterfaceJS()
|
||||||
{
|
{
|
||||||
$appname = 'phraseanet_indexer';
|
|
||||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
|
||||||
$appname .= '.exe';
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
@@ -200,7 +192,6 @@ class task_period_cindexer extends task_abstract
|
|||||||
|
|
||||||
with(document.forms['graphicForm'])
|
with(document.forms['graphicForm'])
|
||||||
{
|
{
|
||||||
binpath.value = xml.find("binpath").text();
|
|
||||||
host.value = xml.find("host").text();
|
host.value = xml.find("host").text();
|
||||||
port.value = xml.find("port").text();
|
port.value = xml.find("port").text();
|
||||||
base.value = xml.find("base").text();
|
base.value = xml.find("base").text();
|
||||||
@@ -223,7 +214,7 @@ class task_period_cindexer extends task_abstract
|
|||||||
{
|
{
|
||||||
use_sbas.checked = true;
|
use_sbas.checked = true;
|
||||||
|
|
||||||
cmd += binpath.value + "/<?php echo $appname ?>";
|
cmd += "<?php echo $this->getIndexer() ?>";
|
||||||
if(host.value)
|
if(host.value)
|
||||||
cmd += " -h=" + host.value;
|
cmd += " -h=" + host.value;
|
||||||
if(port.value)
|
if(port.value)
|
||||||
@@ -275,17 +266,9 @@ class task_period_cindexer extends task_abstract
|
|||||||
*/
|
*/
|
||||||
public function getInterfaceHTML()
|
public function getInterfaceHTML()
|
||||||
{
|
{
|
||||||
$appname = 'phraseanet_indexer';
|
|
||||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
|
||||||
$appname .= '.exe';
|
|
||||||
}
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
<form id="graphicForm" name="graphicForm" onsubmit="return(false);" method="post">
|
<form id="graphicForm" name="graphicForm" onsubmit="return(false);" method="post">
|
||||||
<?php echo _('task::cindexer:executable') ?> :
|
|
||||||
<input type="text" name="binpath" style="width:300px;text-align: right" value=""> / <?php echo $appname ?>
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<?php echo _('task::cindexer:host') ?> : <input type="text" name="host" style="width:100px;" value="">
|
<?php echo _('task::cindexer:host') ?> : <input type="text" name="host" style="width:100px;" value="">
|
||||||
|
|
||||||
<?php echo _('task::cindexer:port') ?> : <input type="text" name="port" style="width:50px;" value="">
|
<?php echo _('task::cindexer:port') ?> : <input type="text" name="port" style="width:50px;" value="">
|
||||||
@@ -363,25 +346,37 @@ class task_period_cindexer extends task_abstract
|
|||||||
$this->debugmask = (int) (trim($sx_task_settings->debugmask));
|
$this->debugmask = (int) (trim($sx_task_settings->debugmask));
|
||||||
$this->nolog = p4field::isyes(trim($sx_task_settings->nolog));
|
$this->nolog = p4field::isyes(trim($sx_task_settings->nolog));
|
||||||
$this->winsvc_run = p4field::isyes(trim($sx_task_settings->winsvc_run));
|
$this->winsvc_run = p4field::isyes(trim($sx_task_settings->winsvc_run));
|
||||||
$this->binpath = p4string::addEndSlash(trim($sx_task_settings->binpath));
|
|
||||||
|
|
||||||
parent::loadSettings($sx_task_settings);
|
parent::loadSettings($sx_task_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getIndexer()
|
||||||
|
{
|
||||||
|
$binaries = $this->dependencyContainer['phraseanet.configuration']['binaries'];
|
||||||
|
|
||||||
|
if (isset($binaries['phraseanet_indexer'])) {
|
||||||
|
$cmd = $binaries['phraseanet_indexer'];
|
||||||
|
} else {
|
||||||
|
$finder = new ExecutableFinder();
|
||||||
|
$cmd = $finder->find('phraseanet_indexer');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cmd;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function run2()
|
protected function run2()
|
||||||
{
|
{
|
||||||
$cmd = $this->binpath . 'phraseanet_indexer';
|
$cmd = $this->getIndexer();
|
||||||
|
|
||||||
$nullfile = '/dev/null';
|
$nullfile = '/dev/null';
|
||||||
$this->method = self::METHOD_PROC_OPEN;
|
$this->method = self::METHOD_PROC_OPEN;
|
||||||
|
|
||||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||||
$nullfile = '/dev/null';
|
$nullfile = '/dev/null';
|
||||||
$cmd .= '.exe';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! file_exists($cmd) || ! is_executable($cmd)) {
|
if ( ! file_exists($cmd) || ! is_executable($cmd)) {
|
||||||
@@ -489,7 +484,7 @@ class task_period_cindexer extends task_abstract
|
|||||||
|
|
||||||
$this->log(sprintf('cmd=\'%s\'', $logcmd));
|
$this->log(sprintf('cmd=\'%s\'', $logcmd));
|
||||||
|
|
||||||
$process = proc_open($execmd, $descriptors, $pipes, $this->binpath, null, array('bypass_shell' => true));
|
$process = proc_open($execmd, $descriptors, $pipes, dirname($cmd), null, array('bypass_shell' => true));
|
||||||
|
|
||||||
$pid = NULL;
|
$pid = NULL;
|
||||||
if (is_resource($process)) {
|
if (is_resource($process)) {
|
||||||
|
Reference in New Issue
Block a user