From aebc63a01caa0990e68d8df5a2b053f86d4bd503 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 11 Jun 2013 16:02:43 +0200 Subject: [PATCH] Move phraseanet_indexer setting in configuration --- lib/Alchemy/Phrasea/Command/Setup/Install.php | 1 + lib/Alchemy/Phrasea/Controller/Setup.php | 1 + lib/Alchemy/Phrasea/Core/Version.php | 2 +- lib/classes/patch/3808.php | 72 +++++++++++++++++++ lib/classes/task/period/cindexer.php | 47 ++++++------ 5 files changed, 96 insertions(+), 27 deletions(-) create mode 100644 lib/classes/patch/3808.php diff --git a/lib/Alchemy/Phrasea/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php index 332b685b57..037e9f31ec 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/Install.php +++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php @@ -253,6 +253,7 @@ class Install extends Command { return array( 'php_binary' => $this->executableFinder->find('php'), + 'phraseanet_indexer' => $this->executableFinder->find('phraseanet_indexer'), 'convert_binary' => $this->executableFinder->find('convert'), 'composite_binary' => $this->executableFinder->find('composite'), 'pdf2swf_binary' => $this->executableFinder->find('pdf2swf'), diff --git a/lib/Alchemy/Phrasea/Controller/Setup.php b/lib/Alchemy/Phrasea/Controller/Setup.php index fe97d477ce..116c852cc3 100644 --- a/lib/Alchemy/Phrasea/Controller/Setup.php +++ b/lib/Alchemy/Phrasea/Controller/Setup.php @@ -146,6 +146,7 @@ class Setup implements ControllerProviderInterface $binaryData = array(); foreach (array( 'php_binary' => $request->request->get('binary_php'), + 'phraseanet_indexer' => $request->request->get('binary_phraseanet_indexer'), 'convert_binary' => $request->request->get('binary_convert'), 'composite_binary' => $request->request->get('binary_composite'), 'swf_extract_binary' => $request->request->get('binary_swfextract'), diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php index 014cc5da54..bae59e7516 100644 --- a/lib/Alchemy/Phrasea/Core/Version.php +++ b/lib/Alchemy/Phrasea/Core/Version.php @@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core; */ class Version { - protected static $number = '3.8.0.a7'; + protected static $number = '3.8.0.a8'; protected static $name = 'Carnosaurus'; public static function getNumber() diff --git a/lib/classes/patch/3808.php b/lib/classes/patch/3808.php new file mode 100644 index 0000000000..e50bc49f85 --- /dev/null +++ b/lib/classes/patch/3808.php @@ -0,0 +1,72 @@ +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; + } +} diff --git a/lib/classes/task/period/cindexer.php b/lib/classes/task/period/cindexer.php index 1fac15784c..b562e92e24 100644 --- a/lib/classes/task/period/cindexer.php +++ b/lib/classes/task/period/cindexer.php @@ -8,6 +8,8 @@ * file that was distributed with this source code. */ +use Symfony\Component\Process\ExecutableFinder; + /** * * @license http://opensource.org/licenses/gpl-3.0 GPLv3 @@ -103,12 +105,6 @@ class task_period_cindexer extends task_abstract */ protected $winsvc_run; - /** - * - * @var string - */ - protected $binpath; - /** * * @return string @@ -137,13 +133,13 @@ class task_period_cindexer extends task_abstract $request = http_request::getInstance(); $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->formatOutput = true; if ($dom->loadXML($oldxml)) { $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); $pname = substr($pname, 4); $pvalue = $parm2[$pname]; @@ -179,10 +175,6 @@ class task_period_cindexer extends task_abstract */ public function printInterfaceJS() { - $appname = 'phraseanet_indexer'; - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - $appname .= '.exe'; - } ?>