Merge with 3.7

This commit is contained in:
Romain Neutron
2012-10-10 11:34:21 +02:00
30 changed files with 586 additions and 396 deletions

View File

@@ -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) {

View File

@@ -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');