Merge branch '3.8'

Conflicts:
	.gitignore
	bin/console
	composer.json
	composer.lock
	hudson/fixtures.sql
	lib/Alchemy/Phrasea/Command/Developer/IniReset.php
	lib/Alchemy/Phrasea/Command/Setup/Install.php
	lib/Alchemy/Phrasea/Controller/Api/Oauth2.php
	lib/Alchemy/Phrasea/Controller/Api/V1.php
	lib/Alchemy/Phrasea/Controller/Prod/Export.php
	lib/Alchemy/Phrasea/Controller/Root/Login.php
	lib/Alchemy/Phrasea/Core/Provider/PhraseanetServiceProvider.php
	lib/Alchemy/Phrasea/Core/Version.php
	lib/Alchemy/Phrasea/Helper/DatabaseHelper.php
	lib/Alchemy/Phrasea/Helper/Prod.php
	lib/classes/API/OAuth2/Application.php
	lib/classes/API/V1/Interface.php
	lib/classes/API/V1/adapter.php
	lib/classes/Setup/Upgrade.php
	lib/classes/media/subdef.php
	lib/classes/task/period/RecordMover.php
	templates/web/prod/index.html.twig
	templates/web/setup/step2.html.twig
	tests/Alchemy/Tests/Phrasea/Controller/Admin/RootTest.php
	tests/Alchemy/Tests/Phrasea/Controller/Root/LoginTest.php
	tests/classes/api/v1/api_v1_adapterTest.php
	tests/db-ref.sqlite
	vagrant/vms/phraseanet-php54-nginx/puphpet/config.yaml
	vagrant/vms/phraseanet-php54-nginx/puphpet/files/exec-once/setup
This commit is contained in:
Nicolas Le Goff
2014-10-09 19:40:33 +02:00
51 changed files with 2138 additions and 1147 deletions

View File

@@ -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;
}
@@ -603,7 +619,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)

View File

@@ -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));
}
/**

View File

@@ -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;
@@ -737,10 +741,18 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
*/
protected function generate_url()
{
if ( ! $this->is_physically_present()) {
if (!$this->is_physically_present()) {
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;
@@ -753,6 +765,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
. "/" . $this->record->get_record_id() . "/"
. $this->get_name() . "/");
return;
}

View File

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

View File

@@ -0,0 +1,65 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
class patch_386alpha3a implements patchInterface
{
/** @var string */
private $release = '3.8.6-alpha.3';
/** @var array */
private $concern = array(base::APPLICATION_BOX);
/**
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return false;
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$config = $app['phraseanet.configuration']->getConfig();
$config['static-file'] = array(
'enabled' => false,
'type' => '',
'symlink-directory' => '',
);
$app['phraseanet.configuration']->setConfig($config);
return true;
}
}

View File

@@ -1120,7 +1120,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]);
@@ -1440,6 +1440,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))

View File

@@ -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;
}