mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 11:33:17 +00:00
Merge branch '3.8'
Conflicts: .gitignore bin/console composer.json composer.lock hudson/fixtures.sql lib/Alchemy/Phrasea/Command/Developer/IniReset.php lib/Alchemy/Phrasea/Command/Setup/Install.php lib/Alchemy/Phrasea/Controller/Api/Oauth2.php lib/Alchemy/Phrasea/Controller/Api/V1.php lib/Alchemy/Phrasea/Controller/Prod/Export.php lib/Alchemy/Phrasea/Controller/Root/Login.php lib/Alchemy/Phrasea/Core/Provider/PhraseanetServiceProvider.php lib/Alchemy/Phrasea/Core/Version.php lib/Alchemy/Phrasea/Helper/DatabaseHelper.php lib/Alchemy/Phrasea/Helper/Prod.php lib/classes/API/OAuth2/Application.php lib/classes/API/V1/Interface.php lib/classes/API/V1/adapter.php lib/classes/Setup/Upgrade.php lib/classes/media/subdef.php lib/classes/task/period/RecordMover.php templates/web/prod/index.html.twig templates/web/setup/step2.html.twig tests/Alchemy/Tests/Phrasea/Controller/Admin/RootTest.php tests/Alchemy/Tests/Phrasea/Controller/Root/LoginTest.php tests/classes/api/v1/api_v1_adapterTest.php tests/db-ref.sqlite vagrant/vms/phraseanet-php54-nginx/puphpet/config.yaml vagrant/vms/phraseanet-php54-nginx/puphpet/files/exec-once/setup
This commit is contained in:
@@ -54,8 +54,7 @@ script:
|
|||||||
- bin/developer system:uninstall
|
- bin/developer system:uninstall
|
||||||
- sh -c " if [ '$SETUP_MODE' = 'update' ]; then
|
- sh -c " if [ '$SETUP_MODE' = 'update' ]; then
|
||||||
bin/setup system:install --email=test@phraseanet.com --password=test --db-user=root --db-template=fr --db-password= --databox=db_test --appbox=ab_test --server-name=http://127.0.0.1 -y -v;
|
bin/setup system:install --email=test@phraseanet.com --password=test --db-user=root --db-template=fr --db-password= --databox=db_test --appbox=ab_test --server-name=http://127.0.0.1 -y -v;
|
||||||
bin/developer ini:reset --v3.1 -v;
|
bin/developer ini:reset --email=test@phraseanet.com --password=test --run-patches -v;
|
||||||
bin/setup system:upgrade -y -v -f;
|
|
||||||
fi"
|
fi"
|
||||||
- sh -c " if [ '$SETUP_MODE' = 'install' ]; then
|
- sh -c " if [ '$SETUP_MODE' = 'install' ]; then
|
||||||
bin/setup system:install --email=test@phraseanet.com --password=test --db-user=root --db-template=fr --db-password= --databox=db_test --appbox=ab_test --server-name=http://127.0.0.1 -y -v;
|
bin/setup system:install --email=test@phraseanet.com --password=test --db-user=root --db-template=fr --db-password= --databox=db_test --appbox=ab_test --server-name=http://127.0.0.1 -y -v;
|
||||||
|
@@ -14,6 +14,8 @@ namespace KonsoleKommander;
|
|||||||
use Alchemy\Phrasea\Command\Plugin\ListPlugin;
|
use Alchemy\Phrasea\Command\Plugin\ListPlugin;
|
||||||
use Alchemy\Phrasea\Command\Setup\H264ConfigurationDumper;
|
use Alchemy\Phrasea\Command\Setup\H264ConfigurationDumper;
|
||||||
use Alchemy\Phrasea\Command\Setup\H264MappingGenerator;
|
use Alchemy\Phrasea\Command\Setup\H264MappingGenerator;
|
||||||
|
use Alchemy\Phrasea\Command\Setup\StaticConfigurationDumper;
|
||||||
|
use Alchemy\Phrasea\Command\Setup\StaticMappingGenerator;
|
||||||
use Alchemy\Phrasea\Command\SearchEngine\IndexFull;
|
use Alchemy\Phrasea\Command\SearchEngine\IndexFull;
|
||||||
use Alchemy\Phrasea\Command\WebsocketServer;
|
use Alchemy\Phrasea\Command\WebsocketServer;
|
||||||
use Alchemy\Phrasea\Core\Version;
|
use Alchemy\Phrasea\Core\Version;
|
||||||
@@ -115,6 +117,9 @@ $cli->command(new H264MappingGenerator());
|
|||||||
$cli->command(new XSendFileConfigurationDumper());
|
$cli->command(new XSendFileConfigurationDumper());
|
||||||
$cli->command(new XSendFileMappingGenerator());
|
$cli->command(new XSendFileMappingGenerator());
|
||||||
|
|
||||||
|
$cli->command(new StaticConfigurationDumper());
|
||||||
|
$cli->command(new StaticMappingGenerator());
|
||||||
|
|
||||||
if ($cli['phraseanet.SE']->getName() === 'ElasticSearch') {
|
if ($cli['phraseanet.SE']->getName() === 'ElasticSearch') {
|
||||||
$cli->command(new IndexFull('searchengine:index'));
|
$cli->command(new IndexFull('searchengine:index'));
|
||||||
}
|
}
|
||||||
|
@@ -16,19 +16,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://github.com/nlegoff/PHP-FFmpeg"
|
"url": "https://github.com/alchemy-fr/imagine"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://github.com/nlegoff/Mediavorus"
|
"url": "https://github.com/alchemy-fr/phpexiftool"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://github.com/nlegoff/Media-Alchemyst"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://github.com/nlegoff/Imagine"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
@@ -48,14 +40,14 @@
|
|||||||
"alchemy/geonames-api-consumer" : "~0.1.0",
|
"alchemy/geonames-api-consumer" : "~0.1.0",
|
||||||
"goodby/csv" : "~1.0",
|
"goodby/csv" : "~1.0",
|
||||||
"guzzle/guzzle" : "~3.0",
|
"guzzle/guzzle" : "~3.0",
|
||||||
"imagine/imagine" : "dev-flatten-layer as 0.6.1",
|
"imagine/imagine" : "dev-0.6.1-flatten-layer as 0.6.1",
|
||||||
"igorw/get-in" : "~1.0",
|
"igorw/get-in" : "~1.0",
|
||||||
"ircmaxell/random-lib" : "~1.0",
|
"ircmaxell/random-lib" : "~1.0",
|
||||||
"jms/serializer" : "~0.10",
|
"jms/serializer" : "~0.10",
|
||||||
"jms/translation-bundle" : "~1.1",
|
"jms/translation-bundle" : "~1.1",
|
||||||
"justinrainbow/json-schema" : "~1.3",
|
"justinrainbow/json-schema" : "~1.3",
|
||||||
"mediavorus/mediavorus" : "dev-fix-video-dim as 0.4.3",
|
"mediavorus/mediavorus" : "~0.4.0",
|
||||||
"media-alchemyst/media-alchemyst" : "0.4.x@dev",
|
"media-alchemyst/media-alchemyst" : "~0.4.0",
|
||||||
"monolog/monolog" : "~1.3",
|
"monolog/monolog" : "~1.3",
|
||||||
"mrclay/minify" : "~2.1.6",
|
"mrclay/minify" : "~2.1.6",
|
||||||
"neutron/process-manager" : "2.0.x-dev@dev",
|
"neutron/process-manager" : "2.0.x-dev@dev",
|
||||||
@@ -64,9 +56,9 @@
|
|||||||
"neutron/sphinxsearch-api" : "~2.0.6",
|
"neutron/sphinxsearch-api" : "~2.0.6",
|
||||||
"neutron/recaptcha" : "~0.1.0",
|
"neutron/recaptcha" : "~0.1.0",
|
||||||
"neutron/temporary-filesystem" : "~2.1",
|
"neutron/temporary-filesystem" : "~2.1",
|
||||||
"php-ffmpeg/php-ffmpeg" : "dev-fix-aspect-ratio as 0.4.4",
|
"php-ffmpeg/php-ffmpeg" : "~0.5.0",
|
||||||
"php-xpdf/php-xpdf" : "~0.2.1",
|
"php-xpdf/php-xpdf" : "~0.2.1",
|
||||||
"phpexiftool/phpexiftool" : "~0.3",
|
"phpexiftool/phpexiftool" : "dev-0.4.1-mwg-metadata-copy as 0.4.1",
|
||||||
"react/zmq" : "~0.2",
|
"react/zmq" : "~0.2",
|
||||||
"rhumsaa/uuid" : "~2.7",
|
"rhumsaa/uuid" : "~2.7",
|
||||||
"silex/silex" : "1.1.x-dev@dev",
|
"silex/silex" : "1.1.x-dev@dev",
|
||||||
|
@@ -206,6 +206,10 @@ api_cors:
|
|||||||
session:
|
session:
|
||||||
idle: 0
|
idle: 0
|
||||||
lifetime: 604800 # 1 week
|
lifetime: 604800 # 1 week
|
||||||
|
static-file:
|
||||||
|
enabled: false
|
||||||
|
type: nginx
|
||||||
|
symlink-directory: ''
|
||||||
crossdomain:
|
crossdomain:
|
||||||
site-control: 'master-only'
|
site-control: 'master-only'
|
||||||
allow-access-from:
|
allow-access-from:
|
||||||
|
@@ -85,9 +85,9 @@ class Manager
|
|||||||
$visa = $this->getVisa($file);
|
$visa = $this->getVisa($file);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates and write UUID
|
* Generate UUID
|
||||||
*/
|
*/
|
||||||
$file->getUUID(true, true);
|
$file->getUUID(true, false);
|
||||||
|
|
||||||
if (($visa->isValid() || $forceBehavior === self::FORCE_RECORD) && $forceBehavior !== self::FORCE_LAZARET) {
|
if (($visa->isValid() || $forceBehavior === self::FORCE_RECORD) && $forceBehavior !== self::FORCE_LAZARET) {
|
||||||
|
|
||||||
@@ -103,6 +103,11 @@ class Manager
|
|||||||
$code = self::LAZARET_CREATED;
|
$code = self::LAZARET_CREATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write UUID
|
||||||
|
*/
|
||||||
|
$file->getUUID(false, true);
|
||||||
|
|
||||||
if (is_callable($callable)) {
|
if (is_callable($callable)) {
|
||||||
$callable($element, $visa, $code);
|
$callable($element, $visa, $code);
|
||||||
}
|
}
|
||||||
|
@@ -12,13 +12,16 @@
|
|||||||
namespace Alchemy\Phrasea\Command\Developer;
|
namespace Alchemy\Phrasea\Command\Developer;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Command\Command;
|
use Alchemy\Phrasea\Command\Command;
|
||||||
|
use Alchemy\Phrasea\Core\Version;
|
||||||
use Alchemy\Phrasea\Exception\RuntimeException;
|
use Alchemy\Phrasea\Exception\RuntimeException;
|
||||||
use Symfony\Component\Console\Input\ArrayInput;
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
use Symfony\Component\Process\ExecutableFinder;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
use Symfony\Component\Process\Process;
|
use Symfony\Component\Process\Process;
|
||||||
|
use vierbergenlars\SemVer\version as SemVer;
|
||||||
|
|
||||||
class IniReset extends Command
|
class IniReset extends Command
|
||||||
{
|
{
|
||||||
@@ -27,15 +30,20 @@ class IniReset extends Command
|
|||||||
parent::__construct('ini:reset');
|
parent::__construct('ini:reset');
|
||||||
|
|
||||||
$this->setDescription('Reset environment')
|
$this->setDescription('Reset environment')
|
||||||
->addOption('name', null, InputOption::VALUE_OPTIONAL, 'Databox name to reset, in case of multiple databox are mounted', null)
|
->addOption('yes', 'y', InputOption::VALUE_NONE, 'Answers yes to all questions and do not ask the user')
|
||||||
|
->addOption('email', null, InputOption::VALUE_OPTIONAL, 'Admin e-mail address', null)
|
||||||
|
->addOption('password', null, InputOption::VALUE_OPTIONAL, 'Admin password', null)
|
||||||
|
->addOption('db-name', null, InputOption::VALUE_OPTIONAL, 'Databox name to reset, in case of multiple databox are mounted', null)
|
||||||
->addOption('dependencies', null, InputOption::VALUE_NONE, 'Fetch dependencies', null)
|
->addOption('dependencies', null, InputOption::VALUE_NONE, 'Fetch dependencies', null)
|
||||||
->addOption('v3.1', null, InputOption::VALUE_NONE, 'Reset with v3.1 fixtures', null)
|
->addOption('run-patches', null, InputOption::VALUE_NONE, 'Reset in v3.1 states & apply all patches', null)
|
||||||
->addOption('uninstall', null, InputOption::VALUE_NONE, 'Uninstall Phraseanet', null);
|
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
$interactive = !$input->getOption('yes');
|
||||||
|
$dialog = $this->getHelperSet()->get('dialog');
|
||||||
|
|
||||||
if (!$this->container['phraseanet.configuration']->isSetup()) {
|
if (!$this->container['phraseanet.configuration']->isSetup()) {
|
||||||
throw new RuntimeException(sprintf(
|
throw new RuntimeException(sprintf(
|
||||||
'Phraseanet is not setup. You can run <info>bin/setup system::install</info> command to install Phraseanet.'
|
'Phraseanet is not setup. You can run <info>bin/setup system::install</info> command to install Phraseanet.'
|
||||||
@@ -46,52 +54,66 @@ class IniReset extends Command
|
|||||||
$conf = $this->container['phraseanet.configuration']->getConfig();
|
$conf = $this->container['phraseanet.configuration']->getConfig();
|
||||||
$dbs = array('ab' => $conf['main']['database']['dbname'], 'dbs' => array(), 'setup_dbs' => array());
|
$dbs = array('ab' => $conf['main']['database']['dbname'], 'dbs' => array(), 'setup_dbs' => array());
|
||||||
foreach($this->container['phraseanet.appbox']->get_databoxes() as $databox) {
|
foreach($this->container['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||||
$dbs['dbs'][] = $databox->get_dbname();
|
$dbs['dbs'][] = $databox;
|
||||||
}
|
|
||||||
|
|
||||||
//uninstall
|
|
||||||
if ($input->getOption('uninstall')) {
|
|
||||||
$command = $this->getApplication()->find('system:uninstall');
|
|
||||||
|
|
||||||
$output->writeln('Uninstalling...<info>OK</info>');
|
|
||||||
$input = new ArrayInput(array(
|
|
||||||
'command' => 'system:uninstall'
|
|
||||||
));
|
|
||||||
$command->run($input, $output);
|
|
||||||
}
|
|
||||||
|
|
||||||
//run composer
|
|
||||||
//run bower
|
|
||||||
if ($input->getOption('dependencies')) {
|
|
||||||
$command = $this->getApplication()->find('dependencies:composer');
|
|
||||||
|
|
||||||
$input = new ArrayInput(array(
|
|
||||||
'command' => 'dependencies:composer'
|
|
||||||
));
|
|
||||||
$command->run($input, $output);
|
|
||||||
|
|
||||||
$command = $this->getApplication()->find('dependencies:bower');
|
|
||||||
|
|
||||||
$input = new ArrayInput(array(
|
|
||||||
'command' => 'dependencies:bower'
|
|
||||||
));
|
|
||||||
$command->run($input, $output);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($dbs['dbs']) > 1) {
|
if (count($dbs['dbs']) > 1) {
|
||||||
if ($input->getOption('name')) {
|
if ($input->getOption('db-name')) {
|
||||||
$dbName = $input->getOption('name');
|
$dbName = $input->getOption('db-name');
|
||||||
} else {
|
} else {
|
||||||
$dialog = $this->getHelperSet()->get('dialog');
|
$dialog = $this->getHelperSet()->get('dialog');
|
||||||
$dbName = $dialog->ask(
|
$dbName = $dialog->ask(
|
||||||
$output,
|
$output,
|
||||||
_('Please enter the databox name to reset')
|
_('Please enter the databox name to reset or create')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} else if ($input->getOption('db-name')) {
|
||||||
|
$dbName = $input->getOption('db-name');
|
||||||
} else {
|
} else {
|
||||||
$dbName = current($dbs['dbs']);
|
$dbName = current($dbs['dbs'])->get_dbname();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$continue = 'y';
|
||||||
|
if (count($dbs['dbs']) > 1 && in_array($dbName, array_map(function($db) { return $db->get_dbname();}, $dbs['dbs']))) {
|
||||||
|
if ($interactive) {
|
||||||
|
do {
|
||||||
|
$continue = mb_strtolower($dialog->ask($output, '<question>' .$dbName.' database is going to be truncated, do you want to continue ? (Y/n)</question>', 'Y'));
|
||||||
|
} while (!in_array($continue, array('y', 'n')));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('y' !== $continue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$unmountedDbs = $dbToMount = array_diff(array_map(function($db) { return $db->get_dbname();}, $dbs['dbs']), array($dbName));
|
||||||
|
|
||||||
|
if (count($unmountedDbs) > 1 && $interactive) {
|
||||||
|
array_unshift($unmountedDbs, 'all');
|
||||||
|
$selected = $dialog->select(
|
||||||
|
$output,
|
||||||
|
'Choose Dbs to mount',
|
||||||
|
$unmountedDbs,
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
'Invalid choice',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$dbToMount = array_map(function($c) use ($unmountedDbs) {
|
||||||
|
return $unmountedDbs[$c];
|
||||||
|
}, $selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($input->getOption('dependencies') || !SemVer::eq($this->container['phraseanet.appbox']->get_version(), $this->container['phraseanet.version']->getNumber())) {
|
||||||
|
$this->getApplication()->find('dependencies:all')->run( new ArrayInput(array(
|
||||||
|
'command' => 'dependencies:all'
|
||||||
|
)), $output);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get data paths
|
||||||
|
$dataPath = $this->container['phraseanet.registry']->get('GV_base_datapath_noweb', $this->container['root.path'].'/datas');
|
||||||
|
|
||||||
$schema = $this->container['EM']->getConnection()->getSchemaManager();
|
$schema = $this->container['EM']->getConnection()->getSchemaManager();
|
||||||
$output->writeln('Creating database "'.$dbs['ab'].'"...<info>OK</info>');
|
$output->writeln('Creating database "'.$dbs['ab'].'"...<info>OK</info>');
|
||||||
$schema->dropAndCreateDatabase($dbs['ab']);
|
$schema->dropAndCreateDatabase($dbs['ab']);
|
||||||
@@ -99,31 +121,69 @@ class IniReset extends Command
|
|||||||
$schema->dropAndCreateDatabase($dbName);
|
$schema->dropAndCreateDatabase($dbName);
|
||||||
|
|
||||||
// inject v3.1 fixtures
|
// inject v3.1 fixtures
|
||||||
if ($input->getOption('v3.1')) {
|
if ($input->getOption('run-patches')) {
|
||||||
$this->container['filesystem']->copy($this->container['root.path'].'/resources/hudson/connexion.inc', $this->container['root.path'].'/config/connexion.inc');
|
$this->container['filesystem']->copy($this->container['root.path'].'/hudson/connexion.inc', $this->container['root.path'].'/config/connexion.inc');
|
||||||
$this->container['filesystem']->copy($this->container['root.path'].'/resources//hudson/_GV.php', $this->container['root.path'].'/config/_GV.php');
|
$this->container['filesystem']->copy($this->container['root.path'].'/hudson/_GV.php', $this->container['root.path'].'/config/_GV.php');
|
||||||
|
|
||||||
$command = $this->getApplication()->find('dbal:import');
|
$content = file_get_contents($this->container['root.path'] . '/hudson/fixtures.sql');
|
||||||
|
$content = str_replace('{{APPLICATION_BOX}}', $dbs['ab'], $content);
|
||||||
$content = file_get_contents($this->container['root.path'] . '/resources//hudson/fixtures.sql');
|
$content = str_replace('{{DATA_BOX}}', $dbName, $content);
|
||||||
$content = str_replace('ab_test', $dbs['ab'], $content);
|
$content = str_replace('{{USER_EMAIL}}', $input->getOption('email'), $content);
|
||||||
$content = str_replace('db_test', $dbName, $content);
|
$content = str_replace('{{USER_PASSWORD}}', hash('sha256', $input->getOption('password')), $content);
|
||||||
|
|
||||||
$tmpFile = tempnam(sys_get_temp_dir(), 'fixtures-v3.1-');
|
$tmpFile = tempnam(sys_get_temp_dir(), 'fixtures-v3.1-');
|
||||||
$this->container['filesystem']->dumpFile($tmpFile, $content);
|
$this->container['filesystem']->dumpFile($tmpFile, $content);
|
||||||
|
|
||||||
$input = new ArrayInput(array(
|
|
||||||
'command' => 'dbal:import',
|
|
||||||
'file' => $tmpFile
|
|
||||||
));
|
|
||||||
|
|
||||||
$verbosity = $output->getVerbosity();
|
$verbosity = $output->getVerbosity();
|
||||||
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
|
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
|
||||||
$command->run($input, $output);
|
$this->getApplication()->find('dbal:import')->run(new ArrayInput(array(
|
||||||
|
'command' => 'dbal:import',
|
||||||
|
'file' => $tmpFile
|
||||||
|
)), $output);
|
||||||
$output->setVerbosity($verbosity);
|
$output->setVerbosity($verbosity);
|
||||||
$output->writeln('Importing Phraseanet v3.1 fixtures...<info>OK</info>');
|
$output->writeln('Importing Phraseanet v3.1 fixtures...<info>OK</info>');
|
||||||
|
} else {
|
||||||
|
$this->getApplication()->find('system:uninstall')->run(new ArrayInput(array(
|
||||||
|
'command' => 'system:uninstall'
|
||||||
|
)), $output);
|
||||||
|
|
||||||
|
$process = new Process(sprintf('php ' . __DIR__ . '/../../../../../bin/setup system:install --email=%s --password=%s --db-user=%s --db-template=%s --db-password=%s --databox=%s --appbox=%s --server-name=%s --db-host=%s --db-port=%s -y',
|
||||||
|
$input->getOption('email'),
|
||||||
|
$input->getOption('password'),
|
||||||
|
$conf['main']['database']['user'],
|
||||||
|
'en',
|
||||||
|
$conf['main']['database']['password'],
|
||||||
|
$dbName,
|
||||||
|
$dbs['ab'],
|
||||||
|
$conf['main']['servername'],
|
||||||
|
$conf['main']['database']['host'],
|
||||||
|
$conf['main']['database']['port']
|
||||||
|
));
|
||||||
|
$process->run();
|
||||||
|
|
||||||
|
$output->writeln("<info>Install successful !</info>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($dbs['dbs'] as $databox) {
|
||||||
|
if (!in_array($databox->get_dbname(), $dbToMount) && !in_array('all', $dbToMount)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$credentials = $databox->get_connection()->get_credentials();
|
||||||
|
|
||||||
|
\databox::mount(
|
||||||
|
$this->container,
|
||||||
|
$credentials['hostname'],
|
||||||
|
$credentials['port'],
|
||||||
|
$credentials['user'],
|
||||||
|
$credentials['password'],
|
||||||
|
$databox->get_dbname()
|
||||||
|
);
|
||||||
|
$output->writeln('Mounting database "'.$databox->get_dbname().'"...<info>OK</info>');
|
||||||
|
}
|
||||||
|
|
||||||
|
$process = new Process(('php ' . __DIR__ . '/../../../../../bin/setup system:upgrade -y -f'));
|
||||||
|
$process->run();
|
||||||
|
|
||||||
// create setup dbs
|
// create setup dbs
|
||||||
$command = $this->getApplication()->find('ini:setup-tests-dbs');
|
$command = $this->getApplication()->find('ini:setup-tests-dbs');
|
||||||
$input = new ArrayInput(array(
|
$input = new ArrayInput(array(
|
||||||
@@ -131,6 +191,8 @@ class IniReset extends Command
|
|||||||
));
|
));
|
||||||
$command->run($input, $output);
|
$command->run($input, $output);
|
||||||
|
|
||||||
|
$this->container['phraseanet.registry']->set('GV_base_datapath_noweb', $dataPath, \registry::TYPE_STRING);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
namespace Alchemy\Phrasea\Command\Setup;
|
namespace Alchemy\Phrasea\Command\Setup;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Command\Command;
|
use Alchemy\Phrasea\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
use Doctrine\DBAL\Driver\Connection;
|
use Doctrine\DBAL\Driver\Connection;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
@@ -111,6 +112,13 @@ class Install extends Command
|
|||||||
$this->container['phraseanet.installer']->setPhraseaIndexerPath($indexer);
|
$this->container['phraseanet.installer']->setPhraseaIndexerPath($indexer);
|
||||||
$this->container['phraseanet.installer']->install($email, $password, $abConn, $serverName, $dataPath, $dbConn, $template, $this->detectBinaries());
|
$this->container['phraseanet.installer']->install($email, $password, $abConn, $serverName, $dataPath, $dbConn, $template, $this->detectBinaries());
|
||||||
|
|
||||||
|
if (null !== $this->getApplication()) {
|
||||||
|
$command = $this->getApplication()->find('crossdomain:generate');
|
||||||
|
$command->run(new ArrayInput(array(
|
||||||
|
'command' => 'crossdomain:generate'
|
||||||
|
)), $output);
|
||||||
|
}
|
||||||
|
|
||||||
$output->writeln("<info>Install successful !</info>");
|
$output->writeln("<info>Install successful !</info>");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Command\Setup;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Command\Command;
|
||||||
|
use Alchemy\Phrasea\Exception\RuntimeException;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
class StaticConfigurationDumper extends Command
|
||||||
|
{
|
||||||
|
public function __construct($name = null)
|
||||||
|
{
|
||||||
|
parent::__construct('static-file:dump-configuration');
|
||||||
|
|
||||||
|
$this->setDescription('Dump the virtual host configuration depending on Phraseanet configuration');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||||
|
{
|
||||||
|
$output->writeln('');
|
||||||
|
|
||||||
|
if (!$this->container['phraseanet.static-file-factory']->isStaticFileModeEnabled()) {
|
||||||
|
$output->writeln('Static file support is <error>disabled</error>');
|
||||||
|
$ret = 1;
|
||||||
|
} else {
|
||||||
|
$output->writeln('Static file support is <info>enabled</info>');
|
||||||
|
$ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$configuration = $this->container['phraseanet.static-file-factory']->getMode(true, true)->getVirtualHostConfiguration();
|
||||||
|
$output->writeln('Static file configuration seems <info>OK</info>');
|
||||||
|
$output->writeln($configuration);
|
||||||
|
} catch (RuntimeException $e) {
|
||||||
|
$output->writeln('Static file configuration seems <error>invalid</error>');
|
||||||
|
$ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output->writeln('');
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
}
|
64
lib/Alchemy/Phrasea/Command/Setup/StaticMappingGenerator.php
Normal file
64
lib/Alchemy/Phrasea/Command/Setup/StaticMappingGenerator.php
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Command\Setup;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Command\Command;
|
||||||
|
use Alchemy\Phrasea\Http\StaticFile\StaticFileFactory;
|
||||||
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
|
class StaticMappingGenerator extends Command
|
||||||
|
{
|
||||||
|
public function __construct($name = null)
|
||||||
|
{
|
||||||
|
parent::__construct('static-file:generate-mapping');
|
||||||
|
|
||||||
|
$this->addOption('write', 'w', null, 'Writes the configuration')
|
||||||
|
->addOption('enabled', 'e', null, 'Set the enable toggle to `true`')
|
||||||
|
->addArgument('type', InputArgument::REQUIRED, 'The configuration type, either `nginx` or `apache`')
|
||||||
|
->setDescription('Generates Phraseanet Static file configuration');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||||
|
{
|
||||||
|
$enabled = $input->getOption('enabled');
|
||||||
|
$type = strtolower($input->getArgument('type'));
|
||||||
|
|
||||||
|
$factory = new StaticFileFactory($this->container['monolog'], true, $type, $this->container['phraseanet.thumb-symlinker']);
|
||||||
|
$mode = $factory->getMode(true);
|
||||||
|
|
||||||
|
$conf = array(
|
||||||
|
'enabled' => $enabled,
|
||||||
|
'type' => $type,
|
||||||
|
'mapping' => $mode->getMapping(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($input->getOption('write')) {
|
||||||
|
$output->write("Writing configuration ...");
|
||||||
|
$this->container['phraseanet.configuration']['static-file'] = $conf;
|
||||||
|
$output->writeln(" <info>OK</info>");
|
||||||
|
$output->writeln("");
|
||||||
|
$output->write("It is now strongly recommended to use <info>static-file:dump-configuration</info> command to upgrade your virtual-host");
|
||||||
|
} else {
|
||||||
|
$output->writeln("Configuration will <info>not</info> be written, use <info>--write</info> option to write it");
|
||||||
|
$output->writeln("");
|
||||||
|
$output->writeln(Yaml::dump(array('static-file' => $conf), 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
@@ -448,24 +448,6 @@ class Root implements ControllerProviderInterface
|
|||||||
->assert('bit', '\d+')
|
->assert('bit', '\d+')
|
||||||
->bind('database_submit_statusbit');
|
->bind('database_submit_statusbit');
|
||||||
|
|
||||||
$controllers->get('/tests/connection/mysql/', function (Application $app, Request $request) {
|
|
||||||
$dbHelper = new DatabaseHelper($app, $request);
|
|
||||||
|
|
||||||
return $app->json($dbHelper->checkConnection());
|
|
||||||
});
|
|
||||||
|
|
||||||
$controllers->get('/tests/pathurl/path/', function (Application $app, Request $request) {
|
|
||||||
$pathHelper = new PathHelper($app, $request);
|
|
||||||
|
|
||||||
return $app->json($pathHelper->checkPath());
|
|
||||||
});
|
|
||||||
|
|
||||||
$controllers->get('/tests/pathurl/url/', function (Application $app, Request $request) {
|
|
||||||
$pathHelper = new PathHelper($app, $request);
|
|
||||||
|
|
||||||
return $app->json($pathHelper->checkUrl());
|
|
||||||
});
|
|
||||||
|
|
||||||
return $controllers;
|
return $controllers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,7 @@ use Alchemy\Phrasea\Authentication\Context;
|
|||||||
use Alchemy\Phrasea\Authentication\Exception\AccountLockedException;
|
use Alchemy\Phrasea\Authentication\Exception\AccountLockedException;
|
||||||
use Alchemy\Phrasea\Authentication\Exception\RequireCaptchaException;
|
use Alchemy\Phrasea\Authentication\Exception\RequireCaptchaException;
|
||||||
use Alchemy\Phrasea\Core\Event\PreAuthenticate;
|
use Alchemy\Phrasea\Core\Event\PreAuthenticate;
|
||||||
|
use Alchemy\Phrasea\Core\Event\PostAuthenticate;
|
||||||
use Alchemy\Phrasea\Core\PhraseaEvents;
|
use Alchemy\Phrasea\Core\PhraseaEvents;
|
||||||
use Silex\Application;
|
use Silex\Application;
|
||||||
use Silex\ControllerProviderInterface;
|
use Silex\ControllerProviderInterface;
|
||||||
@@ -88,7 +89,10 @@ class Oauth2 implements ControllerProviderInterface
|
|||||||
return $app->redirectPath('oauth2_authorize', array_merge(array('error' => 'account-locked'), $params));
|
return $app->redirectPath('oauth2_authorize', array_merge(array('error' => 'account-locked'), $params));
|
||||||
}
|
}
|
||||||
|
|
||||||
$app['authentication']->openAccount($app['repo.users']->find($usrId));
|
$user = $app['repo.users']->find($usrId);
|
||||||
|
$app['authentication']->openAccount($user);
|
||||||
|
$event = new PostAuthenticate($request, new Response(), $user, $context);
|
||||||
|
$app['dispatcher']->dispatch(PhraseaEvents::POST_AUTHENTICATE, $event);
|
||||||
} else {
|
} else {
|
||||||
$r = new Response($app['twig']->render($template, array('error' => $error, "auth" => $oauth2Adapter)));
|
$r = new Response($app['twig']->render($template, array('error' => $error, "auth" => $oauth2Adapter)));
|
||||||
$r->headers->set('Content-Type', 'text/html');
|
$r->headers->set('Content-Type', 'text/html');
|
||||||
|
@@ -1089,25 +1089,13 @@ class V1 implements ControllerProviderInterface
|
|||||||
|
|
||||||
$record->set_metadatas($metadatas);
|
$record->set_metadatas($metadatas);
|
||||||
|
|
||||||
return Result::create($request, ["record_metadatas" => $this->list_record_caption($record->get_caption())])->createResponse();
|
/**
|
||||||
}
|
* Check wether the current user is Admin or not
|
||||||
|
*/
|
||||||
public function set_record_status(Application $app, Request $request, $databox_id, $record_id)
|
$mustBeAdmin = function (Request $request) use ($app) {
|
||||||
{
|
$user = $app['token']->get_account()->get_user();
|
||||||
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
if (!$user->ACL()->is_admin()) {
|
||||||
$record = $databox->get_record($record_id);
|
throw new \API_V1_exception_unauthorized('You are not authorized');
|
||||||
$status_bits = $databox->get_statusbits();
|
|
||||||
|
|
||||||
$status = $request->get('status');
|
|
||||||
|
|
||||||
$datas = strrev($record->get_status());
|
|
||||||
|
|
||||||
if (!is_array($status)) {
|
|
||||||
return $this->getBadRequest($app, $request);
|
|
||||||
}
|
|
||||||
foreach ($status as $n => $value) {
|
|
||||||
if ($n > 31 || $n < 4) {
|
|
||||||
return $this->getBadRequest($app, $request);
|
|
||||||
}
|
}
|
||||||
if (!in_array($value, ['0', '1'])) {
|
if (!in_array($value, ['0', '1'])) {
|
||||||
return $this->getBadRequest($app, $request);
|
return $this->getBadRequest($app, $request);
|
||||||
@@ -1116,8 +1104,19 @@ class V1 implements ControllerProviderInterface
|
|||||||
return $this->getBadRequest($app, $request);
|
return $this->getBadRequest($app, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
$datas = substr($datas, 0, ($n)) . $value . substr($datas, ($n + 2));
|
/**
|
||||||
}
|
* Get scheduler informations
|
||||||
|
*
|
||||||
|
* Route : /monitor/scheduler/
|
||||||
|
*
|
||||||
|
* Method : GET
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$controllers->get('/monitor/scheduler/', function (SilexApplication $app, Request $request) {
|
||||||
|
return $app['api']->get_scheduler($app)->get_response();
|
||||||
|
})->before($mustBeAdmin);
|
||||||
|
|
||||||
$record->set_binary_status(strrev($datas));
|
$record->set_binary_status(strrev($datas));
|
||||||
$app['phraseanet.SE']->updateRecord($record);
|
$app['phraseanet.SE']->updateRecord($record);
|
||||||
@@ -1163,13 +1162,19 @@ class V1 implements ControllerProviderInterface
|
|||||||
try {
|
try {
|
||||||
$record = $app['phraseanet.appbox']->get_databox($databox_id)->get_record($record_id);
|
$record = $app['phraseanet.appbox']->get_databox($databox_id)->get_record($record_id);
|
||||||
|
|
||||||
return Result::create($request, ['record' => $this->list_record($app, $record)])->createResponse();
|
/**
|
||||||
} catch (NotFoundHttpException $e) {
|
* Route /databoxes/DATABOX_ID/collections/
|
||||||
return Result::createError($request, 404, $app->trans('Record Not Found'))->createResponse();
|
*
|
||||||
} catch (\Exception $e) {
|
* Method : GET
|
||||||
return $this->getBadRequest($app, $request, $app->trans('An error occured'));
|
*
|
||||||
}
|
* Parameters ;
|
||||||
}
|
* DATABOX_ID : required INT
|
||||||
|
*/
|
||||||
|
$controllers->get('/databoxes/{databox_id}/collections/', function (SilexApplication $app, $databox_id) {
|
||||||
|
return $app['api']
|
||||||
|
->get_databox_collections($app['request'], $databox_id)
|
||||||
|
->get_response();
|
||||||
|
})->assert('databox_id', '\d+');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return detailed informations about one story
|
* Return detailed informations about one story
|
||||||
@@ -1184,13 +1189,20 @@ class V1 implements ControllerProviderInterface
|
|||||||
try {
|
try {
|
||||||
$story = $app['phraseanet.appbox']->get_databox($databox_id)->get_record($story_id);
|
$story = $app['phraseanet.appbox']->get_databox($databox_id)->get_record($story_id);
|
||||||
|
|
||||||
return Result::create($request, ['story' => $this->list_story($app, $request, $story)])->createResponse();
|
/**
|
||||||
} catch (NotFoundHttpException $e) {
|
* Route /databoxes/DATABOX_ID/status/
|
||||||
return Result::createError($request, 404, $app->trans('Story Not Found'))->createResponse();
|
*
|
||||||
} catch (\Exception $e) {
|
* Method : GET
|
||||||
return $this->getBadRequest($app, $request, $app->trans('An error occured'));
|
*
|
||||||
}
|
* Parameters ;
|
||||||
}
|
* DATABOX_ID : required INT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$controllers->get('/databoxes/{databox_id}/status/', function (SilexApplication $app, $databox_id) {
|
||||||
|
return $app['api']
|
||||||
|
->get_databox_status($app['request'], $databox_id)
|
||||||
|
->get_response();
|
||||||
|
})->assert('databox_id', '\d+');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the baskets list of the authenticated user
|
* Return the baskets list of the authenticated user
|
||||||
@@ -1233,15 +1245,25 @@ class V1 implements ControllerProviderInterface
|
|||||||
return $this->getBadRequest($app, $request, 'Missing basket name parameter');
|
return $this->getBadRequest($app, $request, 'Missing basket name parameter');
|
||||||
}
|
}
|
||||||
|
|
||||||
$Basket = new Basket();
|
$controllers->get('/quarantine/list/', function (SilexApplication $app, Request $request) {
|
||||||
$Basket->setUser($app['authentication']->getUser());
|
return $app['api']->list_quarantine($app, $request)->get_response();
|
||||||
$Basket->setName($name);
|
});
|
||||||
|
|
||||||
$app['EM']->persist($Basket);
|
$controllers->get('/quarantine/item/{lazaret_id}/', function ($lazaret_id, SilexApplication $app, Request $request) {
|
||||||
$app['EM']->flush();
|
return $app['api']->list_quarantine_item($lazaret_id, $app, $request)->get_response();
|
||||||
|
});
|
||||||
|
|
||||||
return Result::create($request, ["basket" => $this->list_basket($app, $Basket)])->createResponse();
|
/**
|
||||||
}
|
* Route : /records/add/
|
||||||
|
*
|
||||||
|
* Method : POST
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$controllers->post('/records/add/', function (SilexApplication $app, Request $request) {
|
||||||
|
return $app['api']->add_record($app, $request)->get_response();
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a basket
|
* Delete a basket
|
||||||
@@ -1258,43 +1280,50 @@ class V1 implements ControllerProviderInterface
|
|||||||
return $this->search_baskets($app, $request);
|
return $this->search_baskets($app, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
$controllers->get('/records/{databox_id}/{record_id}/caption/', function (SilexApplication $app, $databox_id, $record_id) {
|
||||||
* Retrieve a basket
|
return $app['api']
|
||||||
*
|
->caption_records($app['request'], $databox_id, $record_id)
|
||||||
* @param Request $request
|
->get_response();
|
||||||
* @param Basket $basket
|
})->assert('databox_id', '\d+')->assert('record_id', '\d+');
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function get_basket(Application $app, Request $request, Basket $basket)
|
|
||||||
{
|
|
||||||
$ret = [
|
|
||||||
"basket" => $this->list_basket($app, $basket),
|
|
||||||
"basket_elements" => $this->list_basket_content($app, $basket)
|
|
||||||
];
|
|
||||||
|
|
||||||
return Result::create($request, $ret)->createResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function get_current_user(Application $app, Request $request)
|
|
||||||
{
|
|
||||||
$ret = ["user" => $this->list_user($app['authentication']->getUser())];
|
|
||||||
|
|
||||||
return Result::create($request, $ret)->createResponse();
|
return Result::create($request, $ret)->createResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve elements of one basket
|
* Route : /records/DATABOX_ID/RECORD_ID/metadatas/
|
||||||
|
*
|
||||||
|
* Method : GET
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* DATABOX_ID : required INT
|
||||||
|
* RECORD_ID : required INT
|
||||||
*
|
*
|
||||||
* @param Basket $Basket
|
|
||||||
* @return type
|
|
||||||
*/
|
*/
|
||||||
private function list_basket_content(Application $app, Basket $Basket)
|
$controllers->get('/records/{databox_id}/{record_id}/metadatas/', function (SilexApplication $app, $databox_id, $record_id) {
|
||||||
{
|
return $app['api']
|
||||||
return array_map(function (BasketElement $element) use ($app) {
|
->get_record_metadatas($app['request'], $databox_id, $record_id)
|
||||||
return $this->list_basket_element($app, $element);
|
->get_response();
|
||||||
}, iterator_to_array($Basket->getElements()));
|
})->assert('databox_id', '\d+')->assert('record_id', '\d+');
|
||||||
|
|
||||||
|
return Result::create($request, $ret)->createResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Route : /records/DATABOX_ID/RECORD_ID/status/
|
||||||
|
*
|
||||||
|
* Method : GET
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* DATABOX_ID : required INT
|
||||||
|
* RECORD_ID : required INT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$controllers->get('/records/{databox_id}/{record_id}/status/', function (SilexApplication $app, $databox_id, $record_id) {
|
||||||
|
return $app['api']
|
||||||
|
->get_record_status($app['request'], $databox_id, $record_id)
|
||||||
|
->get_response();
|
||||||
|
})->assert('databox_id', '\d+')->assert('record_id', '\d+');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve detailled informations about a basket element
|
* Retrieve detailled informations about a basket element
|
||||||
*
|
*
|
||||||
@@ -1310,10 +1339,21 @@ class V1 implements ControllerProviderInterface
|
|||||||
'validation_item' => null != $basket_element->getBasket()->getValidation(),
|
'validation_item' => null != $basket_element->getBasket()->getValidation(),
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($basket_element->getBasket()->getValidation()) {
|
/**
|
||||||
$choices = [];
|
* Route : /records/DATABOX_ID/RECORD_ID/related/
|
||||||
$agreement = null;
|
*
|
||||||
$note = '';
|
* Method : GET
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* DATABOX_ID : required INT
|
||||||
|
* RECORD_ID : required INT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$controllers->get('/records/{databox_id}/{record_id}/related/', function (SilexApplication $app, $databox_id, $record_id) {
|
||||||
|
return $app['api']
|
||||||
|
->get_record_related($app['request'], $databox_id, $record_id)
|
||||||
|
->get_response();
|
||||||
|
})->assert('databox_id', '\d+')->assert('record_id', '\d+');
|
||||||
|
|
||||||
foreach ($basket_element->getValidationDatas() as $validation_datas) {
|
foreach ($basket_element->getValidationDatas() as $validation_datas) {
|
||||||
$participant = $validation_datas->getParticipant();
|
$participant = $validation_datas->getParticipant();
|
||||||
@@ -1334,37 +1374,78 @@ class V1 implements ControllerProviderInterface
|
|||||||
'note' => null === $validation_datas->getNote() ? '' : $validation_datas->getNote(),
|
'note' => null === $validation_datas->getNote() ? '' : $validation_datas->getNote(),
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($user->getId() == $app['authentication']->getUser()->getId()) {
|
/**
|
||||||
$agreement = $validation_datas->getAgreement();
|
* Route : /records/DATABOX_ID/RECORD_ID/embed/
|
||||||
$note = null === $validation_datas->getNote() ? '' : $validation_datas->getNote();
|
*
|
||||||
}
|
* Method : GET
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* DATABOX_ID : required INT
|
||||||
|
* RECORD_ID : required INT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$controllers->get('/records/{databox_id}/{record_id}/embed/', function (SilexApplication $app, $databox_id, $record_id) {
|
||||||
|
return $app['api']
|
||||||
|
->get_record_embed($app['request'], $databox_id, $record_id)
|
||||||
|
->get_response();
|
||||||
|
})->assert('databox_id', '\d+')->assert('record_id', '\d+');
|
||||||
|
|
||||||
$ret['validation_choices'] = $choices;
|
$ret['validation_choices'] = $choices;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret['agreement'] = $agreement;
|
/**
|
||||||
$ret['note'] = $note;
|
* Route : /records/DATABOX_ID/RECORD_ID/setmetadatas/
|
||||||
}
|
*
|
||||||
|
* Method : POST
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* DATABOX_ID : required INT
|
||||||
|
* RECORD_ID : required INT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$controllers->post('/records/{databox_id}/{record_id}/setmetadatas/', function (SilexApplication $app, $databox_id, $record_id) {
|
||||||
|
return $app['api']
|
||||||
|
->set_record_metadatas($app['request'], $databox_id, $record_id)
|
||||||
|
->get_response();
|
||||||
|
})->assert('databox_id', '\d+')->assert('record_id', '\d+');
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the name of one basket
|
* Route : /records/DATABOX_ID/RECORD_ID/setstatus/
|
||||||
|
*
|
||||||
|
* Method : POST
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* DATABOX_ID : required INT
|
||||||
|
* RECORD_ID : required INT
|
||||||
*
|
*
|
||||||
* @param Request $request
|
|
||||||
* @param Basket $basket
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function set_basket_title(Application $app, Request $request, Basket $basket)
|
$controllers->post('/records/{databox_id}/{record_id}/setstatus/', function (SilexApplication $app, $databox_id, $record_id) {
|
||||||
{
|
return $app['api']
|
||||||
$basket->setName($request->get('name'));
|
->set_record_status($app['request'], $databox_id, $record_id)
|
||||||
|
->get_response();
|
||||||
|
})->assert('databox_id', '\d+')->assert('record_id', '\d+');
|
||||||
|
|
||||||
$app['EM']->persist($basket);
|
$app['EM']->persist($basket);
|
||||||
$app['EM']->flush();
|
$app['EM']->flush();
|
||||||
|
|
||||||
return Result::create($request, ["basket" => $this->list_basket($app, $basket)])->createResponse();
|
/**
|
||||||
}
|
* Route : /records/DATABOX_ID/RECORD_ID/setcollection/
|
||||||
|
*
|
||||||
|
* Method : POST
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* DATABOX_ID : required INT
|
||||||
|
* RECORD_ID : required INT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$controllers->post('/records/{databox_id}/{record_id}/setcollection/', function (SilexApplication $app, $databox_id, $record_id) {
|
||||||
|
return $app['api']
|
||||||
|
->set_record_collection($app['request'], $databox_id, $record_id)
|
||||||
|
->get_response();
|
||||||
|
})->assert('databox_id', '\d+')->assert('record_id', '\d+');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the description of one basket
|
* Change the description of one basket
|
||||||
@@ -1377,8 +1458,11 @@ class V1 implements ControllerProviderInterface
|
|||||||
{
|
{
|
||||||
$basket->setDescription($request->get('description'));
|
$basket->setDescription($request->get('description'));
|
||||||
|
|
||||||
$app['EM']->persist($basket);
|
$controllers->get('/records/{databox_id}/{record_id}/', function (SilexApplication $app, $databox_id, $record_id) {
|
||||||
$app['EM']->flush();
|
return $app['api']
|
||||||
|
->get_record($app['request'], $databox_id, $record_id)
|
||||||
|
->get_response();
|
||||||
|
})->assert('databox_id', '\d+')->assert('record_id', '\d+');
|
||||||
|
|
||||||
return Result::create($request, ["basket" => $this->list_basket($app, $basket)])->createResponse();
|
return Result::create($request, ["basket" => $this->list_basket($app, $basket)])->createResponse();
|
||||||
}
|
}
|
||||||
@@ -1441,10 +1525,17 @@ class V1 implements ControllerProviderInterface
|
|||||||
|
|
||||||
$feed = Aggregate::createFromUser($app, $user, $restrictions);
|
$feed = Aggregate::createFromUser($app, $user, $restrictions);
|
||||||
|
|
||||||
$offset_start = (int) ($request->get('offset_start') ? : 0);
|
$controllers->get('/feeds/content/', function (SilexApplication $app) {
|
||||||
$per_page = (int) ($request->get('per_page') ? : 5);
|
return $app['api']
|
||||||
|
->get_publications($app['request'], $app['authentication']->getUser())
|
||||||
|
->get_response();
|
||||||
|
});
|
||||||
|
|
||||||
$per_page = (($per_page >= 1) && ($per_page <= 20)) ? $per_page : 20;
|
$controllers->get('/feeds/entry/{entry_id}/', function (SilexApplication $app, $entry_id) {
|
||||||
|
return $app['api']
|
||||||
|
->get_feed_entry($app['request'], $entry_id, $app['authentication']->getUser())
|
||||||
|
->get_response();
|
||||||
|
})->assert('entry_id', '\d+');
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'total_entries' => $feed->getCountTotalEntries(),
|
'total_entries' => $feed->getCountTotalEntries(),
|
||||||
@@ -1462,9 +1553,18 @@ class V1 implements ControllerProviderInterface
|
|||||||
$entry = $app['repo.feed-entries']->find($entry_id);
|
$entry = $app['repo.feed-entries']->find($entry_id);
|
||||||
$collection = $entry->getFeed()->getCollection($app);
|
$collection = $entry->getFeed()->getCollection($app);
|
||||||
|
|
||||||
if (null !== $collection && !$app['acl']->get($user)->has_access_to_base($collection->get_base_id())) {
|
/**
|
||||||
return Result::createError($request, 403, 'You have not access to the parent feed')->createResponse();
|
* Route : /stories/DATABOX_ID/RECORD_ID/embed/
|
||||||
}
|
*
|
||||||
|
* Method : GET
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* DATABOX_ID : required INT
|
||||||
|
* RECORD_ID : required INT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$controllers->get('/stories/{databox_id}/{story_id}/embed/', function ($databox_id, $story_id) use ($app) {
|
||||||
|
$result = $app['api']->get_story_embed($app['request'], $databox_id, $story_id);
|
||||||
|
|
||||||
return Result::create($request, ['entry' => $this->list_publication_entry($app, $entry)])->createResponse();
|
return Result::create($request, ['entry' => $this->list_publication_entry($app, $entry)])->createResponse();
|
||||||
}
|
}
|
||||||
@@ -1565,12 +1665,7 @@ class V1 implements ControllerProviderInterface
|
|||||||
if ($media->get_name() !== 'document' && false === $app['acl']->get($app['authentication']->getUser())->has_access_to_subdef($record, $media->get_name())) {
|
if ($media->get_name() !== 'document' && false === $app['acl']->get($app['authentication']->getUser())->has_access_to_subdef($record, $media->get_name())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ($media->get_name() === 'document'
|
)->assert('databox_id', '\d+')->assert('story_id', '\d+');
|
||||||
&& !$app['acl']->get($app['authentication']->getUser())->has_right_on_base($record->get_base_id(), 'candwnldhd')
|
|
||||||
&& !$app['acl']->get($app['authentication']->getUser())->has_hd_grant($record)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($media->get_permalink() instanceof \media_Permalink_Adapter) {
|
if ($media->get_permalink() instanceof \media_Permalink_Adapter) {
|
||||||
$permalink = $this->list_permalink($media->get_permalink());
|
$permalink = $this->list_permalink($media->get_permalink());
|
||||||
@@ -1578,29 +1673,11 @@ class V1 implements ControllerProviderInterface
|
|||||||
$permalink = null;
|
$permalink = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
$controllers->get('/stories/{databox_id}/{story_id}/', function ($databox_id, $story_id) use ($app) {
|
||||||
'name' => $media->get_name(),
|
$result = $app['api']->get_story($app['request'], $databox_id, $story_id);
|
||||||
'permalink' => $permalink,
|
|
||||||
'height' => $media->get_height(),
|
|
||||||
'width' => $media->get_width(),
|
|
||||||
'filesize' => $media->get_size(),
|
|
||||||
'devices' => $media->getDevices(),
|
|
||||||
'player_type' => $media->get_type(),
|
|
||||||
'mime_type' => $media->get_mime(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
return $result->get_response();
|
||||||
* Retrieve detailled information about one permalink
|
})->assert('databox_id', '\d+')->assert('story_id', '\d+');
|
||||||
*
|
|
||||||
* @param media_Permalink_Adapter $permalink
|
|
||||||
*
|
|
||||||
* @return type
|
|
||||||
*/
|
|
||||||
private function list_permalink(\media_Permalink_Adapter $permalink)
|
|
||||||
{
|
|
||||||
$downloadUrl = $permalink->get_url();
|
|
||||||
$downloadUrl->getQuery()->set('download', '1');
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'created_on' => $permalink->get_created_on()->format(DATE_ATOM),
|
'created_on' => $permalink->get_created_on()->format(DATE_ATOM),
|
||||||
@@ -1615,24 +1692,15 @@ class V1 implements ControllerProviderInterface
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
$controllers->get('/stories/{databox_id}/{story_id}/', function ($databox_id, $story_id) use ($app) {
|
||||||
* Retrieve detailled information about one status
|
$result = $app['api']->get_story($app['request'], $databox_id, $story_id);
|
||||||
*
|
|
||||||
* @param \databox $databox
|
|
||||||
* @param string $status
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
private function list_record_status(\databox $databox, $status)
|
|
||||||
{
|
|
||||||
$status = strrev($status);
|
|
||||||
|
|
||||||
$ret = [];
|
return $result->get_response();
|
||||||
foreach ($databox->get_statusbits() as $bit => $status_datas) {
|
})->assert('databox_id', '\d+')->assert('story_id', '\d+');
|
||||||
$ret[] = ['bit' => $bit, 'state' => !!substr($status, ($bit - 1), 1)];
|
$controllers->get('/stories/{any_id}/{anyother_id}/', $bad_request_exception);
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
$controllers->get('/me/', function (SilexApplication $app, Request $request) {
|
||||||
}
|
$result = $app['api']->get_current_user($app, $request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all field about a specified caption
|
* List all field about a specified caption
|
||||||
|
@@ -40,7 +40,20 @@ class Export implements ControllerProviderInterface
|
|||||||
$app['firewall']->requireNotGuest();
|
$app['firewall']->requireNotGuest();
|
||||||
});
|
});
|
||||||
|
|
||||||
$controllers->post('/multi-export/', 'controller.prod.export:displayMultiExport')
|
/**
|
||||||
|
* Display multi export
|
||||||
|
*
|
||||||
|
* name : export_multi_export
|
||||||
|
*
|
||||||
|
* description : Display multi export
|
||||||
|
*
|
||||||
|
* method : POST
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->post('/multi-export/', $this->call('displayMultiExport'))
|
||||||
->bind('export_multi_export');
|
->bind('export_multi_export');
|
||||||
|
|
||||||
$controllers->post('/mail/', 'controller.prod.export:exportMail')
|
$controllers->post('/mail/', 'controller.prod.export:exportMail')
|
||||||
|
@@ -107,23 +107,6 @@ class Login implements ControllerProviderInterface
|
|||||||
$controllers->get('/', 'login.controller:login')
|
$controllers->get('/', 'login.controller:login')
|
||||||
->before(function (Request $request) use ($app) {
|
->before(function (Request $request) use ($app) {
|
||||||
if (null !== $response = $app['firewall']->requireNotAuthenticated()) {
|
if (null !== $response = $app['firewall']->requireNotAuthenticated()) {
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== $request->query->get('postlog')) {
|
|
||||||
|
|
||||||
// if isset postlog parameter, set cookie and log out current user
|
|
||||||
// then post login operation like getting baskets from an invit session
|
|
||||||
// could be done by Session_handler authentication process
|
|
||||||
|
|
||||||
$params = [];
|
|
||||||
|
|
||||||
if (null !== $redirect = $request->query->get('redirect')) {
|
|
||||||
$params = ['redirect' => ltrim($redirect, '/')];
|
|
||||||
}
|
|
||||||
|
|
||||||
$response = $app->redirectPath('logout', $params);
|
|
||||||
$response->headers->setCookie(new Cookie('postlog', 1));
|
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
@@ -698,7 +681,6 @@ class Login implements ControllerProviderInterface
|
|||||||
|
|
||||||
$response->headers->clearCookie('persistent');
|
$response->headers->clearCookie('persistent');
|
||||||
$response->headers->clearCookie('last_act');
|
$response->headers->clearCookie('last_act');
|
||||||
$response->headers->clearCookie('postlog');
|
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
@@ -799,7 +781,6 @@ class Login implements ControllerProviderInterface
|
|||||||
$response = $app->redirectPath('prod');
|
$response = $app->redirectPath('prod');
|
||||||
}
|
}
|
||||||
|
|
||||||
$response->headers->clearCookie('postlog');
|
|
||||||
$response->headers->clearCookie('last_act');
|
$response->headers->clearCookie('last_act');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
@@ -1001,21 +982,6 @@ class Login implements ControllerProviderInterface
|
|||||||
$response = $this->generateAuthResponse($app, $app['browser'], $request->request->get('redirect'));
|
$response = $this->generateAuthResponse($app, $app['browser'], $request->request->get('redirect'));
|
||||||
$response->headers->clearCookie('invite-usr-id');
|
$response->headers->clearCookie('invite-usr-id');
|
||||||
|
|
||||||
if ($request->cookies->has('postlog') && $request->cookies->get('postlog') == '1') {
|
|
||||||
if (!$user->isGuest() && $request->cookies->has('invite-usr_id')) {
|
|
||||||
if ($user->getId() != $inviteUsrId = $request->cookies->get('invite-usr_id')) {
|
|
||||||
|
|
||||||
$repo = $app['repo.baskets'];
|
|
||||||
$baskets = $repo->findBy(['usr_id' => $inviteUsrId]);
|
|
||||||
|
|
||||||
foreach ($baskets as $basket) {
|
|
||||||
$basket->setUser($user);
|
|
||||||
$app['EM']->persist($basket);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->request->get('remember-me') == '1') {
|
if ($request->request->get('remember-me') == '1') {
|
||||||
$nonce = $app['random.medium']->generateString(64);
|
$nonce = $app['random.medium']->generateString(64);
|
||||||
$string = $app['browser']->getBrowser() . '_' . $app['browser']->getPlatform();
|
$string = $app['browser']->getBrowser() . '_' . $app['browser']->getPlatform();
|
||||||
|
@@ -142,7 +142,7 @@ class Setup implements ControllerProviderInterface
|
|||||||
$database_host = $request->request->get('hostname');
|
$database_host = $request->request->get('hostname');
|
||||||
$database_port = $request->request->get('port');
|
$database_port = $request->request->get('port');
|
||||||
$database_user = $request->request->get('user');
|
$database_user = $request->request->get('user');
|
||||||
$database_password = $request->request->get('password');
|
$database_password = $request->request->get('db_password');
|
||||||
|
|
||||||
$appbox_name = $request->request->get('ab_name');
|
$appbox_name = $request->request->get('ab_name');
|
||||||
$databox_name = $request->request->get('db_name');
|
$databox_name = $request->request->get('db_name');
|
||||||
|
@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\Core\Provider;
|
|||||||
use Alchemy\Phrasea\Core\Event\Subscriber\XSendFileSubscriber;
|
use Alchemy\Phrasea\Core\Event\Subscriber\XSendFileSubscriber;
|
||||||
use Alchemy\Phrasea\Http\H264PseudoStreaming\H264Factory;
|
use Alchemy\Phrasea\Http\H264PseudoStreaming\H264Factory;
|
||||||
use Alchemy\Phrasea\Http\ServeFileResponseFactory;
|
use Alchemy\Phrasea\Http\ServeFileResponseFactory;
|
||||||
|
use Alchemy\Phrasea\Http\StaticFile\StaticFileFactory;
|
||||||
use Alchemy\Phrasea\Http\XSendFile\XSendFileFactory;
|
use Alchemy\Phrasea\Http\XSendFile\XSendFileFactory;
|
||||||
use Silex\Application;
|
use Silex\Application;
|
||||||
use Silex\ServiceProviderInterface;
|
use Silex\ServiceProviderInterface;
|
||||||
@@ -33,10 +34,18 @@ class FileServeServiceProvider implements ServiceProviderInterface
|
|||||||
return H264Factory::create($app);
|
return H264Factory::create($app);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$app['phraseanet.static-file-factory'] = $app->share(function ($app) {
|
||||||
|
return StaticFileFactory::create($app);
|
||||||
|
});
|
||||||
|
|
||||||
$app['phraseanet.h264'] = $app->share(function ($app) {
|
$app['phraseanet.h264'] = $app->share(function ($app) {
|
||||||
return $app['phraseanet.h264-factory']->createMode(false);
|
return $app['phraseanet.h264-factory']->createMode(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$app['phraseanet.static-file'] = $app->share(function ($app) {
|
||||||
|
return $app['phraseanet.static-file-factory']->getMode(false);
|
||||||
|
});
|
||||||
|
|
||||||
$app['phraseanet.file-serve'] = $app->share(function (Application $app) {
|
$app['phraseanet.file-serve'] = $app->share(function (Application $app) {
|
||||||
return ServeFileResponseFactory::create($app);
|
return ServeFileResponseFactory::create($app);
|
||||||
});
|
});
|
||||||
|
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
namespace Alchemy\Phrasea\Core\Provider;
|
namespace Alchemy\Phrasea\Core\Provider;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Http\StaticFile\Symlink\SymLinker;
|
||||||
|
use Alchemy\Phrasea\Http\StaticFile\Symlink\SymLinkerEncoder;
|
||||||
use Alchemy\Phrasea\Metadata\PhraseanetMetadataReader;
|
use Alchemy\Phrasea\Metadata\PhraseanetMetadataReader;
|
||||||
use Alchemy\Phrasea\Metadata\PhraseanetMetadataSetter;
|
use Alchemy\Phrasea\Metadata\PhraseanetMetadataSetter;
|
||||||
use Alchemy\Phrasea\Authentication\ACLProvider;
|
use Alchemy\Phrasea\Authentication\ACLProvider;
|
||||||
@@ -38,6 +40,14 @@ class PhraseanetServiceProvider implements ServiceProviderInterface
|
|||||||
return $events;
|
return $events;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$app['phraseanet.thumb-symlinker'] = $app->share(function (SilexApplication $app) {
|
||||||
|
return SymLinker::create($app);
|
||||||
|
});
|
||||||
|
|
||||||
|
$app['phraseanet.thumb-symlinker-encoder'] = $app->share(function (SilexApplication $app) {
|
||||||
|
return SymLinkerEncoder::create($app);
|
||||||
|
});
|
||||||
|
|
||||||
$app['acl'] = $app->share(function (SilexApplication $app) {
|
$app['acl'] = $app->share(function (SilexApplication $app) {
|
||||||
return new ACLProvider($app);
|
return new ACLProvider($app);
|
||||||
});
|
});
|
||||||
|
@@ -19,7 +19,7 @@ class DatabaseHelper extends Helper
|
|||||||
$port = (int) $this->request->query->get('port', 3306);
|
$port = (int) $this->request->query->get('port', 3306);
|
||||||
$user = $this->request->query->get('user');
|
$user = $this->request->query->get('user');
|
||||||
$password = $this->request->query->get('password');
|
$password = $this->request->query->get('password');
|
||||||
$dbname = $this->request->query->get('dbname');
|
$db_name = $this->request->query->get('db_name');
|
||||||
|
|
||||||
$connection_ok = $db_ok = $is_databox = $is_appbox = $empty = false;
|
$connection_ok = $db_ok = $is_databox = $is_appbox = $empty = false;
|
||||||
|
|
||||||
@@ -36,14 +36,14 @@ class DatabaseHelper extends Helper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $dbname && $connection_ok) {
|
if (null !== $db_name && $connection_ok) {
|
||||||
try {
|
try {
|
||||||
$conn = $this->app['dbal.provider']->get([
|
$conn = $this->app['dbal.provider']->get([
|
||||||
'host' => $hostname,
|
'host' => $hostname,
|
||||||
'port' => $port,
|
'port' => $port,
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
'password' => $password,
|
'password' => $password,
|
||||||
'dbname' => $dbname,
|
'dbname' => $db_name,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$conn->connect();
|
$conn->connect();
|
||||||
|
@@ -52,9 +52,8 @@ class Prod extends Helper
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$meta_struct = $databox->get_meta_structure();
|
foreach ($databox->get_meta_structure() as $fieldMeta) {
|
||||||
foreach ($meta_struct as $meta) {
|
if (!$fieldMeta->is_indexable()) {
|
||||||
if ( ! $meta->is_indexable())
|
|
||||||
continue;
|
continue;
|
||||||
$id = $meta->get_id();
|
$id = $meta->get_id();
|
||||||
$name = $meta->get_name();
|
$name = $meta->get_name();
|
||||||
@@ -64,9 +63,30 @@ class Prod extends Helper
|
|||||||
else
|
else
|
||||||
$dates[$id] = ['sbas' => [$sbas_id], 'fieldname' => $name];
|
$dates[$id] = ['sbas' => [$sbas_id], 'fieldname' => $name];
|
||||||
}
|
}
|
||||||
|
$id = $fieldMeta->get_id();
|
||||||
|
$name = $fieldMeta->get_name();
|
||||||
|
$type = $fieldMeta->get_type();
|
||||||
|
|
||||||
|
$data = array('sbas' => array($sbasId), 'fieldname' => $name, 'type' => $type, 'id' => $id);
|
||||||
|
|
||||||
|
if ($fieldMeta->get_type() === \databox_field::TYPE_DATE) {
|
||||||
|
if (isset($dates[$id])) {
|
||||||
|
$dates[$id]['sbas'][] = $sbasId;
|
||||||
|
} else {
|
||||||
|
$dates[$id] = $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($fieldMeta->get_type() == \databox_field::TYPE_NUMBER || $fieldMeta->get_type() === \databox_field::TYPE_DATE) {
|
||||||
|
if (isset($sort[$id])) {
|
||||||
|
$sort[$id]['sbas'][] = $sbasId;
|
||||||
|
} else {
|
||||||
|
$sort[$id] = $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($fields[$name])) {
|
if (isset($fields[$name])) {
|
||||||
$fields[$name]['sbas'][] = $sbas_id;
|
$fields[$name]['sbas'][] = $sbasId;
|
||||||
} else {
|
} else {
|
||||||
$fields[$name] = [
|
$fields[$name] = [
|
||||||
'sbas' => [$sbas_id]
|
'sbas' => [$sbas_id]
|
||||||
@@ -77,7 +97,7 @@ class Prod extends Helper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $bases[$sbas_id]['thesaurus']) {
|
if (!$bases[$sbasId]['thesaurus']) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( ! $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_sbas($sbas_id, 'bas_modif_th')) {
|
if ( ! $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_sbas($sbas_id, 'bas_modif_th')) {
|
||||||
@@ -85,15 +105,16 @@ class Prod extends Helper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (false !== simplexml_load_string($databox->get_cterms())) {
|
if (false !== simplexml_load_string($databox->get_cterms())) {
|
||||||
$bases[$sbas_id]['cterms'] = true;
|
$bases[$sbasId]['cterms'] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$search_datas['fields'] = $fields;
|
$searchData['fields'] = $fields;
|
||||||
$search_datas['dates'] = $dates;
|
$searchData['dates'] = $dates;
|
||||||
$search_datas['bases'] = $bases;
|
$searchData['bases'] = $bases;
|
||||||
|
$searchData['sort'] = $sort;
|
||||||
|
|
||||||
return $search_datas;
|
return $searchData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRandom()
|
public function getRandom()
|
||||||
|
50
lib/Alchemy/Phrasea/Http/StaticFile/AbstractStaticMode.php
Normal file
50
lib/Alchemy/Phrasea/Http/StaticFile/AbstractStaticMode.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Http\StaticFile;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Http\AbstractServerMode;
|
||||||
|
use Alchemy\Phrasea\Http\StaticFile\Symlink\SymLinker;
|
||||||
|
use Guzzle\Http\Url;
|
||||||
|
|
||||||
|
abstract class AbstractStaticMode extends AbstractServerMode
|
||||||
|
{
|
||||||
|
protected $symlinker;
|
||||||
|
|
||||||
|
public function __construct(array $mapping, SymLinker $symlinker)
|
||||||
|
{
|
||||||
|
$this->symlinker = $symlinker;
|
||||||
|
|
||||||
|
parent::__construct($mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getUrl($pathFile)
|
||||||
|
{
|
||||||
|
$this->ensureSymlink($pathFile);
|
||||||
|
|
||||||
|
return Url::factory(sprintf('%s/%s', $this->mapping['mount-point'], $this->symlinker->getSymlinkBasePath($pathFile)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a link if it does not exists
|
||||||
|
*
|
||||||
|
* @param $pathFile
|
||||||
|
*/
|
||||||
|
private function ensureSymlink($pathFile)
|
||||||
|
{
|
||||||
|
if (false === $this->symlinker->hasSymlink($pathFile)) {
|
||||||
|
$this->symlinker->symlink($pathFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
52
lib/Alchemy/Phrasea/Http/StaticFile/Apache.php
Normal file
52
lib/Alchemy/Phrasea/Http/StaticFile/Apache.php
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Http\StaticFile;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||||
|
|
||||||
|
class Apache extends AbstractStaticMode implements StaticFileModeInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @params array $mapping
|
||||||
|
*
|
||||||
|
* @throws InvalidArgumentException if mapping is invalid;
|
||||||
|
*/
|
||||||
|
public function setMapping(array $mapping)
|
||||||
|
{
|
||||||
|
if (!isset($mapping['directory'])) {
|
||||||
|
throw new InvalidArgumentException('Static file mapping entry must contain at least a "directory" key');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($mapping['mount-point'])) {
|
||||||
|
throw new InvalidArgumentException('Static file mapping entry must contain at least a "mount-point" key');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mapping = $mapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getVirtualHostConfiguration()
|
||||||
|
{
|
||||||
|
$output = "\n";
|
||||||
|
$output .= " Alias ".$this->mapping['mount-point']." ".$this->mapping['directory']."\n";
|
||||||
|
$output .= "\n";
|
||||||
|
$output .= " <Location ".$this->mapping['directory'].">\n";
|
||||||
|
$output .= " Order allow,deny\n";
|
||||||
|
$output .= " Allow from all\n";
|
||||||
|
$output .= " </Location>\n";
|
||||||
|
$output .= "\n";
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
}
|
48
lib/Alchemy/Phrasea/Http/StaticFile/Nginx.php
Normal file
48
lib/Alchemy/Phrasea/Http/StaticFile/Nginx.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Http\StaticFile;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||||
|
|
||||||
|
class Nginx extends AbstractStaticMode implements StaticFileModeInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @params array $mapping
|
||||||
|
*
|
||||||
|
* @throws InvalidArgumentException if mapping is invalid;
|
||||||
|
*/
|
||||||
|
public function setMapping(array $mapping)
|
||||||
|
{
|
||||||
|
if (!isset($mapping['directory'])) {
|
||||||
|
throw new InvalidArgumentException('Static file mapping entry must contain at least a "directory" key');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($mapping['mount-point'])) {
|
||||||
|
throw new InvalidArgumentException('Static file mapping entry must contain at least a "mount-point" key');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mapping = $mapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getVirtualHostConfiguration()
|
||||||
|
{
|
||||||
|
$output = "\n";
|
||||||
|
$output .= " location " . $this->mapping['mount-point']. " {\n";
|
||||||
|
$output .= " alias ".$this->mapping['directory'].";\n";
|
||||||
|
$output .= " }\n";
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
}
|
30
lib/Alchemy/Phrasea/Http/StaticFile/NullMode.php
Normal file
30
lib/Alchemy/Phrasea/Http/StaticFile/NullMode.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Http\StaticFile;
|
||||||
|
|
||||||
|
class NullMode implements StaticFileModeInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getVirtualHostConfiguration()
|
||||||
|
{
|
||||||
|
return "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getUrl($pathFile)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
104
lib/Alchemy/Phrasea/Http/StaticFile/StaticFileFactory.php
Normal file
104
lib/Alchemy/Phrasea/Http/StaticFile/StaticFileFactory.php
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Http\StaticFile;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Application;
|
||||||
|
use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||||
|
use Alchemy\Phrasea\Http\StaticFile\Symlink\SymLinker;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
class StaticFileFactory
|
||||||
|
{
|
||||||
|
private $enabled;
|
||||||
|
private $logger;
|
||||||
|
private $type;
|
||||||
|
/** @var Symlink\SymLinker */
|
||||||
|
private $symlinker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param LoggerInterface $logger
|
||||||
|
* @param bool $enabled
|
||||||
|
* @param string $type
|
||||||
|
* @param SymLinker $symlinker
|
||||||
|
*/
|
||||||
|
public function __construct(LoggerInterface $logger, $enabled, $type, SymLinker $symlinker)
|
||||||
|
{
|
||||||
|
$this->logger = $logger;
|
||||||
|
$this->enabled = (Boolean) $enabled;
|
||||||
|
$this->type = strtolower($type);
|
||||||
|
$this->symlinker = $symlinker;
|
||||||
|
|
||||||
|
$this->mapping = array(
|
||||||
|
'mount-point' => $symlinker->getDefaultAlias(),
|
||||||
|
'directory' => $symlinker->getSymlinkDir()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of StaticFileFactory Factory according to the application
|
||||||
|
* configuration.
|
||||||
|
*
|
||||||
|
* @param Application $app
|
||||||
|
* @return StaticFileFactory
|
||||||
|
*/
|
||||||
|
public static function create(Application $app)
|
||||||
|
{
|
||||||
|
$conf = $app['phraseanet.configuration']['static-file'];
|
||||||
|
|
||||||
|
return new self($app['monolog'], $conf['enabled'], $conf['type'], $app['phraseanet.thumb-symlinker']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new instance of ModeInterface
|
||||||
|
*
|
||||||
|
* @param bool $throwException
|
||||||
|
* @param bool $forceMode
|
||||||
|
*
|
||||||
|
* @return Apache|Nginx|NullMode
|
||||||
|
* @throws InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function getMode($throwException = false, $forceMode = false)
|
||||||
|
{
|
||||||
|
if (false === $this->enabled && true !== $forceMode) {
|
||||||
|
return new NullMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($this->type) {
|
||||||
|
case 'nginx':
|
||||||
|
return new Nginx($this->mapping, $this->symlinker);
|
||||||
|
break;
|
||||||
|
case 'apache':
|
||||||
|
case 'apache2':
|
||||||
|
return new Apache($this->mapping, $this->symlinker);
|
||||||
|
default:
|
||||||
|
$this->logger->error('Invalid static file configuration.');
|
||||||
|
if ($throwException) {
|
||||||
|
throw new InvalidArgumentException(sprintf(
|
||||||
|
'Invalid static file type value "%s"',
|
||||||
|
$this->type
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new NullMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isStaticFileModeEnabled()
|
||||||
|
{
|
||||||
|
return $this->enabled;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Http\StaticFile;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Http\ServerModeInterface;
|
||||||
|
use Guzzle\Http\Url;
|
||||||
|
|
||||||
|
interface StaticFileModeInterface extends ServerModeInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param $pathFile
|
||||||
|
*
|
||||||
|
* @return Url|null
|
||||||
|
*/
|
||||||
|
public function getUrl($pathFile);
|
||||||
|
}
|
93
lib/Alchemy/Phrasea/Http/StaticFile/Symlink/SymLinker.php
Normal file
93
lib/Alchemy/Phrasea/Http/StaticFile/Symlink/SymLinker.php
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Http\StaticFile\Symlink;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||||
|
use Silex\Application;
|
||||||
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
|
use Guzzle\Http\Url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create & retrieve symlinks
|
||||||
|
*/
|
||||||
|
class SymLinker
|
||||||
|
{
|
||||||
|
/** Mount Point Alias Name */
|
||||||
|
const ALIAS = 'thumb';
|
||||||
|
|
||||||
|
protected $encoder;
|
||||||
|
protected $fs;
|
||||||
|
protected $symlinkDir;
|
||||||
|
protected $registry;
|
||||||
|
|
||||||
|
public static function create(Application $app)
|
||||||
|
{
|
||||||
|
return new SymLinker(
|
||||||
|
$app['phraseanet.thumb-symlinker-encoder'],
|
||||||
|
$app['filesystem'],
|
||||||
|
$app['phraseanet.registry'],
|
||||||
|
isset($app['phraseanet.configuration']['static-file']['symlink-directory']) ? $app['phraseanet.configuration']['static-file']['symlink-directory'] : $app['root.path'] . '/tmp/symlinks'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __construct(SymLinkerEncoder $encoder, Filesystem $fs, \registryInterface $registry, $symlinkDir)
|
||||||
|
{
|
||||||
|
$this->encoder = $encoder;
|
||||||
|
$this->fs = $fs;
|
||||||
|
$this->symlinkDir = rtrim($symlinkDir, '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSymlinkDir()
|
||||||
|
{
|
||||||
|
return $this->symlinkDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDefaultAlias()
|
||||||
|
{
|
||||||
|
return sprintf('/%s', self::ALIAS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function symlink($pathFile)
|
||||||
|
{
|
||||||
|
$this->fs->symlink($pathFile, $this->getSymlinkPath($pathFile)) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSymlink($pathFile)
|
||||||
|
{
|
||||||
|
return $this->encoder->encode($pathFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSymlinkBasePath($pathFile)
|
||||||
|
{
|
||||||
|
$symlinkName = $this->getSymlink($pathFile);
|
||||||
|
|
||||||
|
return sprintf('%s/%s/%s',
|
||||||
|
substr($symlinkName, 0, 2),
|
||||||
|
substr($symlinkName, 2, 2),
|
||||||
|
substr($symlinkName, 4)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSymlinkPath($pathFile)
|
||||||
|
{
|
||||||
|
return sprintf(
|
||||||
|
'%s/%s',
|
||||||
|
$this->symlinkDir,
|
||||||
|
$this->getSymlinkBasePath($pathFile)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasSymlink($pathFile)
|
||||||
|
{
|
||||||
|
return file_exists($this->getSymlinkPath($pathFile));
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Http\StaticFile\Symlink;
|
||||||
|
|
||||||
|
use Silex\Application;
|
||||||
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
|
use Guzzle\Http\Url;
|
||||||
|
|
||||||
|
class SymLinkerEncoder
|
||||||
|
{
|
||||||
|
protected $key;
|
||||||
|
|
||||||
|
public static function create(Application $app)
|
||||||
|
{
|
||||||
|
return new self(
|
||||||
|
$app['phraseanet.configuration']['main']['key']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __construct($key)
|
||||||
|
{
|
||||||
|
$this->key = $key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function encode($pathFile)
|
||||||
|
{
|
||||||
|
return hash_hmac('sha512', $pathFile , $this->key);
|
||||||
|
}
|
||||||
|
}
|
@@ -625,7 +625,12 @@ class SearchEngineOptions
|
|||||||
|
|
||||||
if (is_array($request->get('bases'))) {
|
if (is_array($request->get('bases'))) {
|
||||||
$bas = array_map(function ($base_id) use ($app) {
|
$bas = array_map(function ($base_id) use ($app) {
|
||||||
|
try {
|
||||||
return \collection::get_from_base_id($app, $base_id);
|
return \collection::get_from_base_id($app, $base_id);
|
||||||
|
} catch (\Exception_Databox_CollectionNotFound $e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}, $request->get('bases'));
|
}, $request->get('bases'));
|
||||||
} elseif (!$app['authentication']->isAuthenticated()) {
|
} elseif (!$app['authentication']->isAuthenticated()) {
|
||||||
$bas = $app->getOpenCollections();
|
$bas = $app->getOpenCollections();
|
||||||
|
@@ -33,8 +33,8 @@ class Installer
|
|||||||
{
|
{
|
||||||
$this->rollbackInstall($abConn, $dbConn);
|
$this->rollbackInstall($abConn, $dbConn);
|
||||||
|
|
||||||
try {
|
|
||||||
$this->createConfigFile($abConn, $serverName, $binaryData);
|
$this->createConfigFile($abConn, $serverName, $binaryData);
|
||||||
|
try {
|
||||||
$this->createAB();
|
$this->createAB();
|
||||||
$this->populateRegistryData($serverName, $dataPath, $binaryData);
|
$this->populateRegistryData($serverName, $dataPath, $binaryData);
|
||||||
$user = $this->createUser($email, $password);
|
$user = $this->createUser($email, $password);
|
||||||
|
@@ -454,6 +454,21 @@ class databox extends base
|
|||||||
|
|
||||||
public function unmount_databox()
|
public function unmount_databox()
|
||||||
{
|
{
|
||||||
|
if ($this->app['phraseanet.static-file-factory']->isStaticFileModeEnabled()) {
|
||||||
|
$sql = "SELECT path, file FROM subdef WHERE `name`='thumbnail'";
|
||||||
|
$stmt = $this->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$pathfile = $this->app['phraseanet.thumb-symlinker']->getSymlinkPath(sprintf(
|
||||||
|
'%s/%s',
|
||||||
|
rtrim($row['path'], '/'),
|
||||||
|
$row['file']
|
||||||
|
));
|
||||||
|
$this->app['filesystem']->remove($pathfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach ($this->get_collections() as $collection) {
|
foreach ($this->get_collections() as $collection) {
|
||||||
$collection->unmount_collection($this->app);
|
$collection->unmount_collection($this->app);
|
||||||
}
|
}
|
||||||
@@ -509,6 +524,7 @@ class databox extends base
|
|||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$this->app['phraseanet.appbox']->delete_data_from_cache(appbox::CACHE_LIST_BASES);
|
$this->app['phraseanet.appbox']->delete_data_from_cache(appbox::CACHE_LIST_BASES);
|
||||||
|
$this->app['phraseanet.appbox']->delete_data_from_cache(appbox::CACHE_SBAS_IDS);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -603,7 +619,6 @@ class databox extends base
|
|||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $password
|
* @param string $password
|
||||||
* @param string $dbname
|
* @param string $dbname
|
||||||
* @param registry $registry
|
|
||||||
* @return databox
|
* @return databox
|
||||||
*/
|
*/
|
||||||
public static function mount(Application $app, $host, $port, $user, $password, $dbname)
|
public static function mount(Application $app, $host, $port, $user, $password, $dbname)
|
||||||
|
@@ -133,17 +133,22 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param $subdef_type
|
||||||
|
* @param $subdef_name
|
||||||
*
|
*
|
||||||
* @param type $subdef_type
|
* @return mixed
|
||||||
* @param type $subdef_name
|
* @throws Exception_Databox_SubdefNotFound
|
||||||
* @return databox_subdef
|
|
||||||
*/
|
*/
|
||||||
public function get_subdef($subdef_type, $subdef_name)
|
public function get_subdef($subdef_type, $subdef_name)
|
||||||
{
|
{
|
||||||
if (isset($this->AvSubdefs[$subdef_type]) && isset($this->AvSubdefs[$subdef_type][$subdef_name])) {
|
$type = strtolower($subdef_type);
|
||||||
return $this->AvSubdefs[$subdef_type][$subdef_name];
|
$name = strtolower($subdef_name);
|
||||||
|
|
||||||
|
if (isset($this->AvSubdefs[$type]) && isset($this->AvSubdefs[$type][$name])) {
|
||||||
|
return $this->AvSubdefs[$type][$name];
|
||||||
}
|
}
|
||||||
throw new Exception_Databox_SubdefNotFound(sprintf('Databox subdef name `%s` of type `%s` not found', $subdef_name, $subdef_type));
|
|
||||||
|
throw new Exception_Databox_SubdefNotFound(sprintf('Databox subdef name `%s` of type `%s` not found', $name, $type));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -725,6 +725,10 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
|||||||
$subdef->get_permalink()->delete_data_from_cache();
|
$subdef->get_permalink()->delete_data_from_cache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($name === 'thumbnail' && $app['phraseanet.static-file-factory']->isStaticFileModeEnabled()) {
|
||||||
|
$app['phraseanet.thumb-symlinker']->symlink($subdef->get_pathfile());
|
||||||
|
}
|
||||||
|
|
||||||
unset($media);
|
unset($media);
|
||||||
|
|
||||||
return $subdef;
|
return $subdef;
|
||||||
@@ -741,6 +745,14 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->get_name() === 'thumbnail') {
|
||||||
|
if ($this->app['phraseanet.static-file-factory']->isStaticFileModeEnabled() && null !== $url = $this->app['phraseanet.static-file']->getUrl($this->get_pathfile())) {
|
||||||
|
$this->url = $url;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->app['phraseanet.h264-factory']->isH264Enabled() && in_array($this->mime, ['video/mp4'])) {
|
if ($this->app['phraseanet.h264-factory']->isH264Enabled() && in_array($this->mime, ['video/mp4'])) {
|
||||||
if (null !== $url = $this->app['phraseanet.h264']->getUrl($this->get_pathfile())) {
|
if (null !== $url = $this->app['phraseanet.h264']->getUrl($this->get_pathfile())) {
|
||||||
$this->url = $url;
|
$this->url = $url;
|
||||||
@@ -753,6 +765,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
|||||||
. "/" . $this->record->get_record_id() . "/"
|
. "/" . $this->record->get_record_id() . "/"
|
||||||
. $this->get_name() . "/");
|
. $this->get_name() . "/");
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
use Alchemy\Phrasea\Command\Command;
|
use Alchemy\Phrasea\Command\Command;
|
||||||
use Alchemy\Phrasea\Core\Version;
|
use Alchemy\Phrasea\Core\Version;
|
||||||
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
@@ -104,6 +105,13 @@ class module_console_systemUpgrade extends Command
|
|||||||
$output->writeln("");
|
$output->writeln("");
|
||||||
$output->writeln("");
|
$output->writeln("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null !== $this->getApplication()) {
|
||||||
|
$command = $this->getApplication()->find('crossdomain:generate');
|
||||||
|
$command->run(new ArrayInput(array(
|
||||||
|
'command' => 'crossdomain:generate'
|
||||||
|
)), $output);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$output->write('<info>Canceled</info>', true);
|
$output->write('<info>Canceled</info>', true);
|
||||||
}
|
}
|
||||||
|
65
lib/classes/patch/386alpha3a.php
Normal file
65
lib/classes/patch/386alpha3a.php
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Application;
|
||||||
|
use Symfony\Component\Finder\Finder;
|
||||||
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
|
|
||||||
|
class patch_386alpha3a implements patchInterface
|
||||||
|
{
|
||||||
|
/** @var string */
|
||||||
|
private $release = '3.8.6-alpha.3';
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function get_release()
|
||||||
|
{
|
||||||
|
return $this->release;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function require_all_upgrades()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function apply(base $appbox, Application $app)
|
||||||
|
{
|
||||||
|
$config = $app['phraseanet.configuration']->getConfig();
|
||||||
|
|
||||||
|
$config['static-file'] = array(
|
||||||
|
'enabled' => false,
|
||||||
|
'type' => '',
|
||||||
|
'symlink-directory' => '',
|
||||||
|
);
|
||||||
|
|
||||||
|
$app['phraseanet.configuration']->setConfig($config);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@@ -1120,7 +1120,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
$databox = $this->app['phraseanet.appbox']->get_databox($this->get_sbas_id());
|
$databox = $this->app['phraseanet.appbox']->get_databox($this->get_sbas_id());
|
||||||
$connbas = $databox->get_connection();
|
$connbas = $databox->get_connection();
|
||||||
$sql = 'UPDATE record
|
$sql = 'UPDATE record
|
||||||
SET jeton = ' . (JETON_WRITE_META_DOC | JETON_WRITE_META_SUBDEF) . '
|
SET jeton = jeton | (' . (JETON_WRITE_META_DOC | JETON_WRITE_META_SUBDEF) . ')
|
||||||
WHERE record_id= :record_id';
|
WHERE record_id= :record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute([':record_id' => $this->record_id]);
|
$stmt->execute([':record_id' => $this->record_id]);
|
||||||
@@ -1440,6 +1440,10 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
if (!$subdef->is_physically_present())
|
if (!$subdef->is_physically_present())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if ($subdef->get_name() === 'thumbnail' && $this->app['phraseanet.static-file-factory']->isStaticFileModeEnabled()) {
|
||||||
|
$this->app['filesystem']->remove($this->app['phraseanet.thumb-symlinker']->getSymlinkPath($subdef->get_pathfile()));
|
||||||
|
}
|
||||||
|
|
||||||
$ftodel[] = $subdef->get_pathfile();
|
$ftodel[] = $subdef->get_pathfile();
|
||||||
$watermark = $subdef->get_path() . 'watermark_' . $subdef->get_file();
|
$watermark = $subdef->get_path() . 'watermark_' . $subdef->get_file();
|
||||||
if (file_exists($watermark))
|
if (file_exists($watermark))
|
||||||
|
@@ -349,6 +349,10 @@ class recordutils_image
|
|||||||
$image_out->save($pathOut);
|
$image_out->save($pathOut);
|
||||||
|
|
||||||
if (is_file($pathOut)) {
|
if (is_file($pathOut)) {
|
||||||
|
// copy metadatas to the stamped file if we can
|
||||||
|
if(method_exists($app['exiftool.writer'], "copy")) {
|
||||||
|
$app['exiftool.writer']->copy($subdef->get_pathfile(), $pathOut);
|
||||||
|
}
|
||||||
return $pathOut;
|
return $pathOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -203,6 +203,10 @@ session:
|
|||||||
idle: 0
|
idle: 0
|
||||||
# 1 week
|
# 1 week
|
||||||
lifetime: 604800
|
lifetime: 604800
|
||||||
|
static-file:
|
||||||
|
enabled: false
|
||||||
|
type: nginx
|
||||||
|
symlink-directory: ''
|
||||||
crossdomain:
|
crossdomain:
|
||||||
allow-access-from:
|
allow-access-from:
|
||||||
-
|
-
|
||||||
|
@@ -79,7 +79,14 @@
|
|||||||
{% if app['conf'].get(['registry', 'actions', 'auth-required-for-export']) and app['authentication'].getUser().isGuest() %}
|
{% if app['conf'].get(['registry', 'actions', 'auth-required-for-export']) and app['authentication'].getUser().isGuest() %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
p4.Dialog.get(1).Close();
|
p4.Dialog.get(1).Close();
|
||||||
parent.login({act:"dwnl",lst:"{{ lst }}",SSTTID:"{{ ssttid }}"});
|
var $dialog = p4.Dialog.Create({
|
||||||
|
size : '500x100',
|
||||||
|
closeOnEscape : true,
|
||||||
|
closeButton:false,
|
||||||
|
title : "{{ "Unauthorized action"|trans }}"
|
||||||
|
}, 2);
|
||||||
|
|
||||||
|
$dialog.setContent("{{ "Guest, you must be authenticated to have the right to download."|trans }}");
|
||||||
</script>
|
</script>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if download.get_total_download() <= 0 and download.get_total_order() <= 0 and download.get_total_ftp() <= 0%}
|
{% if download.get_total_download() <= 0 and download.get_total_order() <= 0 and download.get_total_ftp() <= 0%}
|
||||||
|
@@ -338,8 +338,9 @@
|
|||||||
|
|
||||||
<span>{{ 'Trier par' | trans }}</span>
|
<span>{{ 'Trier par' | trans }}</span>
|
||||||
<select name="sort" class="input-small">
|
<select name="sort" class="input-small">
|
||||||
{% for sort, sort_name in app['phraseanet.SE'].getAvailableSort() %}
|
<option value="" {% if app['phraseanet.SE'].getDefaultSort() is empty %}selected="selected default-selection"{% endif %}>{{ "No sort"|trans }}</option>
|
||||||
<option value="{{ sort }}" {% if sort == app['phraseanet.SE'].getDefaultSort() %}selected="selected" class="default-selection"{% endif %}>{{ sort_name }}</option>
|
{% for sort in search_datas['sort'] %}
|
||||||
|
<option value="{{ sort.fieldname }}" {% if sort.fieldname == app['phraseanet.SE'].getDefaultSort() %}selected="selected default-selection"{% endif %}>{{ sort.fieldname }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
<select name="ord" class="input-medium">
|
<select name="ord" class="input-medium">
|
||||||
@@ -412,12 +413,17 @@
|
|||||||
<td colspan="2">{{ 'Rechercher dans un champ date' | trans }}</td>
|
<td colspan="2">{{ 'Rechercher dans un champ date' | trans }}</td>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<select name="date_field" class="input-medium">
|
<select name="date_field" class="input-medium">
|
||||||
{% for field in app['phraseanet.SE'].getAvailableDateFields() %}
|
{% for date in search_datas['dates'] %}
|
||||||
<option onchange="checkFilters(true);"
|
<option onchange="checkFilters(true);"
|
||||||
class="" value="{{ field }}">{{ field }}</option>
|
class="" value="{{ date.fieldname }}">{{ date.fieldname }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<option value="{{ app['phraseanet.SE'].getAvailableDateFields()|join('|') }}" selected="selected">
|
|
||||||
{{ 'rechercher dans tous les champs' | trans }}
|
{% set date_field_names = [] %}
|
||||||
|
{% for field in search_datas['dates'] %}
|
||||||
|
{% set date_field_names = date_field_names|merge([field.fieldname]) %}
|
||||||
|
{% endfor %}
|
||||||
|
<option value="{{ date_field_names|join('|') }}" selected="selected">
|
||||||
|
{% trans 'rechercher dans tous les champs' %}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
{% import 'common/drop_down_options.html.twig' as drop_down %}
|
{% import 'common/drop_down_options.html.twig' as drop_down %}
|
||||||
{% set th_size = app['settings'].getUserSetting(app['authentication'].getUser(), 'images_size')%}
|
{% set th_size = app['settings'].getUserSetting(app['authentication'].getUser(), 'images_size')%}
|
||||||
{% set sbas_id = record.get_sbas_id %}
|
{% set sbas_id = record.get_sbas_id %}
|
||||||
|
{% set lazyload = not app['phraseanet.static-file-factory'].isStaticFileModeEnabled and app['phraseanet.configuration']['lazyload']|default(false) %}
|
||||||
{% if entry_id %}
|
{% if entry_id %}
|
||||||
<div style="width:{{th_size+30}}px;" sbas="{{sbas_id}}"
|
<div style="width:{{th_size+30}}px;" sbas="{{sbas_id}}"
|
||||||
id="{{ prefix|default('IMGT') }}_{{record.get_sbas_id}}_{{record.get_record_id}}"
|
id="{{ prefix|default('IMGT') }}_{{record.get_sbas_id}}_{{record.get_record_id}}"
|
||||||
@@ -59,9 +60,9 @@
|
|||||||
{% if rollover_gif %}
|
{% if rollover_gif %}
|
||||||
{% set extraclass = 'rollover-gif-out' %}
|
{% set extraclass = 'rollover-gif-out' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{thumbnail.format(record.get_thumbnail(), th_size, th_size, extraclass, true, true)}}
|
{{thumbnail.format(record.get_thumbnail(), th_size, th_size, extraclass, true, lazyload)}}
|
||||||
{% if rollover_gif %}
|
{% if rollover_gif %}
|
||||||
{{thumbnail.format(rollover_gif, th_size, th_size, 'rollover-gif-hover', true, true)}}
|
{{thumbnail.format(rollover_gif, th_size, th_size, 'rollover-gif-hover', true, lazyload)}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -5,58 +5,56 @@
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
$('button').button();
|
$('button').button();
|
||||||
|
|
||||||
$('.databox_create').bind('change', function () {
|
$('.databox_create').bind('change', function () {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var $current = $this.closest('.steps');
|
var $current = $this.closest('.steps');
|
||||||
$('.databox_creation_input', $current).attr('disabled', $this.attr('checked'));
|
$('.databox_creation_input', $current).attr('disabled', $this.attr('checked'));
|
||||||
$('.db_tester', $current).attr('disabled', $this.attr('checked')).toggleClass("ui-state-disabled", $this.attr('checked'));
|
$('.db_tester', $current).attr('disabled', $this.attr('checked')).toggleClass("ui-state-disabled", $this.attr('checked'));
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.ab_opt_toggler').bind('click', function () {
|
$('.ab_opt_toggler').bind('click', function () {
|
||||||
$('.optional_ab_datas').fadeToggle();
|
$('.optional_ab_data').fadeToggle();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('button.ab_tester').bind('click', function () {
|
$('button.ab_tester').bind('click', function () {
|
||||||
if(window.console)
|
|
||||||
console.log('application box connection test');
|
|
||||||
test_connection_appbox();
|
test_connection_appbox();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('button.db_tester').bind('click', function () {
|
$('button.db_tester').bind('click', function () {
|
||||||
if(window.console)
|
|
||||||
console.log('data box connection test');
|
|
||||||
test_connection_databox();
|
test_connection_databox();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
var language = {
|
var language = {
|
||||||
ajaxError : "{{ 'Erreur lors du contact avec le serveur WEB' | trans }}",
|
ajaxError : "{% trans 'Erreur lors du contact avec le serveur WEB' %}",
|
||||||
ajaxTimeout : "{{ 'Delai depasse lors du contact avec le serveur WEB' | trans }}",
|
ajaxTimeout : "{% trans 'Delai depasse lors du contact avec le serveur WEB' %}",
|
||||||
requiredField : "{{ 'Required' | trans }}",
|
requiredField : "{% trans 'Required' %}",
|
||||||
validateEmail : "{{ 'forms::merci d\'entrer une adresse e-mail valide' | trans }}",
|
validateEmail : "{% trans 'forms::merci d\'entrer une adresse e-mail valide' %}",
|
||||||
validatePassword : "{{ 'forms::ce champ est requis' | trans }}",
|
validatePassword : "{% trans 'forms::ce champ est requis' %}",
|
||||||
validatePasswordConfirm : "{{ 'forms::ce champ est requis' | trans }}",
|
validatePasswordConfirm : "{% trans 'forms::ce champ est requis' %}",
|
||||||
validatePasswordEqual : "{{ 'forms::les mots de passe ne correspondent pas' | trans }}",
|
validatePasswordEqual : "{% trans 'forms::les mots de passe ne correspondent pas' %}",
|
||||||
wrongCredentials : "{{ 'Vous devez specifier une adresse email et un mot de passe valides' | trans }}",
|
wrongCredentials : "{% trans 'Vous devez specifier une adresse email et un mot de passe valides' %}",
|
||||||
wrongDatabasename : "{{ 'Le nom de base de donnee est incorrect' | trans }}",
|
wrongDatabasename : "{% trans 'Le nom de base de donnee est incorrect' %}",
|
||||||
someErrors : "{{ 'Il y a des erreurs, merci de les corriger avant de continuer' | trans }}"
|
someErrors : "{% trans 'Il y a des erreurs, merci de les corriger avant de continuer' %}"
|
||||||
}
|
}
|
||||||
|
|
||||||
$.validator.passwordRating.messages = {
|
$.validator.passwordRating.messages = {
|
||||||
"similar-to-username": "{{ 'forms::le mot de passe est trop similaire a l\'identifiant' | trans }}",
|
"similar-to-username": "{% trans 'forms::le mot de passe est trop similaire a l\'identifiant' %}",
|
||||||
"too-short": "{{ 'forms::la valeur donnee est trop courte' | trans }}",
|
"too-short": "{% trans 'forms::la valeur donnee est trop courte' %}",
|
||||||
"very-weak": "{{ 'forms::le mot de passe est trop simple' | trans }}",
|
"very-weak": "{% trans 'forms::le mot de passe est trop simple' %}",
|
||||||
"weak": "{{ 'forms::le mot de passe est trop simple' | trans }}",
|
"weak": "{% trans 'forms::le mot de passe est trop simple' %}",
|
||||||
"good": "{{ 'forms::le mot de passe est bon' | trans }}",
|
"good": "{% trans 'forms::le mot de passe est bon' %}",
|
||||||
"strong": "{{ 'forms::le mot de passe est tres bon' | trans }}"
|
"strong": "{% trans 'forms::le mot de passe est tres bon' %}"
|
||||||
};
|
};
|
||||||
|
|
||||||
$("#create_admin").validate({
|
$("#create_admin").validate({
|
||||||
rules: {
|
rules: {
|
||||||
email: {email: true},
|
email: {email: true},
|
||||||
|
|
||||||
password: {password: "#create_admin input[name=email]"},
|
password: {password: "#create_admin input[name=email]"},
|
||||||
password_confirm: {equalTo: "#create_admin input[name=password]"},
|
password_confirm: {equalTo: "#create_admin input[name=password]"},
|
||||||
hostname: {required: true},
|
hostname: {required: true},
|
||||||
@@ -83,8 +81,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$("#create_admin").valid();
|
|
||||||
|
|
||||||
|
$("#create_admin").valid();
|
||||||
$('.path_to_test').path_file_test({'url': '/setup/test/path/'});
|
$('.path_to_test').path_file_test({'url': '/setup/test/path/'});
|
||||||
$('.url_to_test').url_test({'url': '/setup/test/url/'});
|
$('.url_to_test').url_test({'url': '/setup/test/url/'});
|
||||||
|
|
||||||
@@ -93,23 +91,18 @@
|
|||||||
var $current = $(this).closest('.steps');
|
var $current = $(this).closest('.steps');
|
||||||
if($('input.field_error, input.error', $current).length > 0)
|
if($('input.field_error, input.error', $current).length > 0)
|
||||||
{
|
{
|
||||||
alert('{{ "Veuillez corriger les erreurs avant de poursuivre" | trans }}');
|
alert('{% trans "Veuillez corriger les erreurs avant de poursuivre" %}');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$(this).hasClass('install'))
|
if (!$(this).hasClass('install')) {
|
||||||
{
|
|
||||||
var callback = function () {
|
var callback = function () {
|
||||||
$current.hide();
|
$current.hide();
|
||||||
$current.next().show();
|
$current.next().show();
|
||||||
};
|
};
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
var callback = function () {
|
var callback = function () {
|
||||||
if(window.console)
|
|
||||||
console.log('Processing install....');
|
|
||||||
$(this).attr('disabled', 'disabled');
|
$(this).attr('disabled', 'disabled');
|
||||||
var dialog = $('#install_wait');
|
var dialog = $('#install_wait');
|
||||||
dialog.dialog({
|
dialog.dialog({
|
||||||
@@ -123,15 +116,11 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if($current.hasClass('appbox_settings'))
|
if ($current.hasClass('appbox_settings')) {
|
||||||
{
|
|
||||||
test_connection_appbox(callback);
|
test_connection_appbox(callback);
|
||||||
}
|
} else if ($current.hasClass('databox_settings') && $('.databox_create', $current).is(':not(:checked)')) {
|
||||||
else if($current.hasClass('databox_settings') && $('.databox_create', $current).is(':not(:checked)'))
|
|
||||||
{
|
|
||||||
test_connection_databox(callback);
|
test_connection_databox(callback);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,83 +134,73 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function test_connection_appbox(callback) {
|
||||||
function test_connection_appbox(callback)
|
|
||||||
{
|
|
||||||
var scope = $('.appbox_settings');
|
var scope = $('.appbox_settings');
|
||||||
var hostname_input = $('input[name="hostname"]:visible', scope);
|
var hostname_input = $('input[name="hostname"]:visible', scope);
|
||||||
var port_input = $('input[name="port"]:visible', scope);
|
var port_input = $('input[name="port"]:visible', scope);
|
||||||
var user_input = $('input[name="user"]', scope);
|
var user_input = $('input[name="user"]', scope);
|
||||||
var password_input = $('input[name="password"]', scope);
|
var password_input = $('input[name="db_password"]', scope);
|
||||||
var dbname_input = $('input[name="ab_name"]', scope);
|
var db_name_input = $('input[name="ab_name"]', scope);
|
||||||
|
|
||||||
var user = user_input.val();
|
var user = user_input.val();
|
||||||
var password = password_input.val();
|
var password = password_input.val();
|
||||||
var dbname = dbname_input.val();
|
var db_name = db_name_input.val();
|
||||||
|
|
||||||
var datas = {
|
var data = {
|
||||||
user: user,
|
user: user,
|
||||||
password: password,
|
password: password,
|
||||||
dbname:dbname
|
db_name: db_name
|
||||||
};
|
};
|
||||||
|
|
||||||
if(hostname_input.length > 0)
|
if (hostname_input.length > 0) {
|
||||||
{
|
data.hostname = hostname_input.val();
|
||||||
datas.hostname = hostname_input.val();
|
|
||||||
}
|
}
|
||||||
if(port_input.length > 0)
|
if (port_input.length > 0) {
|
||||||
{
|
data.port = port_input.val();
|
||||||
datas.port = port_input.val();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var el_loader = $('.tester_loader', scope);
|
var el_loader = $('.tester_loader', scope);
|
||||||
var el_status = $('.tester_status', scope);
|
var el_status = $('.tester_status', scope);
|
||||||
var el_message = $('.tester_message', scope);
|
var el_message = $('.tester_message', scope);
|
||||||
|
|
||||||
test_connection(el_loader, el_status, el_message, datas, callback);
|
test_connection(el_loader, el_status, el_message, data, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_connection_databox(callback) {
|
||||||
function test_connection_databox(callback)
|
|
||||||
{
|
|
||||||
var appbox_scope = $('.appbox_settings');
|
var appbox_scope = $('.appbox_settings');
|
||||||
var databox_scope = $('.databox_settings');
|
var databox_scope = $('.databox_settings');
|
||||||
|
|
||||||
var hostname_input = $('input[name="hostname"]', appbox_scope);
|
var hostname_input = $('input[name="hostname"]', appbox_scope);
|
||||||
var port_input = $('input[name="port"]', appbox_scope);
|
var port_input = $('input[name="port"]', appbox_scope);
|
||||||
var user_input = $('input[name="user"]', appbox_scope);
|
var user_input = $('input[name="user"]', appbox_scope);
|
||||||
var password_input = $('input[name="password"]', appbox_scope);
|
var password_input = $('input[name="db_password"]', appbox_scope);
|
||||||
|
|
||||||
var dbname_input = $('input[name="db_name"]', databox_scope);
|
var db_name_input = $('input[name="db_name"]', databox_scope);
|
||||||
|
|
||||||
var user = user_input.val();
|
var user = user_input.val();
|
||||||
var password = password_input.val();
|
var password = password_input.val();
|
||||||
var dbname = dbname_input.val();
|
var db_name = db_name_input.val();
|
||||||
|
|
||||||
var datas = {
|
var data = {
|
||||||
user: user,
|
user: user,
|
||||||
password: password,
|
password: password,
|
||||||
dbname:dbname
|
db_name: db_name
|
||||||
};
|
};
|
||||||
|
|
||||||
if(hostname_input.length > 0)
|
if (hostname_input.length > 0) {
|
||||||
{
|
data.hostname = hostname_input.val();
|
||||||
datas.hostname = hostname_input.val();
|
|
||||||
}
|
}
|
||||||
if(port_input.length > 0)
|
if (port_input.length > 0) {
|
||||||
{
|
data.port = port_input.val();
|
||||||
datas.port = port_input.val();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var el_loader = $('.tester_loader', databox_scope);
|
var el_loader = $('.tester_loader', databox_scope);
|
||||||
var el_status = $('.tester_status', databox_scope);
|
var el_status = $('.tester_status', databox_scope);
|
||||||
var el_message = $('.tester_message', databox_scope);
|
var el_message = $('.tester_message', databox_scope);
|
||||||
test_connection(el_loader, el_status, el_message, datas, callback);
|
test_connection(el_loader, el_status, el_message, data, callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_connection(el_loader, el_status, el_message, datas, callback)
|
function test_connection(el_loader, el_status, el_message, data, callback) {
|
||||||
{
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: '/setup/connection_test/mysql/',
|
url: '/setup/connection_test/mysql/',
|
||||||
@@ -280,14 +259,11 @@
|
|||||||
<form id="create_admin" method="post" action="{{ path('install_do_install') }}">
|
<form id="create_admin" method="post" action="{{ path('install_do_install') }}">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="steps">
|
<div class="steps">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="PNB10 wrapper_left">
|
<div class="PNB10 wrapper_left">
|
||||||
<div class="PNB10 section_title">
|
<div class="PNB10 section_title">
|
||||||
<h2>
|
<h2></h2>
|
||||||
|
|
||||||
</h2>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="PNB10" style="top:50px;overflow-x:hidden;">
|
<div class="PNB10" style="top:50px;overflow-x:hidden;">
|
||||||
<table class="main_content_wrapper">
|
<table class="main_content_wrapper">
|
||||||
@@ -298,21 +274,37 @@
|
|||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
{% if error is not none %}
|
{% if error is not none %}
|
||||||
|
|
||||||
<p class='error'>
|
<p class='error'>
|
||||||
{{ error }}
|
{{ error }}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% trans %}Bonjour, vous etes sur le point d'installer Phraseanet.{% endtrans %}
|
{% trans %}
|
||||||
|
Bonjour, vous etes sur le point d'installer Phraseanet.
|
||||||
|
{% endtrans %}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{% trans %}Consultez en ligne les pré-requis et la configuration du serveur web{% endtrans %}
|
{% trans %}
|
||||||
|
Consultez en ligne les pré-requis et la
|
||||||
|
configuration du serveur web
|
||||||
|
{% endtrans %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% trans %}Vous aurez besoin de spécifier un serveur MySQL, des repertoires de stockage pour vos documents, et de configurer votre serveur web pour qu'il publie certains de ces dossiers de stockage.{% endtrans %}
|
{% trans %}
|
||||||
|
Vous aurez besoin de spécifier un serveur MySQL, des
|
||||||
|
repertoires de stockage pour vos documents, et de
|
||||||
|
configurer votre serveur web pour qu'il publie
|
||||||
|
certains de ces dossiers de stockage.
|
||||||
|
{% endtrans %}
|
||||||
</p>
|
</p>
|
||||||
{% if warnings|length > 0 %}
|
{% if warnings|length > 0 %}
|
||||||
<p>
|
<p>
|
||||||
{% trans %}Avant de continuer, prenez connaissance des points ci-dessous. Vous pouvez continuer sans corriger ces problèmes.{% endtrans %}
|
{% trans %}
|
||||||
|
Avant de continuer, prenez connaissance des
|
||||||
|
points ci-dessous. Vous pouvez continuer sans
|
||||||
|
corriger ces problèmes.
|
||||||
|
{% endtrans %}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
@@ -327,7 +319,7 @@
|
|||||||
{% if warnings is not empty %}
|
{% if warnings is not empty %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ path('install_root') }}">{{ 'Review system configuration' | trans }}</a>
|
<a href="{{ path('install_root') }}">{% trans 'Review system configuration' %}</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -343,8 +335,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
<a href="https://docs.phraseanet.com/3.8/Admin/" target="_blank">
|
<a href="https://docs.phraseanet.com/3.8/Admin/"
|
||||||
{{ 'Prerequisite and Configuration' | trans }}
|
target="_blank">
|
||||||
|
{% trans 'Prerequisite and Configuration' %}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
@@ -359,7 +352,7 @@
|
|||||||
<td>
|
<td>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align:right;">
|
<td style="text-align:right;">
|
||||||
<button class="next">{{ 'boutton::suivant' | trans }}</button>
|
<button class="next">{% trans 'boutton::suivant' %}</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -372,7 +365,7 @@
|
|||||||
<div class="PNB10 wrapper_left">
|
<div class="PNB10 wrapper_left">
|
||||||
<div class="PNB10 section_title">
|
<div class="PNB10 section_title">
|
||||||
<h2>
|
<h2>
|
||||||
1/5 {{ 'Executables externes' | trans }}
|
1/5 {% trans 'Executables externes' %}
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="PNB10" style="top:50px;overflow-x:hidden;">
|
<div class="PNB10" style="top:50px;overflow-x:hidden;">
|
||||||
@@ -387,7 +380,11 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><label>{{ binary['name'] }}</label></td>
|
<td><label>{{ binary['name'] }}</label></td>
|
||||||
<td><input autocomplete="off" name="binary_{{key}}" class="path_to_test test_executable {% if required == "1" %}required{% endif %}" type="text" value="{{ binary['binary'] }}" /> {% if required == "1" %}{{ 'Required field' | trans }}{% endif %}</td>
|
<td><input autocomplete="off" name="binary_{{ key }}"
|
||||||
|
class="path_to_test test_executable {% if required == "1" %}required{% endif %}"
|
||||||
|
type="text"
|
||||||
|
value="{{ binary['binary'] }}"/> {% if required == "1" %}{% trans 'Required field' %}{% endif %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
@@ -402,13 +399,15 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
{{ 'Phraseanet may require many binaries.' | trans }}
|
{% trans 'Phraseanet may require many binaries.' %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{{ 'Some of them are required, like the indexer, Exiftool or ImageMagick components, some others are optionnal, like FFmpeg which is used to preview video files.' | trans }}
|
{% trans 'Some of them are required, like the indexer, Exiftool or ImageMagick components, some others are optionnal, like FFmpeg which is used to preview video files.' %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{{ 'Don\'t worry, You can modify your configuration later' | trans }}
|
{% trans 'Don\'t worry, You can modify your configuration later' %}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -420,10 +419,10 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<button class="previous">{{ 'boutton::precedent' | trans }}</button>
|
<button class="previous">{% trans 'boutton::precedent' %}</button>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align:right;">
|
<td style="text-align:right;">
|
||||||
<button class="next">{{ 'boutton::suivant' | trans }}</button>
|
<button class="next">{% trans 'boutton::suivant' %}</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -431,14 +430,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="steps">
|
<div class="steps">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="PNB10 wrapper_left">
|
<div class="PNB10 wrapper_left">
|
||||||
<div class="PNB10 section_title">
|
<div class="PNB10 section_title">
|
||||||
<h2>2/5
|
<h2>2/5
|
||||||
{{ 'Creation de votre compte' | trans }}
|
{% trans 'Creation de votre compte' %}
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="PNB10" style="top:50px;overflow-x:hidden;">
|
<div class="PNB10" style="top:50px;overflow-x:hidden;">
|
||||||
@@ -447,12 +444,16 @@
|
|||||||
<td>
|
<td>
|
||||||
<table class="main_content_table">
|
<table class="main_content_table">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:200px;"><label>{{ 'Votre adresse email' | trans }}</label></td>
|
<td style="width:200px;">
|
||||||
<td><input class="error" type="text" name="email" value="" /></td>
|
<label>{% trans 'Votre adresse email' %}</label></td>
|
||||||
|
<td><input class="error" type="text" name="email" value=""/>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:200px;"><label>{{ 'Votre mot de passe' | trans }}</label></td>
|
<td style="width:200px;">
|
||||||
<td><input autocomplete="off" type="password" name="password" value="" /></td>
|
<label>{% trans 'Votre mot de passe' %}</label></td>
|
||||||
|
<td><input autocomplete="off" type="password"
|
||||||
|
name="password" value=""/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@@ -467,20 +468,24 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:200px;"><label>{{ 'Confirmation de votre mot de passe' | trans }}</label></td>
|
<td style="width:200px;">
|
||||||
<td><input autocomplete="off" type="password" name="password_confirm" value="" /></td>
|
<label>{% trans 'Confirmation de votre mot de passe' %}</label>
|
||||||
|
</td>
|
||||||
|
<td><input autocomplete="off" type="password"
|
||||||
|
name="password_confirm" value=""/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div style="border:1px solid #404040;padding:0 10px;margin:20px 0">
|
<div style="border:1px solid #404040;padding:0 10px;margin:20px 0">
|
||||||
<h3>{{ 'admin::compte-utilisateur A propos de la securite des mots de passe :' | trans }}</h3>
|
<h3>{% trans 'admin::compte-utilisateur A propos de la securite des mots de passe :' %}</h3>
|
||||||
<p>{{ 'admin::compte-utilisateur Les mots de passe doivent etre clairement distincts du login et contenir au moins deux types parmis les caracteres suivants :' | trans }}</p>
|
|
||||||
|
<p>{% trans 'admin::compte-utilisateur Les mots de passe doivent etre clairement distincts du login et contenir au moins deux types parmis les caracteres suivants :' %}</p>
|
||||||
<dl style="border:none;float:none;">
|
<dl style="border:none;float:none;">
|
||||||
<dt>{{ 'admin::compte-utilisateur::securite caracteres speciaux' | trans }}</dt>
|
<dt>{% trans 'admin::compte-utilisateur::securite caracteres speciaux' %}</dt>
|
||||||
<dt>{{ 'admin::compte-utilisateur::securite caracteres majuscules' | trans }}</dt>
|
<dt>{% trans 'admin::compte-utilisateur::securite caracteres majuscules' %}</dt>
|
||||||
<dt>{{ 'admin::compte-utilisateur::securite caracteres minuscules' | trans }}</dt>
|
<dt>{% trans 'admin::compte-utilisateur::securite caracteres minuscules' %}</dt>
|
||||||
<dt>{{ 'admin::compte-utilisateur::securite caracteres numeriques' | trans }}</dt>
|
<dt>{% trans 'admin::compte-utilisateur::securite caracteres numeriques' %}</dt>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -497,8 +502,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
{{ 'Your email will be used to log in the application.' | trans }} <br/><br/>
|
{% trans 'Your email will be used to log in the application.' %}
|
||||||
{{ 'Please be sure it is still valid and you can access it' | trans }}
|
<br/><br/>
|
||||||
|
{% trans 'Please be sure it is still valid and you can access it' %}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -510,10 +516,10 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<button class="previous">{{ 'boutton::precedent' | trans }}</button>
|
<button class="previous">{% trans 'boutton::precedent' %}</button>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align:right;">
|
<td style="text-align:right;">
|
||||||
<button class="next">{{ 'boutton::suivant' | trans }}</button>
|
<button class="next">{% trans 'boutton::suivant' %}</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -521,20 +527,15 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="steps appbox_settings">
|
<div class="steps appbox_settings">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="PNB10 wrapper_left">
|
<div class="PNB10 wrapper_left">
|
||||||
<div class="PNB10 section_title">
|
<div class="PNB10 section_title">
|
||||||
<h2>
|
<h2>
|
||||||
3/5
|
3/5
|
||||||
{% trans %}setup::Configuration de la base de compte ApplicationBox{% endtrans %}
|
{% trans %}
|
||||||
|
setup::Configuration de la base de compte ApplicationBox
|
||||||
|
{% endtrans %}
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="PNB10" style="top:50px;overflow-x:hidden;">
|
<div class="PNB10" style="top:50px;overflow-x:hidden;">
|
||||||
@@ -544,34 +545,45 @@
|
|||||||
<table class="main_content_table">
|
<table class="main_content_table">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<h3>{{ 'MySQL database connection parameters' | trans }}</h3>
|
<h3>{% trans 'MySQL database connection parameters' %}</h3>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="optional_ab_datas">
|
<tr class="optional_ab_data">
|
||||||
<td style="width:200px;"><label>{{ 'phraseanet:: adresse' | trans }}</label></td>
|
<td style="width:200px;">
|
||||||
<td><input autocomplete="off" type="text" name="hostname" value="localhost" /></td>
|
<label>{% trans 'phraseanet:: adresse' %}</label></td>
|
||||||
|
<td><input autocomplete="off" type="text" name="hostname"
|
||||||
|
value="localhost"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:200px;"><label>{{ 'Database user' | trans }}</label></td>
|
<td style="width:200px;">
|
||||||
|
<label>{% trans 'Database user' %}</label></td>
|
||||||
<td><input type="text" name="user" value=""/></td>
|
<td><input type="text" name="user" value=""/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:200px;"><label>{{ 'admin::compte-utilisateur mot de passe' | trans }}</label></td>
|
<td style="width:200px;">
|
||||||
<td><input type="password" name="password" value="" autocomplete="off" /></td>
|
<label>{% trans 'admin::compte-utilisateur mot de passe' %}</label>
|
||||||
|
</td>
|
||||||
|
<td><input type="password" name="db_password" value=""
|
||||||
|
autocomplete="off"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="optional_ab_datas">
|
<tr class="optional_ab_data">
|
||||||
<td style="width:200px;"><label>{{ 'phraseanet:: port' | trans }}</label></td>
|
<td style="width:200px;">
|
||||||
<td><input autocomplete="off" type="text" name="port" value="3306" /></td>
|
<label>{% trans 'phraseanet:: port' %}</label></td>
|
||||||
|
<td><input autocomplete="off" type="text" name="port"
|
||||||
|
value="3306"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:200px;"><label>{{ 'Database' | trans }}</label></td>
|
<td style="width:200px;">
|
||||||
|
<label>{% trans 'Database' %}</label></td>
|
||||||
<td><input type="text" name="ab_name" value=""/></td>
|
<td><input type="text" name="ab_name" value=""/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="height:40px;">
|
<tr style="height:40px;">
|
||||||
<td style="text-align:center;">
|
<td style="text-align:center;">
|
||||||
<button class="ab_tester error">{{ 'boutton::tester' | trans }}</button>
|
<button class="ab_tester error">{% trans 'boutton::tester' %}</button>
|
||||||
<img class="tester_loader" style="visibility:hidden;" src="/skins/icons/loader-black.gif"/>
|
<img class="tester_loader" style="visibility:hidden;"
|
||||||
<img class="tester_status" style="display:none;" src="/skins/icons/delete.png"/>
|
src="/skins/icons/loader-black.gif"/>
|
||||||
|
<img class="tester_status" style="display:none;"
|
||||||
|
src="/skins/icons/delete.png"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="tester_message"> </span>
|
<span class="tester_message"> </span>
|
||||||
@@ -582,7 +594,11 @@
|
|||||||
<p style="margin:10px 0;">
|
<p style="margin:10px 0;">
|
||||||
{% set debut_lien = '<a href="#" class="ab_opt_toggler">' %}
|
{% set debut_lien = '<a href="#" class="ab_opt_toggler">' %}
|
||||||
{% set fin_lien = '</a>' %}
|
{% set fin_lien = '</a>' %}
|
||||||
{% trans with {'%debut_lien%' : debut_lien, '%fin_lien%' : fin_lien} %}Si vous aviez besoin de plus de parametres, %debut_lien%Afficher d'avantage d'options%fin_lien%{% endtrans %}
|
{% trans %}
|
||||||
|
Si vous aviez besoin de plus de
|
||||||
|
parametres, {{ debut_lien }}Afficher d'avantage
|
||||||
|
d'options{{ fin_lien }}
|
||||||
|
{% endtrans %}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -598,19 +614,25 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
{{ 'ApplicationBox is a Mysql database.' | trans }}
|
{% trans 'ApplicationBox is a Mysql database.' %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{{ 'It stores users datas, rights, and references to DataBoxes where records are stored.' | trans }}
|
{% trans 'It stores users data, rights, and references to DataBoxes where records are stored.' %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% set link_start = '<a href="https://mariadb.org/" target="_blank">' %}
|
{% set link_start = '<a href="https://mariadb.org/" target="_blank">' %}
|
||||||
{% set link_end = '</a>' %}
|
{% set link_end = '</a>' %}
|
||||||
{% trans with {'%link_start%' : link_start, '%link_end%' : link_end} %}Phraseanet strongly recommends the use of %link_start%MariaDB%link_end% as a replacement for MySQL.{% endtrans %}
|
{% trans %}
|
||||||
|
Phraseanet strongly recommends the use of {{ link_start }}
|
||||||
|
MariaDB{{ link_end }} as a replacement for MySQL.
|
||||||
|
{% endtrans %}
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<a href="https://mariadb.org/" target="_blank">
|
<a href="https://mariadb.org/" target="_blank">
|
||||||
<img src="/skins/icons/Mariadb-big.png" style="width:100%;" />
|
<img src="/skins/icons/Mariadb-big.png"
|
||||||
|
style="width:100%;"/>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
@@ -623,10 +645,10 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<button class="previous">{{ 'boutton::precedent' | trans }}</button>
|
<button class="previous">{% trans 'boutton::precedent' %}</button>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align:right;">
|
<td style="text-align:right;">
|
||||||
<button class="next">{{ 'boutton::suivant' | trans }}</button>
|
<button class="next">{% trans 'boutton::suivant' %}</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -634,14 +656,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="steps">
|
<div class="steps">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="PNB10 wrapper_left">
|
<div class="PNB10 wrapper_left">
|
||||||
<div class="PNB10 section_title">
|
<div class="PNB10 section_title">
|
||||||
<h2>4/5
|
<h2>4/5
|
||||||
{{ 'setup::Configuration des repertoires de stockage' | trans }}
|
{% trans 'setup::Configuration des repertoires de stockage' %}
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="PNB10" style="top:50px;overflow-x:hidden;">
|
<div class="PNB10" style="top:50px;overflow-x:hidden;">
|
||||||
@@ -650,8 +670,11 @@
|
|||||||
<td>
|
<td>
|
||||||
<table class="main_content_table">
|
<table class="main_content_table">
|
||||||
<tr>
|
<tr>
|
||||||
<td><label>{{ 'Repertoire de stockage des fichiers' | trans }}</label></td>
|
<td>
|
||||||
<td><input class="path_to_test test_writeable required" type="text" name="datapath_noweb" value="{{ rootpath ~ "/datas" }}" /></td>
|
<label>{% trans 'Repertoire de stockage des fichiers' %}</label>
|
||||||
|
</td>
|
||||||
|
<td><input class="path_to_test test_writeable required"
|
||||||
|
type="text" name="datapath_noweb" value=""/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
@@ -665,13 +688,15 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
{{ 'Your medias and their subdefinitions (previews, thumbnails..) will be stored in these directories.' | trans }}
|
{% trans 'Your medias and their subdefinitions (previews, thumbnails..) will be stored in these directories.' %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{{ 'Thumbnails directory is mounted to be accessible via HTTP, while other files are not.' | trans }}
|
{% trans 'Thumbnails directory is mounted to be accessible via HTTP, while other files are not.' %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{{ 'If you plan to store large files, be sure it will fit in these directories.' | trans }}
|
{% trans 'If you plan to store large files, be sure it will fit in these directories.' %}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -683,10 +708,10 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<button class="previous">{{ 'boutton::precedent' | trans }}</button>
|
<button class="previous">{% trans 'boutton::precedent' %}</button>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align:right;">
|
<td style="text-align:right;">
|
||||||
<button class="next">{{ 'boutton::suivant' | trans }}</button>
|
<button class="next">{% trans 'boutton::suivant' %}</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -694,13 +719,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="steps databox_settings">
|
<div class="steps databox_settings">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="PNB10 wrapper_left">
|
<div class="PNB10 wrapper_left">
|
||||||
<div class="PNB10 section_title">
|
<div class="PNB10 section_title">
|
||||||
<h2>5/5
|
<h2>5/5
|
||||||
{% trans %}setup::Configuration de la base de stockage DataBox{% endtrans %}
|
{% trans %}
|
||||||
|
setup::Configuration de la base de stockage DataBox
|
||||||
|
{% endtrans %}
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="PNB10" style="top:50px;overflow-x:hidden;">
|
<div class="PNB10" style="top:50px;overflow-x:hidden;">
|
||||||
@@ -709,32 +735,41 @@
|
|||||||
<td>
|
<td>
|
||||||
<table class="main_content_table">
|
<table class="main_content_table">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><h3>{{ 'MySQL database connection parameters' | trans }}</h3></td>
|
<td colspan="2">
|
||||||
|
<h3>{% trans 'MySQL database connection parameters' %}</h3>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:200px;"><label>{{ 'Ne pas creer de DataBox maintenant' | trans }}</label></td>
|
<td style="width:200px;">
|
||||||
|
<label>{% trans 'Ne pas creer de DataBox maintenant' %}</label>
|
||||||
|
</td>
|
||||||
<td><input type="checkbox" class="databox_create"/></td>
|
<td><input type="checkbox" class="databox_create"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:200px;"><label>{{ 'Database' | trans }}</label></td>
|
<td style="width:200px;">
|
||||||
<td><input class="databox_creation_input" type="text" name="db_name" value="" /></td>
|
<label>{% trans 'Database' %}</label></td>
|
||||||
|
<td><input class="databox_creation_input" type="text"
|
||||||
|
name="db_name" value=""/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="height:40px;">
|
<tr style="height:40px;">
|
||||||
<td style="text-align:center;">
|
<td style="text-align:center;">
|
||||||
<button class="db_tester error">{{ 'boutton::tester' | trans }}</button>
|
<button class="db_tester error">{% trans 'boutton::tester' %}</button>
|
||||||
<img class="tester_loader" style="visibility:hidden;" src="/skins/icons/loader-black.gif"/>
|
<img class="tester_loader" style="visibility:hidden;"
|
||||||
<img class="tester_status" style="display:none;" src="/skins/icons/delete.png"/>
|
src="/skins/icons/loader-black.gif"/>
|
||||||
|
<img class="tester_status" style="display:none;"
|
||||||
|
src="/skins/icons/delete.png"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="tester_message"> </span>
|
<span class="tester_message"> </span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><label>{{ 'Modele de donnees' | trans }}</label></td>
|
<td><label>{% trans 'Modele de donnees' %}</label></td>
|
||||||
<td>
|
<td>
|
||||||
<select name="db_template" class="databox_creation_input">
|
<select name="db_template"
|
||||||
|
class="databox_creation_input">
|
||||||
{% for template in available_templates %}
|
{% for template in available_templates %}
|
||||||
<option value="{{ template }}">{{ template }}</option>
|
<option value="{{ template }}">{{ template }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -746,29 +781,40 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<h3>
|
<h3>
|
||||||
{% trans %}Creation des taches{% endtrans %}
|
{% trans %}
|
||||||
|
Creation des taches
|
||||||
|
{% endtrans %}
|
||||||
</h3>
|
</h3>
|
||||||
{{ 'Phraseanet embarque un moteur de taches pour la lecture / ecriture des metadonnes, et autre operations' | trans }}
|
{% trans 'Phraseanet embarque un moteur de taches pour la lecture / ecriture des metadonnes, et autre operations' %}
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:100px;text-align:right;">
|
<td style="width:100px;text-align:right;">
|
||||||
<input type="checkbox" name="create_task[]" value="writemeta" checked />
|
<input type="checkbox" name="create_task[]"
|
||||||
|
value="writemeta" checked/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<label>{% trans 'Creer la tache d\'ecriture des metadonnees' %}</label>
|
||||||
</td>
|
</td>
|
||||||
<td><label>{{ 'Creer la tache d\'ecriture des metadonnees' | trans }}</label></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:100px;text-align:right;">
|
<td style="width:100px;text-align:right;">
|
||||||
<input type="checkbox" name="create_task[]" value="subdef" checked />
|
<input type="checkbox" name="create_task[]"
|
||||||
|
value="subdef" checked/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<label>{% trans 'Creer la tache de creation des sous-definitions' %}</label>
|
||||||
</td>
|
</td>
|
||||||
<td><label>{{ 'Creer la tache de creation des sous-definitions' | trans }}</label></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:100px;text-align:right;">
|
<td style="width:100px;text-align:right;">
|
||||||
<input type="checkbox" name="create_task[]" value="cindexer" checked />
|
<input type="checkbox" name="create_task[]"
|
||||||
|
value="cindexer" checked/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<label>{% trans 'Creer la tache d\'indexation' %}</label>
|
||||||
</td>
|
</td>
|
||||||
<td><label>{{ 'Creer la tache d\'indexation' | trans }}</label></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
@@ -782,8 +828,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
{{ 'Phraseanet DataBoxes are MySQL databases, queryable by Phraseanet ApplicationBox.' | trans }}<br/><br/>
|
{% trans 'Phraseanet DataBoxes are MySQL databases, queryable by Phraseanet ApplicationBox.' %}
|
||||||
{{ 'Databoxes store records, metadatas and their classifications' | trans }}
|
<br/><br/>
|
||||||
|
{% trans 'Databoxes store records, metadatas and their classifications' %}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -795,20 +842,23 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<button class="previous">{{ 'boutton::precedent' | trans }}</button>
|
<button class="previous">{% trans 'boutton::precedent' %}</button>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align:right;">
|
<td style="text-align:right;">
|
||||||
<button class="next install" type="submit">{{ 'button::Install' | trans }}</button>
|
<button class="next install"
|
||||||
|
type="submit">{% trans 'button::Install' %}</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<div id="install_wait" style="display:none;" title="{{ 'Install in progess' | trans }}">
|
<div id="install_wait" style="display:none;" title="{% trans 'Install in progess' %}">
|
||||||
<p>
|
<p>
|
||||||
<img src="/skins/icons/loader111111.gif"/>
|
<img src="/skins/icons/loader111111.gif"/>
|
||||||
{% trans %}Installation is currenlty processing, please wait...{% endtrans %}
|
{% trans %}
|
||||||
|
Installation is currenlty processing, please wait...
|
||||||
|
{% endtrans %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -19,113 +19,4 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
self::$DI['client']->request('GET', '/admin/');
|
self::$DI['client']->request('GET', '/admin/');
|
||||||
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
|
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRouteMysql()
|
|
||||||
{
|
|
||||||
$connexion = self::$DI['app']['phraseanet.configuration']['main']['database'];
|
|
||||||
|
|
||||||
$params = [
|
|
||||||
"hostname" => $connexion['host'],
|
|
||||||
"port" => $connexion['port'],
|
|
||||||
"user" => $connexion['user'],
|
|
||||||
"password" => $connexion['password'],
|
|
||||||
"dbname" => $connexion['dbname'],
|
|
||||||
];
|
|
||||||
|
|
||||||
self::$DI['client']->request("GET", "/admin/tests/connection/mysql/", $params);
|
|
||||||
$response = self::$DI['client']->getResponse();
|
|
||||||
$this->assertTrue($response->isOk());
|
|
||||||
$this->assertEquals("application/json", $response->headers->get("content-type"));
|
|
||||||
$content = json_decode($response->getContent());
|
|
||||||
$this->assertTrue(is_object($content));
|
|
||||||
$this->assertObjectHasAttribute('connection', $content);
|
|
||||||
$this->assertObjectHasAttribute('database', $content);
|
|
||||||
$this->assertObjectHasAttribute('is_empty', $content);
|
|
||||||
$this->assertObjectHasAttribute('is_appbox', $content);
|
|
||||||
$this->assertObjectHasAttribute('is_databox', $content);
|
|
||||||
$this->assertTrue($content->connection);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRouteMysqlFailed()
|
|
||||||
{
|
|
||||||
$connexion = self::$DI['app']['phraseanet.configuration']['main']['database'];
|
|
||||||
$params = [
|
|
||||||
"hostname" => $connexion['host'],
|
|
||||||
"port" => $connexion['port'],
|
|
||||||
"user" => $connexion['user'] . 'fake',
|
|
||||||
"password" => $connexion['password'],
|
|
||||||
"dbname" => $connexion['dbname'],
|
|
||||||
];
|
|
||||||
|
|
||||||
self::$DI['client']->request("GET", "/admin/tests/connection/mysql/", $params);
|
|
||||||
$response = self::$DI['client']->getResponse();
|
|
||||||
$this->assertTrue($response->isOk());
|
|
||||||
$this->assertEquals("application/json", $response->headers->get("content-type"));
|
|
||||||
$content = json_decode($response->getContent());
|
|
||||||
$this->assertTrue(is_object($content));
|
|
||||||
$this->assertObjectHasAttribute('connection', $content);
|
|
||||||
$this->assertObjectHasAttribute('database', $content);
|
|
||||||
$this->assertObjectHasAttribute('is_empty', $content);
|
|
||||||
$this->assertObjectHasAttribute('is_appbox', $content);
|
|
||||||
$this->assertObjectHasAttribute('is_databox', $content);
|
|
||||||
$this->assertFalse($content->connection);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRouteMysqlDbFailed()
|
|
||||||
{
|
|
||||||
$connexion = self::$DI['app']['phraseanet.configuration']['main']['database'];
|
|
||||||
|
|
||||||
$params = [
|
|
||||||
"hostname" => $connexion['host'],
|
|
||||||
"port" => $connexion['port'],
|
|
||||||
"user" => $connexion['user'],
|
|
||||||
"password" => $connexion['password'],
|
|
||||||
"dbname" => "fake-database-name"
|
|
||||||
];
|
|
||||||
|
|
||||||
self::$DI['client']->request("GET", "/admin/tests/connection/mysql/", $params);
|
|
||||||
$response = self::$DI['client']->getResponse();
|
|
||||||
$this->assertTrue($response->isOk());
|
|
||||||
$this->assertEquals("application/json", $response->headers->get("content-type"));
|
|
||||||
$content = json_decode($response->getContent());
|
|
||||||
$this->assertTrue(is_object($content));
|
|
||||||
$this->assertObjectHasAttribute('connection', $content);
|
|
||||||
$this->assertObjectHasAttribute('database', $content);
|
|
||||||
$this->assertObjectHasAttribute('is_empty', $content);
|
|
||||||
$this->assertObjectHasAttribute('is_appbox', $content);
|
|
||||||
$this->assertObjectHasAttribute('is_databox', $content);
|
|
||||||
$this->assertTrue($content->connection);
|
|
||||||
$this->assertFalse($content->database);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default route test
|
|
||||||
*/
|
|
||||||
public function testRoutePath()
|
|
||||||
{
|
|
||||||
$file = new \SplFileObject(__DIR__ . '/../../../../../files/cestlafete.jpg');
|
|
||||||
self::$DI['client']->request("GET", "/admin/tests/pathurl/path/", ['path' => $file->getPathname()]);
|
|
||||||
|
|
||||||
$response = self::$DI['client']->getResponse();
|
|
||||||
$this->assertTrue($response->isOk());
|
|
||||||
$this->assertEquals("application/json", self::$DI['client']->getResponse()->headers->get("content-type"));
|
|
||||||
$content = json_decode(self::$DI['client']->getResponse()->getContent());
|
|
||||||
$this->assertTrue(is_object($content));
|
|
||||||
$this->assertObjectHasAttribute('exists', $content);
|
|
||||||
$this->assertObjectHasAttribute('file', $content);
|
|
||||||
$this->assertObjectHasAttribute('dir', $content);
|
|
||||||
$this->assertObjectHasAttribute('readable', $content);
|
|
||||||
$this->assertObjectHasAttribute('executable', $content);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRouteUrl()
|
|
||||||
{
|
|
||||||
self::$DI['client']->request("GET", "/admin/tests/pathurl/url/", ['url' => "www.google.com"]);
|
|
||||||
|
|
||||||
$response = self::$DI['client']->getResponse();
|
|
||||||
$this->assertTrue($response->isOk());
|
|
||||||
$this->assertEquals("application/json", self::$DI['client']->getResponse()->headers->get("content-type"));
|
|
||||||
$content = json_decode(self::$DI['client']->getResponse()->getContent());
|
|
||||||
$this->assertTrue(is_object($content));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -109,16 +109,6 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
$this->assertEquals('/prod/', $response->headers->get('location'));
|
$this->assertEquals('/prod/', $response->headers->get('location'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLoginRedirectPostLog()
|
|
||||||
{
|
|
||||||
$this->logout(self::$DI['app']);
|
|
||||||
|
|
||||||
self::$DI['client']->request('GET', '/login/', ['postlog' => '1', 'redirect' => 'prod']);
|
|
||||||
$response = self::$DI['client']->getResponse();
|
|
||||||
$this->assertTrue($response->isRedirect());
|
|
||||||
$this->assertEquals('/login/logout/?redirect=prod', $response->headers->get('location'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideFlashMessages
|
* @dataProvider provideFlashMessages
|
||||||
*/
|
*/
|
||||||
|
@@ -24,7 +24,7 @@ class SetupTest extends \PhraseanetWebTestCase
|
|||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
|
|
||||||
$client = $this->createClient();
|
$client = $this->createClient();
|
||||||
$crawler = $client->request('GET', '/setup/');
|
$client->request('GET', '/setup/');
|
||||||
$response = $client->getResponse();
|
$response = $client->getResponse();
|
||||||
$this->assertEquals(302, $response->getStatusCode());
|
$this->assertEquals(302, $response->getStatusCode());
|
||||||
$this->assertEquals('/setup/installer/', $response->headers->get('location'));
|
$this->assertEquals('/setup/installer/', $response->headers->get('location'));
|
||||||
@@ -150,7 +150,7 @@ class SetupTest extends \PhraseanetWebTestCase
|
|||||||
'hostname' => $host,
|
'hostname' => $host,
|
||||||
'port' => $port,
|
'port' => $port,
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
'password' => $password,
|
'db_password' => $password,
|
||||||
'ab_name' => $abName,
|
'ab_name' => $abName,
|
||||||
'db_name' => $dbName,
|
'db_name' => $dbName,
|
||||||
'db_template' => 'en',
|
'db_template' => 'en',
|
||||||
@@ -189,4 +189,98 @@ class SetupTest extends \PhraseanetWebTestCase
|
|||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
$this->assertEquals('application/json', $response->headers->get('content-type'));
|
$this->assertEquals('application/json', $response->headers->get('content-type'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testRouteMysql()
|
||||||
|
{
|
||||||
|
$this->app['phraseanet.configuration-tester']->expects($this->any())
|
||||||
|
->method('isInstalled')
|
||||||
|
->will($this->returnValue(false));
|
||||||
|
$this->app['phraseanet.configuration-tester']->expects($this->any())
|
||||||
|
->method('isBlank')
|
||||||
|
->will($this->returnValue(true));
|
||||||
|
|
||||||
|
$connexion = $this->app['phraseanet.configuration']['main']['database'];
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
"hostname" => $connexion['host'],
|
||||||
|
"port" => $connexion['port'],
|
||||||
|
"user" => $connexion['user'],
|
||||||
|
"password" => $connexion['password'],
|
||||||
|
"dbname" => $connexion['dbname'],
|
||||||
|
);
|
||||||
|
|
||||||
|
$client = $this->createClient();
|
||||||
|
$client->request("GET", "/setup/connection_test/mysql/", $params);
|
||||||
|
$response = $client->getResponse();
|
||||||
|
$this->assertTrue($response->isOk());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRouteMysqlFailed()
|
||||||
|
{
|
||||||
|
$this->app['phraseanet.configuration-tester']->expects($this->any())
|
||||||
|
->method('isInstalled')
|
||||||
|
->will($this->returnValue(false));
|
||||||
|
$this->app['phraseanet.configuration-tester']->expects($this->any())
|
||||||
|
->method('isBlank')
|
||||||
|
->will($this->returnValue(true));
|
||||||
|
|
||||||
|
$connexion = $this->app['phraseanet.configuration']['main']['database'];
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
"hostname" => $connexion['host'],
|
||||||
|
"port" => $connexion['port'],
|
||||||
|
"user" => $connexion['user'],
|
||||||
|
"password" => "fakepassword",
|
||||||
|
"dbname" => $connexion['dbname'],
|
||||||
|
);
|
||||||
|
|
||||||
|
$client = $this->createClient();
|
||||||
|
$client->request("GET", "/setup/connection_test/mysql/", $params);
|
||||||
|
$response = $client->getResponse();
|
||||||
|
$content = json_decode($client->getResponse()->getContent());
|
||||||
|
$this->assertEquals("application/json", $client->getResponse()->headers->get("content-type"));
|
||||||
|
$this->assertTrue($response->isOk());
|
||||||
|
$this->assertTrue(is_object($content));
|
||||||
|
$this->assertObjectHasAttribute('connection', $content);
|
||||||
|
$this->assertObjectHasAttribute('database', $content);
|
||||||
|
$this->assertObjectHasAttribute('is_empty', $content);
|
||||||
|
$this->assertObjectHasAttribute('is_appbox', $content);
|
||||||
|
$this->assertObjectHasAttribute('is_databox', $content);
|
||||||
|
$this->assertFalse($content->connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRouteMysqlDbFailed()
|
||||||
|
{
|
||||||
|
$this->app['phraseanet.configuration-tester']->expects($this->any())
|
||||||
|
->method('isInstalled')
|
||||||
|
->will($this->returnValue(false));
|
||||||
|
$this->app['phraseanet.configuration-tester']->expects($this->any())
|
||||||
|
->method('isBlank')
|
||||||
|
->will($this->returnValue(true));
|
||||||
|
|
||||||
|
$connexion = $this->app['phraseanet.configuration']['main']['database'];
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
"hostname" => $connexion['host'],
|
||||||
|
"port" => $connexion['port'],
|
||||||
|
"user" => $connexion['user'],
|
||||||
|
"password" => $connexion['password'],
|
||||||
|
"dbname" => "fake-DTABASE-name"
|
||||||
|
);
|
||||||
|
|
||||||
|
$client = $this->createClient();
|
||||||
|
$client->request("GET", "/setup/connection_test/mysql/", $params);
|
||||||
|
$response = $client->getResponse();
|
||||||
|
$content = json_decode($client->getResponse()->getContent());
|
||||||
|
$this->assertEquals("application/json", $client->getResponse()->headers->get("content-type"));
|
||||||
|
$this->assertTrue($response->isOk());
|
||||||
|
$this->assertTrue(is_object($content));
|
||||||
|
$this->assertObjectHasAttribute('connection', $content);
|
||||||
|
$this->assertObjectHasAttribute('database', $content);
|
||||||
|
$this->assertObjectHasAttribute('is_empty', $content);
|
||||||
|
$this->assertObjectHasAttribute('is_appbox', $content);
|
||||||
|
$this->assertObjectHasAttribute('is_databox', $content);
|
||||||
|
$this->assertFalse($content->database);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Alchemy\Tests\Phrasea\Http\StaticFile;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Http\StaticFile\Apache;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
class ApacheModeTest extends \PhraseanetPHPUnitAbstract
|
||||||
|
{
|
||||||
|
public function testGetVirtualHost()
|
||||||
|
{
|
||||||
|
$mode = new Apache(array(
|
||||||
|
'directory' => __DIR__,
|
||||||
|
'mount-point' => '/thumbs'
|
||||||
|
), self::$DI['app']['phraseanet.thumb-symlinker']);
|
||||||
|
$conf = $mode->getVirtualHostConfiguration();
|
||||||
|
$this->assertRegExp('#'.__DIR__ . '#', $conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMappings
|
||||||
|
* @expectedException Alchemy\Phrasea\Exception\InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function testInvalidMapping($mapping)
|
||||||
|
{
|
||||||
|
new Apache($mapping, self::$DI['app']['phraseanet.thumb-symlinker']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideMappings()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(array('Directory' => __DIR__)),
|
||||||
|
array(array('wrong-key' => __DIR__, 'mount-point' => '/')),
|
||||||
|
array(array('directory' => __DIR__, 'wrong-key' => '/')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Alchemy\Tests\Phrasea\Http\StaticFile;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Http\StaticFile\Nginx;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
class NginxModeTest extends \PhraseanetPHPUnitAbstract
|
||||||
|
{
|
||||||
|
public function testGetVirtualHost()
|
||||||
|
{
|
||||||
|
$mode = new Nginx(array(
|
||||||
|
'directory' => __DIR__,
|
||||||
|
'mount-point' => '/thumbs'
|
||||||
|
), self::$DI['app']['phraseanet.thumb-symlinker']);
|
||||||
|
$conf = $mode->getVirtualHostConfiguration();
|
||||||
|
$this->assertRegExp('#'.__DIR__ . '#', $conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideMappings
|
||||||
|
* @expectedException Alchemy\Phrasea\Exception\InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function testInvalidMapping($mapping)
|
||||||
|
{
|
||||||
|
new Nginx($mapping, self::$DI['app']['phraseanet.thumb-symlinker']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideMappings()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(array('Directory' => __DIR__)),
|
||||||
|
array(array('wrong-key' => __DIR__, 'mount-point' => '/')),
|
||||||
|
array(array('directory' => __DIR__, 'wrong-key' => '/')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Alchemy\Tests\Phrasea\Http\XSendFile;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Http\StaticFile\StaticFileFactory;
|
||||||
|
|
||||||
|
class StaticFileFactoryTest extends \PhraseanetPHPUnitAbstract
|
||||||
|
{
|
||||||
|
public function testFactoryCreation()
|
||||||
|
{
|
||||||
|
$factory = StaticFileFactory::create(self::$DI['app']);
|
||||||
|
$this->assertInstanceOf('Alchemy\Phrasea\Http\StaticFile\StaticFileFactory', $factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFactoryWithStaticFileEnable()
|
||||||
|
{
|
||||||
|
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||||
|
|
||||||
|
$factory = new StaticFileFactory($logger, true, 'nginx', self::$DI['app']['phraseanet.thumb-symlinker']);
|
||||||
|
$this->assertInstanceOf('Alchemy\Phrasea\Http\StaticFile\AbstractStaticMode', $factory->getMode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFactoryWithStaticFileDisabled()
|
||||||
|
{
|
||||||
|
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||||
|
|
||||||
|
$factory = new StaticFileFactory($logger, false, 'nginx', self::$DI['app']['phraseanet.thumb-symlinker']);
|
||||||
|
$this->assertInstanceOf('Alchemy\Phrasea\Http\StaticFile\NullMode', $factory->getMode());
|
||||||
|
$this->assertFalse($factory->isStaticFileModeEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException Alchemy\Phrasea\Exception\InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function testFactoryWithWrongTypeThrowsAnExceptionIfRequired()
|
||||||
|
{
|
||||||
|
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||||
|
|
||||||
|
$factory = new StaticFileFactory($logger, true, 'wrong-type', self::$DI['app']['phraseanet.thumb-symlinker']);
|
||||||
|
$factory->getMode(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFactoryWithWrongTypeDoesNotThrowsAnException()
|
||||||
|
{
|
||||||
|
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||||
|
|
||||||
|
$logger->expects($this->once())
|
||||||
|
->method('error')
|
||||||
|
->with($this->isType('string'));
|
||||||
|
|
||||||
|
$factory = new StaticFileFactory($logger, true, 'wrong-type', self::$DI['app']['phraseanet.thumb-symlinker']);
|
||||||
|
$this->assertInstanceOf('Alchemy\Phrasea\Http\StaticFile\NullMode', $factory->getMode(false));
|
||||||
|
}
|
||||||
|
}
|
4
vagrant/config/bower/.bowerrc
Normal file
4
vagrant/config/bower/.bowerrc
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"directory": "www/assets",
|
||||||
|
"interactive": false
|
||||||
|
}
|
@@ -1,2 +1,3 @@
|
|||||||
!.gitignore
|
!.gitignore
|
||||||
|
*
|
||||||
!insecure_private_key
|
!insecure_private_key
|
||||||
|
@@ -93,18 +93,6 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function login(what) {
|
|
||||||
if (confirm(language.confirmRedirectAuth)) {
|
|
||||||
if (what != undefined) {
|
|
||||||
EcrireCookie('last_act', what, null, '/');
|
|
||||||
}
|
|
||||||
self.location.replace('/login/?postlog=1');
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function EcrireCookie(nom, valeur) {
|
function EcrireCookie(nom, valeur) {
|
||||||
var argv = EcrireCookie.arguments;
|
var argv = EcrireCookie.arguments;
|
||||||
var argc = EcrireCookie.arguments.length;
|
var argc = EcrireCookie.arguments.length;
|
||||||
|
@@ -381,7 +381,7 @@
|
|||||||
arrayValues.push(values[v].getValue());
|
arrayValues.push(values[v].getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
return arrayValues.join(' ' + this.databoxField.getSeparator() + ' ');
|
return arrayValues.join(' ; ');
|
||||||
},
|
},
|
||||||
replaceValue: function (search, replace) {
|
replaceValue: function (search, replace) {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user