mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Merge branch 'master' into elastic-indexer
Conflicts: bin/console
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -55,7 +55,7 @@ composer.phar
|
||||
behat.yml
|
||||
|
||||
# Exclude vagrant configuration file
|
||||
.vagrant
|
||||
/.vagrant
|
||||
|
||||
# Exclude crossdomain.xml file it's generated
|
||||
/www/crossdomain.xml
|
||||
|
@@ -54,8 +54,7 @@ script:
|
||||
- bin/developer system:uninstall
|
||||
- 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/developer ini:reset --v3.1 -v;
|
||||
bin/setup system:upgrade -y -v -f;
|
||||
bin/developer ini:reset --email=test@phraseanet.com --password=test --run-patches -v;
|
||||
fi"
|
||||
- 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;
|
||||
|
2
Vagrantfile
vendored
2
Vagrantfile
vendored
@@ -26,7 +26,7 @@ Vagrant.configure("2") do |config|
|
||||
end
|
||||
|
||||
if data['vm']['network']['private_network'].to_s != ''
|
||||
node.vm.network "private_network", ip: "#{data['vm']['network']['private_network']}"
|
||||
node.vm.network :private_network, ip: "#{data['vm']['network']['private_network']}"
|
||||
end
|
||||
|
||||
data['vm']['network']['forwarded_port'].each do |i, port|
|
||||
|
5
bin/console
Executable file → Normal file
5
bin/console
Executable file → Normal file
@@ -16,6 +16,7 @@ use Alchemy\Phrasea\Command\Setup\H264ConfigurationDumper;
|
||||
use Alchemy\Phrasea\Command\Setup\H264MappingGenerator;
|
||||
use Alchemy\Phrasea\Command\SearchEngine\IndexCreateCommand;
|
||||
use Alchemy\Phrasea\Command\SearchEngine\IndexDropCommand;
|
||||
use Alchemy\Phrasea\Command\SearchEngine\IndexFull;
|
||||
use Alchemy\Phrasea\Command\SearchEngine\IndexPopulateCommand;
|
||||
use Alchemy\Phrasea\Command\WebsocketServer;
|
||||
use Alchemy\Phrasea\Core\Version;
|
||||
@@ -32,6 +33,8 @@ use Alchemy\Phrasea\Command\Plugin\RemovePlugin;
|
||||
use Alchemy\Phrasea\Command\CheckConfig;
|
||||
use Alchemy\Phrasea\Command\Setup\XSendFileMappingGenerator;
|
||||
use Alchemy\Phrasea\Command\Setup\XSendFileConfigurationDumper;
|
||||
use Alchemy\Phrasea\Command\Setup\StaticMappingGenerator;
|
||||
use Alchemy\Phrasea\Command\Setup\StaticConfigurationDumper;
|
||||
use Alchemy\Phrasea\Command\Task\SchedulerResumeTasks;
|
||||
use Alchemy\Phrasea\Command\Task\SchedulerState;
|
||||
use Alchemy\Phrasea\Command\Task\SchedulerPauseTasks;
|
||||
@@ -117,6 +120,8 @@ $cli->command(new H264ConfigurationDumper());
|
||||
$cli->command(new H264MappingGenerator());
|
||||
$cli->command(new XSendFileConfigurationDumper());
|
||||
$cli->command(new XSendFileMappingGenerator());
|
||||
$cli->command(new StaticConfigurationDumper());
|
||||
$cli->command(new StaticMappingGenerator());
|
||||
|
||||
if ($cli['search_engine.type'] === SearchEngineInterface::TYPE_ELASTICSEARCH) {
|
||||
$cli->command(new IndexCreateCommand());
|
||||
|
@@ -16,19 +16,11 @@
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/nlegoff/PHP-FFmpeg"
|
||||
"url": "https://github.com/alchemy-fr/imagine"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/nlegoff/Mediavorus"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/nlegoff/Media-Alchemyst"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/nlegoff/Imagine"
|
||||
"url": "https://github.com/alchemy-fr/phpexiftool"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
@@ -48,14 +40,14 @@
|
||||
"alchemy/geonames-api-consumer" : "~0.1.0",
|
||||
"goodby/csv" : "~1.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",
|
||||
"ircmaxell/random-lib" : "~1.0",
|
||||
"jms/serializer" : "~0.10",
|
||||
"jms/translation-bundle" : "~1.1",
|
||||
"justinrainbow/json-schema" : "~1.3",
|
||||
"mediavorus/mediavorus" : "dev-fix-video-dim as 0.4.3",
|
||||
"media-alchemyst/media-alchemyst" : "0.4.x@dev",
|
||||
"mediavorus/mediavorus" : "~0.4.0",
|
||||
"media-alchemyst/media-alchemyst" : "~0.4.0",
|
||||
"monolog/monolog" : "~1.3",
|
||||
"mrclay/minify" : "~2.1.6",
|
||||
"neutron/process-manager" : "2.0.x-dev@dev",
|
||||
@@ -64,9 +56,9 @@
|
||||
"neutron/sphinxsearch-api" : "~2.0.6",
|
||||
"neutron/recaptcha" : "~0.1.0",
|
||||
"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",
|
||||
"phpexiftool/phpexiftool" : "~0.3",
|
||||
"phpexiftool/phpexiftool" : "dev-0.4.1-mwg-metadata-copy as 0.4.1",
|
||||
"react/zmq" : "~0.2",
|
||||
"rhumsaa/uuid" : "~2.7",
|
||||
"silex/silex" : "1.1.x-dev@dev",
|
||||
|
657
composer.lock
generated
657
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -206,6 +206,10 @@ api_cors:
|
||||
session:
|
||||
idle: 0
|
||||
lifetime: 604800 # 1 week
|
||||
static-file:
|
||||
enabled: false
|
||||
type: nginx
|
||||
symlink-directory: ''
|
||||
crossdomain:
|
||||
site-control: 'master-only'
|
||||
allow-access-from:
|
||||
|
@@ -939,7 +939,7 @@ class Application extends SilexApplication
|
||||
// if ($app->getEnvironment() !== Application::ENV_PROD) {
|
||||
// return $this['cache.dev.path'];
|
||||
// }
|
||||
$path = $this['root.path'].'/cache';
|
||||
$path = $app['root.path'].'/cache';
|
||||
if ($app['phraseanet.configuration']->isSetup()) {
|
||||
$path = $app['conf']->get(['main', 'storage', 'cache'], $path);
|
||||
}
|
||||
|
@@ -85,9 +85,9 @@ class Manager
|
||||
$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) {
|
||||
|
||||
@@ -103,6 +103,11 @@ class Manager
|
||||
$code = self::LAZARET_CREATED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write UUID
|
||||
*/
|
||||
$file->getUUID(false, true);
|
||||
|
||||
if (is_callable($callable)) {
|
||||
$callable($element, $visa, $code);
|
||||
}
|
||||
|
@@ -12,13 +12,16 @@
|
||||
namespace Alchemy\Phrasea\Command\Developer;
|
||||
|
||||
use Alchemy\Phrasea\Command\Command;
|
||||
use Alchemy\Phrasea\Core\Version;
|
||||
use Alchemy\Phrasea\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Process\ExecutableFinder;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
use Symfony\Component\Process\Process;
|
||||
use vierbergenlars\SemVer\version as SemVer;
|
||||
|
||||
class IniReset extends Command
|
||||
{
|
||||
@@ -27,15 +30,20 @@ class IniReset extends Command
|
||||
parent::__construct('ini:reset');
|
||||
|
||||
$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('v3.1', null, InputOption::VALUE_NONE, 'Reset with v3.1 fixtures', null)
|
||||
->addOption('uninstall', null, InputOption::VALUE_NONE, 'Uninstall Phraseanet', null);
|
||||
->addOption('run-patches', null, InputOption::VALUE_NONE, 'Reset in v3.1 states & apply all patches', null)
|
||||
;
|
||||
}
|
||||
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$interactive = !$input->getOption('yes');
|
||||
$dialog = $this->getHelperSet()->get('dialog');
|
||||
|
||||
if (!$this->container['phraseanet.configuration']->isSetup()) {
|
||||
throw new RuntimeException(sprintf(
|
||||
'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();
|
||||
$dbs = array('ab' => $conf['main']['database']['dbname'], 'dbs' => array(), 'setup_dbs' => array());
|
||||
foreach($this->container['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
$dbs['dbs'][] = $databox->get_dbname();
|
||||
}
|
||||
|
||||
//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);
|
||||
$dbs['dbs'][] = $databox;
|
||||
}
|
||||
|
||||
if (count($dbs['dbs']) > 1) {
|
||||
if ($input->getOption('name')) {
|
||||
$dbName = $input->getOption('name');
|
||||
if ($input->getOption('db-name')) {
|
||||
$dbName = $input->getOption('db-name');
|
||||
} else {
|
||||
$dialog = $this->getHelperSet()->get('dialog');
|
||||
$dbName = $dialog->ask(
|
||||
$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 {
|
||||
$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['conf']->get(['main', 'storage', 'subdefs'], $this->container['root.path'].'/datas');
|
||||
|
||||
$schema = $this->container['EM']->getConnection()->getSchemaManager();
|
||||
$output->writeln('Creating database "'.$dbs['ab'].'"...<info>OK</info>');
|
||||
$schema->dropAndCreateDatabase($dbs['ab']);
|
||||
@@ -99,31 +121,85 @@ class IniReset extends Command
|
||||
$schema->dropAndCreateDatabase($dbName);
|
||||
|
||||
// inject v3.1 fixtures
|
||||
if ($input->getOption('v3.1')) {
|
||||
$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'].'/resources//hudson/_GV.php', $this->container['root.path'].'/config/_GV.php');
|
||||
if ($input->getOption('run-patches')) {
|
||||
$content = file_get_contents($this->container['root.path'].'/resources/hudson/connexion.inc');
|
||||
|
||||
$command = $this->getApplication()->find('dbal:import');
|
||||
$content = str_replace('{{dbname}}', $conf['main']['database']['dbname'], $content);
|
||||
$content = str_replace('{{hostname}}', $conf['main']['database']['host'], $content);
|
||||
$content = str_replace('{{port}}', $conf['main']['database']['port'], $content);
|
||||
$content = str_replace('{{user}}', $conf['main']['database']['user'], $content);
|
||||
$content = str_replace('{{password}}', $conf['main']['database']['password'], $content);
|
||||
|
||||
$content = file_get_contents($this->container['root.path'] . '/resources//hudson/fixtures.sql');
|
||||
$content = str_replace('ab_test', $dbs['ab'], $content);
|
||||
$content = str_replace('db_test', $dbName, $content);
|
||||
$tmpFile = tempnam(sys_get_temp_dir(), 'connexion.inc-v3.1-');
|
||||
$this->container['filesystem']->dumpFile($tmpFile, $content);
|
||||
|
||||
$this->container['filesystem']->copy($tmpFile, $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');
|
||||
|
||||
$content = file_get_contents($this->container['root.path'] . '/resources/hudson/fixtures.sql');
|
||||
$content = str_replace('{{APPLICATION_BOX}}', $dbs['ab'], $content);
|
||||
$content = str_replace('{{DATA_BOX}}', $dbName, $content);
|
||||
$content = str_replace('{{DB_HOST}}', $conf['main']['database']['host'], $content);
|
||||
$content = str_replace('{{DB_PORT}}', $conf['main']['database']['port'], $content);
|
||||
$content = str_replace('{{DB_USER}}', $conf['main']['database']['user'], $content);
|
||||
$content = str_replace('{{DB_PASSWORD}}', $conf['main']['database']['password'], $content);
|
||||
$content = str_replace('{{DATA_BOX}}', $dbName, $content);
|
||||
$content = str_replace('{{USER_EMAIL}}', $input->getOption('email'), $content);
|
||||
$content = str_replace('{{USER_PASSWORD}}', hash('sha256', $input->getOption('password')), $content);
|
||||
|
||||
$tmpFile = tempnam(sys_get_temp_dir(), 'fixtures-v3.1-');
|
||||
$this->container['filesystem']->dumpFile($tmpFile, $content);
|
||||
|
||||
$input = new ArrayInput(array(
|
||||
'command' => 'dbal:import',
|
||||
'file' => $tmpFile
|
||||
));
|
||||
|
||||
$verbosity = $output->getVerbosity();
|
||||
$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->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
|
||||
$command = $this->getApplication()->find('ini:setup-tests-dbs');
|
||||
$input = new ArrayInput(array(
|
||||
@@ -131,6 +207,8 @@ class IniReset extends Command
|
||||
));
|
||||
$command->run($input, $output);
|
||||
|
||||
$this->container['conf']->set(['main', 'storage', 'subdefs'], $dataPath);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@@ -379,8 +379,9 @@ class RegenerateSqliteDb extends Command
|
||||
private function generateCollection(\Pimple $DI)
|
||||
{
|
||||
$coll = $collection_no_acces = $collection_no_acces_by_status = $db = null;
|
||||
$databoxes = $this->container['phraseanet.appbox']->get_databoxes();
|
||||
|
||||
foreach ($this->container['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
foreach ($databoxes as $databox) {
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
if ($collection_no_acces instanceof \collection && !$collection_no_acces_by_status) {
|
||||
$collection_no_acces_by_status = $collection;
|
||||
@@ -403,13 +404,13 @@ class RegenerateSqliteDb extends Command
|
||||
$DI['coll'] = $coll;
|
||||
|
||||
if (!$collection_no_acces instanceof collection) {
|
||||
$collection_no_acces = \collection::create($this->container, $databox, $this->container['phraseanet.appbox'], 'BIBOO', $DI['user']);
|
||||
$collection_no_acces = \collection::create($this->container, $databox, $this->container['phraseanet.appbox'], 'COLL_TEST_NO_ACCESS', $DI['user']);
|
||||
}
|
||||
|
||||
$DI['coll_no_access'] = $collection_no_acces;
|
||||
|
||||
if (!$collection_no_acces_by_status instanceof collection) {
|
||||
$collection_no_acces_by_status = \collection::create($this->container, $databox, $this->container['phraseanet.appbox'], 'BIBOONOACCESBYSTATUS', $DI['user']);
|
||||
$collection_no_acces_by_status = \collection::create($this->container, $databox, $this->container['phraseanet.appbox'], 'COLL_TEST_NO_ACCESS_BY_STATUS', $DI['user']);
|
||||
}
|
||||
|
||||
$DI['coll_no_status'] = $collection_no_acces_by_status;
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\Command\Setup;
|
||||
|
||||
use Alchemy\Phrasea\Command\Command;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Doctrine\DBAL\Driver\Connection;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
@@ -111,6 +112,13 @@ class Install extends Command
|
||||
$this->container['phraseanet.installer']->setPhraseaIndexerPath($indexer);
|
||||
$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>");
|
||||
|
||||
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+')
|
||||
->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;
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ use Alchemy\Phrasea\Authentication\Context;
|
||||
use Alchemy\Phrasea\Authentication\Exception\AccountLockedException;
|
||||
use Alchemy\Phrasea\Authentication\Exception\RequireCaptchaException;
|
||||
use Alchemy\Phrasea\Core\Event\PreAuthenticate;
|
||||
use Alchemy\Phrasea\Core\Event\PostAuthenticate;
|
||||
use Alchemy\Phrasea\Core\PhraseaEvents;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
@@ -88,7 +89,10 @@ class Oauth2 implements ControllerProviderInterface
|
||||
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 {
|
||||
$r = new Response($app['twig']->render($template, array('error' => $error, "auth" => $oauth2Adapter)));
|
||||
$r->headers->set('Content-Type', 'text/html');
|
||||
|
File diff suppressed because one or more lines are too long
@@ -36,9 +36,6 @@ class Export implements ControllerProviderInterface
|
||||
|
||||
$app['firewall']->addMandatoryAuthentication($controllers);
|
||||
|
||||
$controllers->before(function (Request $request) use ($app) {
|
||||
$app['firewall']->requireNotGuest();
|
||||
});
|
||||
|
||||
$controllers->post('/multi-export/', 'controller.prod.export:displayMultiExport')
|
||||
->bind('export_multi_export');
|
||||
|
@@ -107,23 +107,6 @@ class Login implements ControllerProviderInterface
|
||||
$controllers->get('/', 'login.controller:login')
|
||||
->before(function (Request $request) use ($app) {
|
||||
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;
|
||||
}
|
||||
@@ -698,7 +681,6 @@ class Login implements ControllerProviderInterface
|
||||
|
||||
$response->headers->clearCookie('persistent');
|
||||
$response->headers->clearCookie('last_act');
|
||||
$response->headers->clearCookie('postlog');
|
||||
|
||||
return $response;
|
||||
}
|
||||
@@ -799,7 +781,6 @@ class Login implements ControllerProviderInterface
|
||||
$response = $app->redirectPath('prod');
|
||||
}
|
||||
|
||||
$response->headers->clearCookie('postlog');
|
||||
$response->headers->clearCookie('last_act');
|
||||
|
||||
return $response;
|
||||
@@ -1001,21 +982,6 @@ class Login implements ControllerProviderInterface
|
||||
$response = $this->generateAuthResponse($app, $app['browser'], $request->request->get('redirect'));
|
||||
$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') {
|
||||
$nonce = $app['random.medium']->generateString(64);
|
||||
$string = $app['browser']->getBrowser() . '_' . $app['browser']->getPlatform();
|
||||
|
@@ -142,7 +142,7 @@ class Setup implements ControllerProviderInterface
|
||||
$database_host = $request->request->get('hostname');
|
||||
$database_port = $request->request->get('port');
|
||||
$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');
|
||||
$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\Http\H264PseudoStreaming\H264Factory;
|
||||
use Alchemy\Phrasea\Http\ServeFileResponseFactory;
|
||||
use Alchemy\Phrasea\Http\StaticFile\StaticFileFactory;
|
||||
use Alchemy\Phrasea\Http\XSendFile\XSendFileFactory;
|
||||
use Silex\Application;
|
||||
use Silex\ServiceProviderInterface;
|
||||
@@ -33,10 +34,18 @@ class FileServeServiceProvider implements ServiceProviderInterface
|
||||
return H264Factory::create($app);
|
||||
});
|
||||
|
||||
$app['phraseanet.static-file-factory'] = $app->share(function ($app) {
|
||||
return StaticFileFactory::create($app);
|
||||
});
|
||||
|
||||
$app['phraseanet.h264'] = $app->share(function ($app) {
|
||||
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) {
|
||||
return ServeFileResponseFactory::create($app);
|
||||
});
|
||||
|
@@ -11,6 +11,8 @@
|
||||
|
||||
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\PhraseanetMetadataSetter;
|
||||
use Alchemy\Phrasea\Authentication\ACLProvider;
|
||||
@@ -38,6 +40,14 @@ class PhraseanetServiceProvider implements ServiceProviderInterface
|
||||
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) {
|
||||
return new ACLProvider($app);
|
||||
});
|
||||
|
@@ -19,7 +19,7 @@ class DatabaseHelper extends Helper
|
||||
$port = (int) $this->request->query->get('port', 3306);
|
||||
$user = $this->request->query->get('user');
|
||||
$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;
|
||||
|
||||
@@ -36,14 +36,14 @@ class DatabaseHelper extends Helper
|
||||
|
||||
}
|
||||
|
||||
if (null !== $dbname && $connection_ok) {
|
||||
if (null !== $db_name && $connection_ok) {
|
||||
try {
|
||||
$conn = $this->app['dbal.provider']->get([
|
||||
'host' => $hostname,
|
||||
'port' => $port,
|
||||
'user' => $user,
|
||||
'password' => $password,
|
||||
'dbname' => $dbname,
|
||||
'dbname' => $db_name,
|
||||
]);
|
||||
|
||||
$conn->connect();
|
||||
|
@@ -11,93 +11,92 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Helper;
|
||||
|
||||
use Alchemy\Phrasea\Model\Entities\User;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class Prod extends Helper
|
||||
{
|
||||
|
||||
public function get_search_datas()
|
||||
{
|
||||
$search_datas = [
|
||||
'bases' => [],
|
||||
'dates' => [],
|
||||
'fields' => []
|
||||
];
|
||||
$searchData = array('bases' => array(), 'dates' => array(), 'fields' => array(), 'sort' => array(),);
|
||||
|
||||
$bases = $fields = $dates = [];
|
||||
$bases = $fields = $dates = $sort = array();
|
||||
|
||||
if (! $this->app['authentication']->getUser() instanceof User) {
|
||||
return $search_datas;
|
||||
if (!$this->app['authentication']->getUser() instanceof \User_Adapter) {
|
||||
return $searchData;
|
||||
}
|
||||
|
||||
$searchSet = json_decode($this->app['settings']->getUserSetting($this->app['authentication']->getUser(), 'search'), true);
|
||||
$saveSettings = $this->app['settings']->getUserSetting($this->app['authentication']->getUser(), 'advanced_search_reload');
|
||||
|
||||
foreach ($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_sbas() as $databox) {
|
||||
$sbas_id = $databox->get_sbas_id();
|
||||
$sbasId = $databox->get_sbas_id();
|
||||
|
||||
$bases[$sbas_id] = [
|
||||
'thesaurus' => (trim($databox->get_thesaurus()) != ""),
|
||||
'cterms' => false,
|
||||
'collections' => [],
|
||||
'sbas_id' => $sbas_id
|
||||
];
|
||||
$bases[$sbasId] = array('thesaurus' => (trim($databox->get_thesaurus()) !== ""), 'cterms' => false, 'collections' => array(), 'sbas_id' => $sbasId);
|
||||
|
||||
foreach ($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base([], [$databox->get_sbas_id()]) as $coll) {
|
||||
$selected = $saveSettings ? ((isset($searchSet['bases']) && isset($searchSet['bases'][$sbas_id])) ? (in_array($coll->get_base_id(), $searchSet['bases'][$sbas_id])) : true) : true;
|
||||
$bases[$sbas_id]['collections'][] =
|
||||
[
|
||||
'selected' => $selected,
|
||||
'base_id' => $coll->get_base_id()
|
||||
];
|
||||
$selected = $saveSettings ? ((isset($searchSet['bases']) && isset($searchSet['bases'][$sbasId])) ? (in_array($coll->get_base_id(), $searchSet['bases'][$sbasId])) : true) : true;
|
||||
$bases[$sbasId]['collections'][] = array('selected' => $selected, 'base_id' => $coll->get_base_id());
|
||||
}
|
||||
|
||||
$meta_struct = $databox->get_meta_structure();
|
||||
foreach ($meta_struct as $meta) {
|
||||
if ( ! $meta->is_indexable())
|
||||
foreach ($databox->get_meta_structure() as $fieldMeta) {
|
||||
if (!$fieldMeta->is_indexable()) {
|
||||
continue;
|
||||
$id = $meta->get_id();
|
||||
$name = $meta->get_name();
|
||||
if ($meta->get_type() == 'date') {
|
||||
if (isset($dates[$id]))
|
||||
$dates[$id]['sbas'][] = $sbas_id;
|
||||
else
|
||||
$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])) {
|
||||
$fields[$name]['sbas'][] = $sbas_id;
|
||||
$fields[$name]['sbas'][] = $sbasId;
|
||||
} else {
|
||||
$fields[$name] = [
|
||||
'sbas' => [$sbas_id]
|
||||
, 'fieldname' => $name
|
||||
, 'type' => $meta->get_type()
|
||||
, 'id' => $id
|
||||
];
|
||||
$fields[$name] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $bases[$sbas_id]['thesaurus']) {
|
||||
if (!$bases[$sbasId]['thesaurus']) {
|
||||
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($sbasId, 'bas_modif_th')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (false !== simplexml_load_string($databox->get_cterms())) {
|
||||
$bases[$sbas_id]['cterms'] = true;
|
||||
$bases[$sbasId]['cterms'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$search_datas['fields'] = $fields;
|
||||
$search_datas['dates'] = $dates;
|
||||
$search_datas['bases'] = $bases;
|
||||
$searchData['fields'] = $fields;
|
||||
$searchData['dates'] = $dates;
|
||||
$searchData['bases'] = $bases;
|
||||
$searchData['sort'] = $sort;
|
||||
|
||||
return $search_datas;
|
||||
return $searchData;
|
||||
}
|
||||
|
||||
public function getRandom()
|
||||
{
|
||||
return $this->app['random.low']->generateString(16);
|
||||
return md5(time() . mt_rand(100000, 999999));
|
||||
}
|
||||
}
|
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);
|
||||
}
|
91
lib/Alchemy/Phrasea/Http/StaticFile/Symlink/SymLinker.php
Normal file
91
lib/Alchemy/Phrasea/Http/StaticFile/Symlink/SymLinker.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?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;
|
||||
|
||||
public static function create(Application $app)
|
||||
{
|
||||
return new SymLinker(
|
||||
$app['phraseanet.thumb-symlinker-encoder'],
|
||||
$app['filesystem'],
|
||||
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, $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'))) {
|
||||
$bas = array_map(function ($base_id) use ($app) {
|
||||
try {
|
||||
return \collection::get_from_base_id($app, $base_id);
|
||||
} catch (\Exception_Databox_CollectionNotFound $e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}, $request->get('bases'));
|
||||
} elseif (!$app['authentication']->isAuthenticated()) {
|
||||
$bas = $app->getOpenCollections();
|
||||
|
@@ -33,10 +33,9 @@ class Installer
|
||||
{
|
||||
$this->rollbackInstall($abConn, $dbConn);
|
||||
|
||||
$this->createConfigFile($abConn, $serverName, $binaryData, $dataPath);
|
||||
try {
|
||||
$this->createConfigFile($abConn, $serverName, $binaryData);
|
||||
$this->createAB();
|
||||
$this->populateRegistryData($serverName, $dataPath, $binaryData);
|
||||
$user = $this->createUser($email, $password);
|
||||
$this->createDefaultUsers();
|
||||
if (null !== $dbConn) {
|
||||
@@ -57,22 +56,6 @@ class Installer
|
||||
$this->phraseaIndexer = $path;
|
||||
}
|
||||
|
||||
private function populateRegistryData($serverName, $dataPath)
|
||||
{
|
||||
if (null === $dataPath = realpath($dataPath)) {
|
||||
throw new \InvalidArgumentException(sprintf('Path %s does not exist.', $dataPath));
|
||||
}
|
||||
|
||||
$this->app['conf']->set(['main', 'storage', 'subdefs'], $dataPath);
|
||||
$this->app['conf']->set(['main', 'storage', 'cache'], realpath(__DIR__ . '/../../../../cache'));
|
||||
$this->app['conf']->set(['main', 'storage', 'log'], realpath(__DIR__ . '/../../../../logs'));
|
||||
$this->app['conf']->set(['main', 'storage', 'download'], realpath(__DIR__ . '/../../../../tmp/download'));
|
||||
$this->app['conf']->set(['main', 'storage', 'lazaret'], realpath(__DIR__ . '/../../../../tmp/lazaret'));
|
||||
$this->app['conf']->set(['main', 'storage', 'caption'], realpath(__DIR__ . '/../../../../tmp/caption'));
|
||||
$this->app['conf']->set('servername', $serverName);
|
||||
$this->app['conf']->set('registry', $this->app['registry.manipulator']->getRegistryData());
|
||||
}
|
||||
|
||||
private function createDB(Connection $dbConn = null, $template)
|
||||
{
|
||||
$template = new \SplFileInfo(__DIR__ . '/../../../conf.d/data_templates/' . $template . '-simple.xml');
|
||||
@@ -177,7 +160,7 @@ class Installer
|
||||
$this->app['phraseanet.appbox']->insert_datas($this->app);
|
||||
}
|
||||
|
||||
private function createConfigFile(Connection $abConn, $serverName, $binaryData)
|
||||
private function createConfigFile(Connection $abConn, $serverName, $binaryData, $dataPath)
|
||||
{
|
||||
$config = $this->app['configuration.store']->initialize()->getConfig();
|
||||
|
||||
@@ -195,6 +178,20 @@ class Installer
|
||||
$config['servername'] = $serverName;
|
||||
$config['main']['key'] = $this->app['random.medium']->generateString(16);
|
||||
|
||||
if (null === $dataPath = realpath($dataPath)) {
|
||||
throw new \InvalidArgumentException(sprintf('Path %s does not exist.', $dataPath));
|
||||
}
|
||||
|
||||
$config['main']['storage']['subdefs'] = $dataPath;
|
||||
|
||||
$config['main']['storage']['cache'] = realpath(__DIR__ . '/../../../../cache');
|
||||
$config['main']['storage']['log'] = realpath(__DIR__ . '/../../../../logs');
|
||||
$config['main']['storage']['download'] = realpath(__DIR__ . '/../../../../tmp/download');
|
||||
$config['main']['storage']['lazaret'] = realpath(__DIR__ . '/../../../../tmp/lazaret');
|
||||
$config['main']['storage']['caption'] = realpath(__DIR__ . '/../../../../tmp/caption');
|
||||
|
||||
$config['registry'] = $this->app['registry.manipulator']->getRegistryData();
|
||||
|
||||
$this->app['configuration.store']->setConfig($config);
|
||||
}
|
||||
}
|
||||
|
@@ -496,7 +496,7 @@ class Migration31 implements MigrationInterface
|
||||
|
||||
$stmt->execute([
|
||||
':key' => 'GV_sit',
|
||||
':value' => GV_sit,
|
||||
':value' => constant("GV_sit"),
|
||||
':type' => 'string',
|
||||
]);
|
||||
|
||||
@@ -505,7 +505,6 @@ class Migration31 implements MigrationInterface
|
||||
rename(__DIR__ . '/../../../../../../config/_GV.php', __DIR__ . '/../../../../../../config/_GV.php.old');
|
||||
$servername = defined('GV_ServerName') ? constant('GV_ServerName') : '';
|
||||
file_put_contents(__DIR__ . '/../../../../../../config/config.inc', "<?php\n\$servername = \"" . str_replace('"', '\"', $servername) . "\";\n");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -240,17 +240,19 @@ class RecordMoverJob extends AbstractJob
|
||||
}
|
||||
|
||||
// set status ?
|
||||
$x = $sxtask->to->status['mask'];
|
||||
$x = trim($sxtask->to->status['mask']);
|
||||
$x = preg_replace('/[^0-1]/', 'x', $x);
|
||||
|
||||
$mx = str_replace(' ', '0', ltrim(str_replace(array('0', 'x'), array(' ', ' '), $x)));
|
||||
$ma = str_replace(' ', '0', ltrim(str_replace(array('x', '0'), array(' ', '1'), $x)));
|
||||
if ($mx && $ma) {
|
||||
$tws[] = '((status ^ ' . $connbas->quote('0b'.$mx) . ') & ' . $connbas->quote('0b'.$ma) . ')!=0';
|
||||
$tws[] = '((status ^ 0b' . $mx . ') & 0b' . $ma . ')!=0';
|
||||
}
|
||||
elseif ($mx) {
|
||||
$tws[] = '(status ^ ' . $connbas->quote('0b'.$mx) . ')!=0';
|
||||
$tws[] = '(status ^ 0b' . $mx . ')!=0';
|
||||
}
|
||||
elseif ($ma) {
|
||||
$tws[] = '(status & ' . $connbas->quote('0b'.$ma) . ')!=0';
|
||||
$tws[] = '(status & 0b' . $ma . ')!=0';
|
||||
}
|
||||
|
||||
// compute the 'where' clause
|
||||
@@ -432,15 +434,17 @@ class RecordMoverJob extends AbstractJob
|
||||
}
|
||||
|
||||
// criteria <status mask="XXXXX" />
|
||||
$x = $sxtask->from->status['mask'];
|
||||
$x = trim($sxtask->from->status['mask']);
|
||||
$x = preg_replace('/[^0-1]/', 'x', $x);
|
||||
|
||||
$mx = str_replace(' ', '0', ltrim(str_replace(array('0', 'x'), array(' ', ' '), $x)));
|
||||
$ma = str_replace(' ', '0', ltrim(str_replace(array('x', '0'), array(' ', '1'), $x)));
|
||||
if ($mx && $ma) {
|
||||
$tw[] = '((status ^ ' . $connbas->quote('0b'.$mx) . ') & ' . $connbas->quote('0b'.$ma) . ')=0';
|
||||
$tw[] = '((status ^ 0b'. $mx . ') & 0b'. $ma . ')=0';
|
||||
} elseif ($mx) {
|
||||
$tw[] = '(status ^ ' . $connbas->quote('0b'.$mx) . ')=0';
|
||||
$tw[] = '(status ^ 0b' . $mx . ')=0';
|
||||
} elseif ($ma) {
|
||||
$tw[] = '(status & ' . $connbas->quote('0b'.$ma) . ")=0";
|
||||
$tw[] = '(status & 0b' . $ma . ")=0";
|
||||
}
|
||||
|
||||
return array($tw, $join);
|
||||
|
@@ -454,6 +454,21 @@ class databox extends base
|
||||
|
||||
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) {
|
||||
$collection->unmount_collection($this->app);
|
||||
}
|
||||
@@ -509,6 +524,7 @@ class databox extends base
|
||||
$stmt->closeCursor();
|
||||
|
||||
$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;
|
||||
}
|
||||
@@ -567,20 +583,16 @@ class databox extends base
|
||||
$stmt->execute();
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
if ($row)
|
||||
if ($row) {
|
||||
$ord = $row['ord'] + 1;
|
||||
}
|
||||
|
||||
$params[':ord'] = $ord;
|
||||
|
||||
$sql = 'INSERT INTO sbas (sbas_id, ord, host, port, dbname, sqlengine, user, pwd)
|
||||
VALUES (null, :ord, :host, :port, :dbname, "MYSQL", :user, :password)';
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute([
|
||||
':ord' => $ord
|
||||
, ':host' => $host
|
||||
, ':port' => $port
|
||||
, ':dbname' => $dbname
|
||||
, ':user' => $user
|
||||
, ':password' => $password
|
||||
]);
|
||||
$stmt->execute($params);
|
||||
$stmt->closeCursor();
|
||||
$sbas_id = (int) $app['phraseanet.appbox']->get_connection()->lastInsertId();
|
||||
|
||||
@@ -603,7 +615,6 @@ class databox extends base
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $dbname
|
||||
* @param registry $registry
|
||||
* @return databox
|
||||
*/
|
||||
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
|
||||
* @param type $subdef_name
|
||||
* @return databox_subdef
|
||||
* @return mixed
|
||||
* @throws Exception_Databox_SubdefNotFound
|
||||
*/
|
||||
public function get_subdef($subdef_type, $subdef_name)
|
||||
{
|
||||
if (isset($this->AvSubdefs[$subdef_type]) && isset($this->AvSubdefs[$subdef_type][$subdef_name])) {
|
||||
return $this->AvSubdefs[$subdef_type][$subdef_name];
|
||||
$type = strtolower($subdef_type);
|
||||
$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();
|
||||
}
|
||||
|
||||
if ($name === 'thumbnail' && $app['phraseanet.static-file-factory']->isStaticFileModeEnabled()) {
|
||||
$app['phraseanet.thumb-symlinker']->symlink($subdef->get_pathfile());
|
||||
}
|
||||
|
||||
unset($media);
|
||||
|
||||
return $subdef;
|
||||
@@ -741,6 +745,14 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
||||
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 (null !== $url = $this->app['phraseanet.h264']->getUrl($this->get_pathfile())) {
|
||||
$this->url = $url;
|
||||
|
@@ -11,6 +11,7 @@
|
||||
|
||||
use Alchemy\Phrasea\Command\Command;
|
||||
use Alchemy\Phrasea\Core\Version;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@@ -104,6 +105,13 @@ class module_console_systemUpgrade extends Command
|
||||
$output->writeln("");
|
||||
$output->writeln("");
|
||||
}
|
||||
|
||||
if (null !== $this->getApplication()) {
|
||||
$command = $this->getApplication()->find('crossdomain:generate');
|
||||
$command->run(new ArrayInput(array(
|
||||
'command' => 'crossdomain:generate'
|
||||
)), $output);
|
||||
}
|
||||
} else {
|
||||
$output->write('<info>Canceled</info>', true);
|
||||
}
|
||||
|
75
lib/classes/patch/386alpha3a.php
Normal file
75
lib/classes/patch/386alpha3a.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns doctrine migrations needed for the patch.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDoctrineMigrations()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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;
|
||||
}
|
||||
}
|
@@ -1111,7 +1111,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
||||
$databox = $this->app['phraseanet.appbox']->get_databox($this->get_sbas_id());
|
||||
$connbas = $databox->get_connection();
|
||||
$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';
|
||||
$stmt = $connbas->prepare($sql);
|
||||
$stmt->execute([':record_id' => $this->record_id]);
|
||||
@@ -1431,6 +1431,10 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
||||
if (!$subdef->is_physically_present())
|
||||
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();
|
||||
$watermark = $subdef->get_path() . 'watermark_' . $subdef->get_file();
|
||||
if (file_exists($watermark))
|
||||
|
@@ -349,6 +349,10 @@ class recordutils_image
|
||||
$image_out->save($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;
|
||||
}
|
||||
|
||||
|
@@ -203,6 +203,10 @@ session:
|
||||
idle: 0
|
||||
# 1 week
|
||||
lifetime: 604800
|
||||
static-file:
|
||||
enabled: false
|
||||
type: nginx
|
||||
symlink-directory: ''
|
||||
crossdomain:
|
||||
allow-access-from:
|
||||
-
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
$hostname = '127.0.0.1';
|
||||
$port = '3306';
|
||||
$user = 'root';
|
||||
$password = '';
|
||||
$dbname = 'ab_test';
|
||||
$hostname = '{{hostname}}';
|
||||
$port = '{{port}}';
|
||||
$user = '{{user}}';
|
||||
$password = '{{password}}';
|
||||
$dbname = '{{dbname}}';
|
||||
|
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"directory" : "tmp-assets",
|
||||
"directory": "www/assets",
|
||||
"interactive": false
|
||||
}
|
||||
|
@@ -60,7 +60,6 @@ server:
|
||||
- imagemagick
|
||||
- libevent-dev
|
||||
- ufraw
|
||||
- ffmpeg
|
||||
- ghostscript
|
||||
- xpdf
|
||||
- unoconv
|
||||
@@ -86,6 +85,38 @@ server:
|
||||
- libgif-dev
|
||||
- libjpeg62-dev
|
||||
- cachefilesd
|
||||
- autoconf
|
||||
- automake
|
||||
- build-essential
|
||||
- libass-dev
|
||||
- libfreetype6-dev
|
||||
- libgpac-dev
|
||||
- libsdl1.2-dev
|
||||
- libtheora-dev
|
||||
- libtool
|
||||
- libva-dev
|
||||
- libvdpau-dev
|
||||
- libvorbis-dev
|
||||
- libx11-dev
|
||||
- libxext-dev
|
||||
- libx264-dev
|
||||
- libxfixes-dev
|
||||
- libgsm1-dev
|
||||
- pkg-config
|
||||
- texi2html
|
||||
- zlib1g-dev
|
||||
- yasm
|
||||
- unzip
|
||||
- libopus-dev
|
||||
- libvpx-dev
|
||||
- libvorbis-dev
|
||||
- libmp3lame-dev
|
||||
- libxvidcore-dev
|
||||
- libfaad-dev
|
||||
- libopencore-amrnb-dev
|
||||
- libopencore-amrwb-dev
|
||||
- libxvidcore-dev
|
||||
- libdc1394-22-dev
|
||||
dot_files:
|
||||
-
|
||||
bash_aliases: null
|
||||
|
0
resources/vagrant/vms/phraseanet-php54-nginx/puphpet/files/exec-always/setup
vendored
Normal file → Executable file
0
resources/vagrant/vms/phraseanet-php54-nginx/puphpet/files/exec-always/setup
vendored
Normal file → Executable file
@@ -16,6 +16,51 @@ sudo sh -c 'echo "nl_NL.UTF-8 UTF-8" >> /etc/locale.gen'
|
||||
sudo locale-gen en_US en_US.UTF-8 en_GB en_GB.UTF-8 fr_FR fr_FR.UTF-8 de_DE de_DE.UTF-8 nl_NL nl_NL.UTF-8
|
||||
sudo dpkg-reconfigure -f noninteractive locales
|
||||
|
||||
#ffmpeg
|
||||
sudo sh -c 'echo "deb http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list'
|
||||
sudo sh -c 'echo "deb-src http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list'
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install --force-yes -y deb-multimedia-keyring
|
||||
sudo apt-get update
|
||||
sudo apt-get install --force-yes -y libfaac-dev
|
||||
|
||||
cd /tmp
|
||||
wget –quiet https://www.ffmpeg.org/releases/ffmpeg-1.2.8.tar.gz
|
||||
tar -zxvf ffmpeg-1.2.8.tar.gz
|
||||
cd ffmpeg-1.2.8
|
||||
|
||||
wget –quiet -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master
|
||||
sudo -u vagrant unzip fdk-aac.zip
|
||||
cd mstorsjo-fdk-aac*
|
||||
autoreconf -fiv
|
||||
./configure --disable-shared
|
||||
make
|
||||
sudo make install
|
||||
make distclean
|
||||
cd ..
|
||||
|
||||
./configure --enable-gpl \
|
||||
--enable-nonfree \
|
||||
--enable-libfaac \
|
||||
--enable-libgsm \
|
||||
--enable-libmp3lame \
|
||||
--enable-libtheora \
|
||||
--enable-libvorbis \
|
||||
--enable-libx264 \
|
||||
--enable-libxvid \
|
||||
--enable-zlib \
|
||||
--enable-postproc \
|
||||
--enable-swscale \
|
||||
--enable-pthreads \
|
||||
--enable-x11grab \
|
||||
--enable-libdc1394 \
|
||||
--enable-version3 \
|
||||
--enable-libopencore-amrnb \
|
||||
--enable-libopencore-amrwb
|
||||
make
|
||||
sudo make install
|
||||
|
||||
# node + npm
|
||||
cd /tmp
|
||||
wget –quiet "http://nodejs.org/dist/v0.10.29/node-v0.10.29-linux-x64.tar.gz"
|
||||
@@ -28,6 +73,7 @@ sudo cp -rf * /usr/local/
|
||||
sudo npm install -g recess
|
||||
sudo npm install -g grunt-cli
|
||||
sudo npm install -g bower
|
||||
sudo npm install -g uglify-js
|
||||
|
||||
# python tools
|
||||
sudo easy_install -U taschenmesser scour boto
|
||||
@@ -107,7 +153,7 @@ fi
|
||||
sudo sh -c 'echo "RUN=yes" > /etc/default/cachefilesd'
|
||||
|
||||
# copy www.conf
|
||||
sudo sh -c "cat /vagrant/resources/vagrant/config/nginx/php5-fpm-www.conf > /etc/php5/fpm/pool.d/www.conf"
|
||||
sudo sh -c 'cat /vagrant/resources/vagrant/config/nginx/php5-fpm-www.conf > /etc/php5/fpm/pool.d/www.conf'
|
||||
|
||||
#setup phraseanet
|
||||
if [ ! -f /var/www/phraseanet/config/configuration.yml ]
|
||||
@@ -116,13 +162,13 @@ then
|
||||
mv /var/www/phraseanet/lib/conf.d/configuration.yml /var/www/phraseanet/lib/conf.d/configuration.yml.bkp
|
||||
cp /vagrant/resources/vagrant/config/phraseanet/configuration.yml /var/www/phraseanet/lib/conf.d/configuration.yml
|
||||
mv /var/www/phraseanet/.bowerrc /var/www/phraseanet/.bowerrc.bkp
|
||||
cp /vagrant/resources/vagrant/config/bower/.bower.rc /var/www/phraseanet/.bowerrc
|
||||
cp /vagrant/resources/vagrant/config/bower/.bowerrc /var/www/phraseanet/.bowerrc
|
||||
cd /var/www/phraseanet
|
||||
composer install -n --prefer-source --dev
|
||||
npm install
|
||||
grunt install-assets
|
||||
bin/developer assets:compile-less
|
||||
rm -f /var/www/phraseanet/lib/conf.d/configuration.yml
|
||||
sudo -u vagrant composer install -n --prefer-source --dev
|
||||
sudo -u vagrant npm install
|
||||
sudo -u vagrant grunt install-assets
|
||||
sudo -u vagrant bin/developer assets:compile-less
|
||||
sudo -u vagrant rm -f /var/www/phraseanet/lib/conf.d/configuration.yml
|
||||
rm -f /var/www/phraseanet/.bowerrc
|
||||
mv /www/phraseanet/.bowerrc.bkp /www/phraseanet/.bowerrc
|
||||
mv /var/www/phraseanet/lib/conf.d/configuration.yml.bkp /var/www/phraseanet/lib/conf.d/configuration.yml
|
||||
|
@@ -79,7 +79,14 @@
|
||||
{% if app['conf'].get(['registry', 'actions', 'auth-required-for-export']) and app['authentication'].getUser().isGuest() %}
|
||||
<script type="text/javascript">
|
||||
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>
|
||||
{% else %}
|
||||
{% 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>
|
||||
<select name="sort" class="input-small">
|
||||
{% for sort, sort_name in app['phraseanet.SE'].getAvailableSort() %}
|
||||
<option value="{{ sort }}" {% if sort == app['phraseanet.SE'].getDefaultSort() %}selected="selected" class="default-selection"{% endif %}>{{ sort_name }}</option>
|
||||
<option value="" {% if app['phraseanet.SE'].getDefaultSort() is empty %}selected="selected default-selection"{% endif %}>{{ "No sort"|trans }}</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 %}
|
||||
</select>
|
||||
<select name="ord" class="input-medium">
|
||||
@@ -412,11 +413,16 @@
|
||||
<td colspan="2">{{ 'Rechercher dans un champ date' | trans }}</td>
|
||||
<td colspan="2">
|
||||
<select name="date_field" class="input-medium">
|
||||
{% for field in app['phraseanet.SE'].getAvailableDateFields() %}
|
||||
{% for date in search_datas['dates'] %}
|
||||
<option onchange="checkFilters(true);"
|
||||
class="" value="{{ field }}">{{ field }}</option>
|
||||
class="" value="{{ date.fieldname }}">{{ date.fieldname }}</option>
|
||||
{% endfor %}
|
||||
<option value="{{ app['phraseanet.SE'].getAvailableDateFields()|join('|') }}" selected="selected">
|
||||
|
||||
{% 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">
|
||||
{{ 'rechercher dans tous les champs'| trans }}
|
||||
</option>
|
||||
</select>
|
||||
|
@@ -4,22 +4,22 @@
|
||||
{% import 'common/drop_down_options.html.twig' as drop_down %}
|
||||
{% set th_size = app['settings'].getUserSetting(app['authentication'].getUser(), 'images_size') %}
|
||||
{% set sbas_id = record.get_sbas_id %}
|
||||
{% set lazyload = app['phraseanet.configuration']['lazyload']|default(false) %}
|
||||
{% set container_attributes %}
|
||||
{% if entry_id %}
|
||||
<div style="width:{{th_size+30}}px;" sbas="{{sbas_id}}"
|
||||
id="{{ prefix|default('IMGT') }}_{{record.get_sbas_id}}_{{record.get_record_id}}"
|
||||
class="IMGT diapo type-{{ record.get_type }}"
|
||||
onDblClick="openPreview('FEED',{{record.get_number()}},{{entry_id}});">
|
||||
onDblClick="openPreview('FEED',{{ record.get_number() }},{{ entry_id }});"
|
||||
{% elseif record.is_grouping() %}
|
||||
<div style="width:{{th_size+30}}px;" sbas="{{sbas_id}}"
|
||||
id="{{ prefix|default('IMGT') }}_{{record.get_sbas_id}}_{{record.get_record_id}}"
|
||||
class="IMGT diapo grouping type-{{ record.get_type }}"
|
||||
onDblClick="openPreview('REG','0','{{record.get_serialize_key()}}');">
|
||||
onDblClick="openPreview('REG','0','{{ record.get_serialize_key() }}');"
|
||||
{% else %}
|
||||
<div style="width:{{th_size+30}}px;" sbas="{{sbas_id}}"
|
||||
id="{{ prefix|default('IMGT') }}_{{record.get_sbas_id}}_{{record.get_record_id}}"
|
||||
class="IMGT diapo type-{{ record.get_type }}"
|
||||
onDblClick="openPreview('RESULT',{{record.get_number}});">
|
||||
onDblClick="openPreview('RESULT',{{ record.get_number }});"
|
||||
{% endif %}
|
||||
{% endset %}
|
||||
|
||||
<div style="width:{{ th_size+30 }}px;" sbas="{{ sbas_id }}"
|
||||
id="{{ prefix|default('IMGT') }}_{{ record.get_sbas_id }}_{{ record.get_record_id }}" {{ container_attributes }}>
|
||||
<div style="padding: 4px;">
|
||||
<div style="height:40px; position: relative; z-index: 95;margin-bottom:0;border-bottom:none;">
|
||||
<div class="title" style="max-height:100%" title="{{ record.get_title() }}">
|
||||
@@ -29,12 +29,12 @@
|
||||
{{ record.get_status_icons|raw }}
|
||||
</div>
|
||||
</div>
|
||||
{% set rollover_gif = record.get_rollover_thumbnail() %}
|
||||
|
||||
{% set rollover_gif = record.get_rollover_thumbnail() %}
|
||||
{% set user_technical_display = app['settings'].getUserSetting(app['authentication'].getUser(), 'technical_display') %}
|
||||
{% set user_rollover_thumbnail =app['settings'].getUserSetting(app['authentication'].getUser(), 'rollover_thumbnail') %}
|
||||
|
||||
{% set extraclass = '' %}
|
||||
|
||||
{% if user_rollover_thumbnail == 'caption' and searchEngine is not null %}
|
||||
{% set extraclass = extraclass ~ ' captionTips' %}
|
||||
{% set tooltipsrc = path('prod_tooltip_caption', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id(), 'context' : 'answer', 'number' : record.get_number() }) %}
|
||||
@@ -45,7 +45,9 @@
|
||||
{% set extraclass = extraclass ~ ' captionTips' %}
|
||||
{% set tooltipsrc = path('prod_tooltip_preview', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id() }) %}
|
||||
{% endif %}
|
||||
<div class="thumb {{extraclass}} " tooltipsrc="{{tooltipsrc}}" style="height:{{th_size}}px; z-index:90;">
|
||||
|
||||
<div class="thumb {{ extraclass }} " tooltipsrc="{{ tooltipsrc }}"
|
||||
style="height:{{ th_size }}px; z-index:90;">
|
||||
<div class="doc_infos">
|
||||
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'doctype_display') == '1' %}
|
||||
{{ doctype_icons.format(record) }}
|
||||
@@ -59,12 +61,13 @@
|
||||
{% if rollover_gif %}
|
||||
{% set extraclass = 'rollover-gif-out' %}
|
||||
{% 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 %}
|
||||
{{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 %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="height: 25px; position:relative; text-align:left;">
|
||||
<table class="bottom" style="width:100%; table-layout:fixed;">
|
||||
<tr>
|
||||
@@ -81,13 +84,17 @@
|
||||
<td style='text-align:right;width:{{ l_width }}px;' valign='bottom'>
|
||||
{{ drop_down.prod(record, entry_id) }}
|
||||
{% if record.has_preview() and app['acl'].get(app['authentication'].getUser()).has_access_to_subdef(record, 'preview') %}
|
||||
<div tooltipsrc="{{ path('prod_tooltip_preview', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id() }) }}" class="previewTips"></div>
|
||||
<div tooltipsrc="{{ path('prod_tooltip_preview', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id() }) }}"
|
||||
class="previewTips"></div>
|
||||
{% endif %}
|
||||
{% if user_rollover_thumbnail == 'preview' %}
|
||||
<div tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id(), 'context' : 'answer', 'number' : record.get_number() }) }}" class="captionRolloverTips"></div>
|
||||
<div tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id(), 'context' : 'answer', 'number' : record.get_number() }) }}"
|
||||
class="captionRolloverTips"></div>
|
||||
{% endif %}
|
||||
{% if user_technical_display == '1' %}
|
||||
<img class="infoTips" tooltipsrc="{{ path('prod_tooltip_technical_data', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id() }) }}" src="/skins/icons/info.gif"/>
|
||||
<img class="infoTips"
|
||||
tooltipsrc="{{ path('prod_tooltip_technical_data', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id() }) }}"
|
||||
src="/skins/icons/info.gif"/>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
@@ -406,11 +406,6 @@ $(document).ready(function () {
|
||||
});
|
||||
});
|
||||
|
||||
dataCollection.push({
|
||||
"name": "b64_image",
|
||||
"value": data["b64_image"]
|
||||
});
|
||||
|
||||
//remove current context
|
||||
data.context.remove();
|
||||
|
||||
|
@@ -59,15 +59,15 @@
|
||||
|
||||
password : {password:"#create_admin input[name=email]"},
|
||||
password_confirm : {equalTo:"#create_admin input[name=password]"},
|
||||
hostname : {required:true},
|
||||
user : {required:true},
|
||||
ab_hostname : {required:true},
|
||||
ab_user : {required:true},
|
||||
ab_name : {required:true}
|
||||
},
|
||||
messages: {
|
||||
email:{
|
||||
email : language.validateEmail
|
||||
},
|
||||
hostname : {
|
||||
ab_hostname : {
|
||||
required : language.requiredField
|
||||
},
|
||||
password : {
|
||||
@@ -152,17 +152,17 @@
|
||||
var hostname_input = $('input[name="hostname"]:visible', scope);
|
||||
var port_input = $('input[name="port"]:visible', scope);
|
||||
var user_input = $('input[name="user"]', scope);
|
||||
var password_input = $('input[name="password"]', scope);
|
||||
var dbname_input = $('input[name="ab_name"]', scope);
|
||||
var password_input = $('input[name="db_password"]', scope);
|
||||
var db_name_input = $('input[name="ab_name"]', scope);
|
||||
|
||||
var user = user_input.val();
|
||||
var password = password_input.val();
|
||||
var dbname = dbname_input.val();
|
||||
var db_name = db_name_input.val();
|
||||
|
||||
var datas = {
|
||||
user:user,
|
||||
password:password,
|
||||
dbname:dbname
|
||||
db_name:db_name
|
||||
};
|
||||
|
||||
if(hostname_input.length > 0)
|
||||
@@ -190,18 +190,18 @@
|
||||
var hostname_input = $('input[name="hostname"]', appbox_scope);
|
||||
var port_input = $('input[name="port"]', 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 password = password_input.val();
|
||||
var dbname = dbname_input.val();
|
||||
var db_name = db_name_input.val();
|
||||
|
||||
var datas = {
|
||||
user:user,
|
||||
password:password,
|
||||
dbname:dbname
|
||||
db_name:db_name
|
||||
};
|
||||
|
||||
if(hostname_input.length > 0)
|
||||
@@ -557,7 +557,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:200px;"><label>{{ 'admin::compte-utilisateur mot de passe' | trans }}</label></td>
|
||||
<td><input type="password" name="password" value="" autocomplete="off" /></td>
|
||||
<td><input type="password" name="db_password" value="" autocomplete="off" /></td>
|
||||
</tr>
|
||||
<tr class="optional_ab_datas">
|
||||
<td style="width:200px;"><label>{{ 'phraseanet:: port' | trans }}</label></td>
|
||||
@@ -651,7 +651,7 @@
|
||||
<table class="main_content_table">
|
||||
<tr>
|
||||
<td><label>{{ 'Repertoire de stockage des fichiers' | trans }}</label></td>
|
||||
<td><input class="path_to_test test_writeable required" type="text" name="datapath_noweb" value="{{ rootpath ~ "/datas" }}" /></td>
|
||||
<td><input class="path_to_test test_writeable required" type="text" name="datapath_noweb" value="" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
@@ -19,113 +19,4 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
self::$DI['client']->request('GET', '/admin/');
|
||||
$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));
|
||||
}
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@ class ApiJSONPTest extends ApiTestCase
|
||||
|
||||
protected function unserialize($data)
|
||||
{
|
||||
if (strpos($data, 'jsFunction(') !== 0) {
|
||||
if (strpos($data, 'jsFunction(') !== 4) {
|
||||
$this->fail('Invalid JSONP response');
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class ApiJSONPTest extends ApiTestCase
|
||||
$this->fail('Invalid JSONP response');
|
||||
}
|
||||
|
||||
return json_decode(substr($data, 11, -2), true);
|
||||
return json_decode(substr($data, 15, -2), true);
|
||||
}
|
||||
|
||||
protected function getAcceptMimeType()
|
||||
|
@@ -2156,7 +2156,7 @@ abstract class ApiTestCase extends \PhraseanetWebTestCase
|
||||
$this->assertArrayHasKey('response', $content);
|
||||
$this->assertTrue(is_array($content['meta']), 'Le bloc meta est un array');
|
||||
$this->assertTrue(is_array($content['response']), 'Le bloc reponse est un array');
|
||||
$this->assertEquals('1.3', $content['meta']['api_version']);
|
||||
$this->assertEquals('1.4.1', $content['meta']['api_version']);
|
||||
$this->assertNotNull($content['meta']['response_time']);
|
||||
$this->assertEquals('UTF-8', $content['meta']['charset']);
|
||||
}
|
||||
|
@@ -111,7 +111,7 @@ class ResultTest extends \PhraseanetAuthenticatedTestCase
|
||||
$return = $apiResult->createResponse()->getContent();
|
||||
$this->assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_STRING, $return);
|
||||
$this->assertRegexp("/my_callback_function\\(\\{.+\\}\\);/", $return);
|
||||
$response = json_decode(substr($return, 21, strlen($return) - 23), true);
|
||||
$response = json_decode(substr($return, 25, -2), true);
|
||||
$this->assertSame([], $response['response']);
|
||||
}
|
||||
|
||||
|
@@ -29,7 +29,6 @@ class QueryTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
self::$DI['client']->request('POST', $route);
|
||||
|
||||
$response = self::$DI['client']->getResponse();
|
||||
|
||||
$this->assertEquals('application/json', $response->headers->get('Content-type'));
|
||||
$data = json_decode($response->getContent(), true);
|
||||
$this->assertInternalType('array', $data);
|
||||
|
@@ -109,16 +109,6 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
$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
|
||||
*/
|
||||
|
@@ -24,7 +24,7 @@ class SetupTest extends \PhraseanetWebTestCase
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$client = $this->createClient();
|
||||
$crawler = $client->request('GET', '/setup/');
|
||||
$client->request('GET', '/setup/');
|
||||
$response = $client->getResponse();
|
||||
$this->assertEquals(302, $response->getStatusCode());
|
||||
$this->assertEquals('/setup/installer/', $response->headers->get('location'));
|
||||
@@ -150,7 +150,7 @@ class SetupTest extends \PhraseanetWebTestCase
|
||||
'hostname' => $host,
|
||||
'port' => $port,
|
||||
'user' => $user,
|
||||
'password' => $password,
|
||||
'db_password' => $password,
|
||||
'ab_name' => $abName,
|
||||
'db_name' => $dbName,
|
||||
'db_template' => 'en',
|
||||
@@ -189,4 +189,98 @@ class SetupTest extends \PhraseanetWebTestCase
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$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 \PhraseanetWebTestCase
|
||||
{
|
||||
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 \PhraseanetWebTestCase
|
||||
{
|
||||
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 \PhraseanetWebTestCase
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
@@ -52,7 +52,7 @@ class InstallerTest extends \PhraseanetTestCase
|
||||
'port' => 3306,
|
||||
'user' => $credentials['user'],
|
||||
'password' => $credentials['password'],
|
||||
'dbname' => 'ab_unitTests',
|
||||
'dbname' => 'ab_setup_test',
|
||||
]);
|
||||
$abConn->connect();
|
||||
$dbConn = self::$DI['app']['dbal.provider']->get([
|
||||
@@ -60,14 +60,14 @@ class InstallerTest extends \PhraseanetTestCase
|
||||
'port' => 3306,
|
||||
'user' => $credentials['user'],
|
||||
'password' => $credentials['password'],
|
||||
'dbname' => 'db_unitTests',
|
||||
'dbname' => 'db_setup_test',
|
||||
]);
|
||||
$dbConn->connect();
|
||||
|
||||
// empty databases
|
||||
$stmt = $abConn->prepare('DROP DATABASE ab_unitTests; CREATE DATABASE ab_unitTests');
|
||||
$stmt = $abConn->prepare('DROP DATABASE ab_setup_test; CREATE DATABASE ab_setup_test');
|
||||
$stmt->execute();
|
||||
$stmt = $abConn->prepare('DROP DATABASE db_unitTests; CREATE DATABASE db_unitTests');
|
||||
$stmt = $abConn->prepare('DROP DATABASE db_setup_test; CREATE DATABASE db_setup_test');
|
||||
$stmt->execute();
|
||||
unset($stmt);
|
||||
|
||||
@@ -81,7 +81,7 @@ class InstallerTest extends \PhraseanetTestCase
|
||||
|
||||
$databoxes = $app['phraseanet.appbox']->get_databoxes();
|
||||
$databox = array_pop($databoxes);
|
||||
$this->assertContains('<path>'.realpath($dataPath).'/db_unitTests/subdefs</path>', $databox->get_structure());
|
||||
$this->assertContains('<path>'.realpath($dataPath).'/db_setup_test/subdefs</path>', $databox->get_structure());
|
||||
|
||||
$conf = $app['configuration.store']->getConfig();
|
||||
$this->assertArrayHasKey('main', $conf);
|
||||
|
@@ -1,169 +0,0 @@
|
||||
main:
|
||||
servername: 'http://local.phrasea/'
|
||||
maintenance: false
|
||||
languages: []
|
||||
key: ''
|
||||
database:
|
||||
host: 'sql-host'
|
||||
port: 3306
|
||||
user: 'sql-user'
|
||||
password: 'sql-password'
|
||||
dbname: ab_phraseanet
|
||||
driver: pdo_mysql
|
||||
charset: UTF8
|
||||
database-test:
|
||||
driver: pdo_sqlite
|
||||
path: '/tmp/db.sqlite'
|
||||
charset: UTF8
|
||||
api-timers: false
|
||||
cache:
|
||||
type: ArrayCache
|
||||
options:
|
||||
options: []
|
||||
opcodecache:
|
||||
type: ArrayCache
|
||||
options: []
|
||||
search-engine:
|
||||
type: Alchemy\Phrasea\SearchEngine\Phrasea\PhraseaEngine
|
||||
options: []
|
||||
task-manager:
|
||||
enabled: true
|
||||
logger:
|
||||
max-files: 10
|
||||
enabled: true
|
||||
level: INFO
|
||||
trusted-proxies: []
|
||||
debugger:
|
||||
allowed-ips: ['192.168.56.1']
|
||||
binaries:
|
||||
ghostscript_binary: null
|
||||
php_binary: null
|
||||
swf_extract_binary: null
|
||||
pdf2swf_binary: null
|
||||
swf_render_binary: null
|
||||
unoconv_binary: null
|
||||
ffmpeg_binary: null
|
||||
ffprobe_binary: null
|
||||
mp4box_binary: null
|
||||
pdftotext_binary: null
|
||||
recess_binary: null
|
||||
phraseanet_indexer: null
|
||||
ffmpeg_timeout: 3600
|
||||
ffprobe_timeout: 60
|
||||
gs_timeout: 60
|
||||
mp4box_timeout: 60
|
||||
swftools_timeout: 60
|
||||
unoconv_timeout: 60
|
||||
border-manager:
|
||||
enabled: true
|
||||
extension-mapping: { }
|
||||
checkers:
|
||||
-
|
||||
type: Checker\Sha256
|
||||
enabled: true
|
||||
-
|
||||
type: Checker\UUID
|
||||
enabled: true
|
||||
-
|
||||
type: Checker\Colorspace
|
||||
enabled: false
|
||||
options:
|
||||
colorspaces: [cmyk, grayscale, rgb]
|
||||
-
|
||||
type: Checker\Dimension
|
||||
enabled: false
|
||||
options:
|
||||
width: 80
|
||||
height: 160
|
||||
-
|
||||
type: Checker\Extension
|
||||
enabled: false
|
||||
options:
|
||||
extensions: [jpg, jpeg, bmp, tif, gif, png, pdf, doc, odt, mpg, mpeg, mov, avi, xls, flv, mp3, mp2]
|
||||
-
|
||||
type: Checker\Filename
|
||||
enabled: false
|
||||
options:
|
||||
sensitive: true
|
||||
-
|
||||
type: Checker\MediaType
|
||||
enabled: false
|
||||
options:
|
||||
mediatypes: [Audio, Document, Flash, Image, Video]
|
||||
authentication:
|
||||
auto-create:
|
||||
templates: { }
|
||||
captcha:
|
||||
enabled: true
|
||||
trials-before-display: 9
|
||||
providers:
|
||||
facebook:
|
||||
enabled: false
|
||||
options:
|
||||
app-id: ''
|
||||
secret: ''
|
||||
twitter:
|
||||
enabled: false
|
||||
options:
|
||||
consumer-key: ''
|
||||
consumer-secret: ''
|
||||
google-plus:
|
||||
enabled: false
|
||||
options:
|
||||
client-id: ''
|
||||
client-secret: ''
|
||||
github:
|
||||
enabled: false
|
||||
options:
|
||||
client-id: ''
|
||||
client-secret: ''
|
||||
viadeo:
|
||||
enabled: false
|
||||
options:
|
||||
client-id: ''
|
||||
client-secret: ''
|
||||
linkedin:
|
||||
enabled: false
|
||||
options:
|
||||
client-id: ''
|
||||
client-secret: ''
|
||||
registration-fields:
|
||||
-
|
||||
name: company
|
||||
required: true
|
||||
-
|
||||
name: lastname
|
||||
required: true
|
||||
-
|
||||
name: firstname
|
||||
required: true
|
||||
-
|
||||
name: geonameid
|
||||
required: true
|
||||
xsendfile:
|
||||
enabled: false
|
||||
type: nginx
|
||||
mapping: []
|
||||
h264-pseudo-streaming:
|
||||
enabled: false
|
||||
type: nginx
|
||||
mapping: []
|
||||
plugins: []
|
||||
api_cors:
|
||||
enabled: false
|
||||
allow_credentials: false
|
||||
allow_origin: []
|
||||
allow_headers: []
|
||||
allow_methods: []
|
||||
expose_headers: []
|
||||
max_age: 0
|
||||
hosts: []
|
||||
session:
|
||||
idle: 0
|
||||
# 1 week
|
||||
lifetime: 604800
|
||||
crossdomain:
|
||||
allow-access-from:
|
||||
-
|
||||
domain: '*.cooliris.com'
|
||||
secure: 'false'
|
@@ -1,2 +0,0 @@
|
||||
!.gitignore
|
||||
!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) {
|
||||
var argv = EcrireCookie.arguments;
|
||||
var argc = EcrireCookie.arguments.length;
|
||||
|
@@ -381,7 +381,7 @@
|
||||
arrayValues.push(values[v].getValue());
|
||||
}
|
||||
|
||||
return arrayValues.join(' ' + this.databoxField.getSeparator() + ' ');
|
||||
return arrayValues.join(' ; ');
|
||||
},
|
||||
replaceValue: function (search, replace) {
|
||||
|
||||
|
Reference in New Issue
Block a user