This commit is contained in:
Nicolas Le Goff
2014-03-23 23:07:01 +01:00
parent e45d7edbc3
commit e317f86c51
34 changed files with 93 additions and 110 deletions

View File

@@ -46,14 +46,14 @@ class H264MappingGenerator extends Command
$factory = new H264Factory($this->container['monolog'], true, $type, $this->computeMapping($paths)); $factory = new H264Factory($this->container['monolog'], true, $type, $this->computeMapping($paths));
$mode = $factory->createMode(true); $mode = $factory->createMode(true);
$currentConf = isset($this->container['phraseanet.configuration']['h264-pseudo-streaming']) ? $this->container['phraseanet.configuration']['h264-pseudo-streaming'] : array(); $currentConf = isset($this->container['phraseanet.configuration']['h264-pseudo-streaming']) ? $this->container['phraseanet.configuration']['h264-pseudo-streaming'] : [];
$currentMapping = (isset($currentConf['mapping']) && is_array($currentConf['mapping'])) ? $currentConf['mapping'] : array(); $currentMapping = (isset($currentConf['mapping']) && is_array($currentConf['mapping'])) ? $currentConf['mapping'] : [];
$conf = array( $conf = [
'enabled' => $enabled, 'enabled' => $enabled,
'type' => $type, 'type' => $type,
'mapping' => array_replace_recursive($mode->getMapping(), $currentMapping), 'mapping' => array_replace_recursive($mode->getMapping(), $currentMapping),
); ];
if ($input->getOption('write')) { if ($input->getOption('write')) {
$output->write("Writing configuration ..."); $output->write("Writing configuration ...");
@@ -64,7 +64,7 @@ class H264MappingGenerator extends Command
} else { } else {
$output->writeln("Configuration will <info>not</info> be written, use <info>--write</info> option to write it"); $output->writeln("Configuration will <info>not</info> be written, use <info>--write</info> option to write it");
$output->writeln(""); $output->writeln("");
$output->writeln(Yaml::dump(array('h264-pseudo-streaming' => $conf), 4)); $output->writeln(Yaml::dump(['h264-pseudo-streaming' => $conf], 4));
} }
return 0; return 0;
@@ -74,7 +74,7 @@ class H264MappingGenerator extends Command
{ {
$paths = array_unique($paths); $paths = array_unique($paths);
$ret = array(); $ret = [];
foreach ($paths as $path) { foreach ($paths as $path) {
$ret[$path] = $this->pathsToConf($path); $ret[$path] = $this->pathsToConf($path);
@@ -88,12 +88,12 @@ class H264MappingGenerator extends Command
static $n = 0; static $n = 0;
$n++; $n++;
return array('mount-point' => 'mp4-videos-'.$n, 'directory' => $path, 'passphrase' => \random::generatePassword(32)); return ['mount-point' => 'mp4-videos-'.$n, 'directory' => $path, 'passphrase' => \random::generatePassword(32)];
} }
private function extractPath(\appbox $appbox) private function extractPath(\appbox $appbox)
{ {
$paths = array(); $paths = [];
foreach ($appbox->get_databoxes() as $databox) { foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_subdef_structure() as $group => $subdefs) { foreach ($databox->get_subdef_structure() as $group => $subdefs) {

View File

@@ -14,7 +14,6 @@ namespace Alchemy\Phrasea\Controller\Admin;
use Alchemy\Phrasea\Exception\InvalidArgumentException; use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Alchemy\Phrasea\Form\TaskForm; use Alchemy\Phrasea\Form\TaskForm;
use Alchemy\Phrasea\Model\Entities\Task; use Alchemy\Phrasea\Model\Entities\Task;
use Alchemy\Phrasea\TaskManager\TaskManagerStatus;
use Silex\Application; use Silex\Application;
use Silex\ControllerProviderInterface; use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;

View File

@@ -36,7 +36,6 @@ use Alchemy\Phrasea\Model\Entities\FeedItem;
use Alchemy\Phrasea\Model\Entities\LazaretFile; use Alchemy\Phrasea\Model\Entities\LazaretFile;
use Alchemy\Phrasea\Model\Entities\Task; use Alchemy\Phrasea\Model\Entities\Task;
use Alchemy\Phrasea\Model\Entities\User; use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\Entities\UserQuery;
use Alchemy\Phrasea\Model\Entities\ValidationData; use Alchemy\Phrasea\Model\Entities\ValidationData;
use Silex\Application; use Silex\Application;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -2093,7 +2092,7 @@ class V1 implements ControllerProviderInterface
break; break;
} }
return array( return [
'@entity@' => self::OBJECT_TYPE_USER, '@entity@' => self::OBJECT_TYPE_USER,
'id' => $user->getId(), 'id' => $user->getId(),
'email' => $user->getEmail() ?: null, 'email' => $user->getEmail() ?: null,
@@ -2116,7 +2115,7 @@ class V1 implements ControllerProviderInterface
'created_on' => $user->getCreated() ? $user->getCreated()->format(DATE_ATOM) : null, 'created_on' => $user->getCreated() ? $user->getCreated()->format(DATE_ATOM) : null,
'updated_on' => $user->getUpdated() ? $user->getUpdated()->format(DATE_ATOM) : null, 'updated_on' => $user->getUpdated() ? $user->getUpdated()->format(DATE_ATOM) : null,
'locale' => $user->getLocale() ?: null, 'locale' => $user->getLocale() ?: null,
); ];
} }
private function logout(Application $app) private function logout(Application $app)

View File

@@ -14,7 +14,6 @@ namespace Alchemy\Phrasea\Controller\Client;
use Alchemy\Phrasea\Feed\Aggregate; use Alchemy\Phrasea\Feed\Aggregate;
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions; use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
use Alchemy\Phrasea\Exception\SessionNotFound; use Alchemy\Phrasea\Exception\SessionNotFound;
use Alchemy\Phrasea\Model\Entities\UserQuery;
use Silex\Application; use Silex\Application;
use Silex\ControllerProviderInterface; use Silex\ControllerProviderInterface;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;

View File

@@ -20,7 +20,6 @@ use Silex\ControllerProviderInterface;
use Silex\Application as SilexApplication; use Silex\Application as SilexApplication;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class Lightbox implements ControllerProviderInterface class Lightbox implements ControllerProviderInterface
{ {

View File

@@ -17,7 +17,6 @@ use Silex\Application;
use Silex\ControllerProviderInterface; use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Event\PostResponseEvent; use Symfony\Component\HttpKernel\Event\PostResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelEvents;

View File

@@ -82,29 +82,29 @@ class Root implements ControllerProviderInterface
$dashboard->execute(); $dashboard->execute();
return $app->json(array('html' => $app['twig']->render('report/ajax_dashboard_content_child.html.twig', array( return $app->json(['html' => $app['twig']->render('report/ajax_dashboard_content_child.html.twig', [
'dashboard' => $dashboard 'dashboard' => $dashboard
)))); ])]);
} }
$granted = array(); $granted = [];
foreach($app['acl']->get($app['authentication']->getUser())->get_granted_base(array('canreport')) as $collection) { foreach ($app['acl']->get($app['authentication']->getUser())->get_granted_base(['canreport']) as $collection) {
if (!isset($granted[$collection->get_sbas_id()])) { if (!isset($granted[$collection->get_sbas_id()])) {
$granted[$collection->get_sbas_id()] = array( $granted[$collection->get_sbas_id()] = [
'id' => $collection->get_sbas_id(), 'id' => $collection->get_sbas_id(),
'name' => $collection->get_databox()->get_viewname(), 'name' => $collection->get_databox()->get_viewname(),
'collections' => array() 'collections' => []
); ];
} }
$granted[$collection->get_sbas_id()]['collections'][] = array( $granted[$collection->get_sbas_id()]['collections'][] = [
'id' => $collection->get_coll_id(), 'id' => $collection->get_coll_id(),
'base_id' => $collection->get_base_id(), 'base_id' => $collection->get_base_id(),
'name' => $collection->get_name() 'name' => $collection->get_name()
); ];
} }
return $app['twig']->render('report/report_layout_child.html.twig', array( return $app['twig']->render('report/report_layout_child.html.twig', [
'ajax_dash' => true, 'ajax_dash' => true,
'dashboard' => null, 'dashboard' => null,
'granted_bases' => $granted, 'granted_bases' => $granted,
@@ -115,7 +115,7 @@ class Root implements ControllerProviderInterface
'g_anal' => $app['conf']->get(['registry', 'general', 'analytics']), 'g_anal' => $app['conf']->get(['registry', 'general', 'analytics']),
'ajax' => false, 'ajax' => false,
'ajax_chart' => false 'ajax_chart' => false
)); ]);
} }
/** /**

View File

@@ -411,7 +411,7 @@ class Xmlhttp implements ControllerProviderInterface
$data = []; $data = [];
foreach ($app['repo.presets']->findBy(['user' => $user, 'sbasId' => $sbasId], ['creadted' => 'asc']) as $preset) { foreach ($app['repo.presets']->findBy(['user' => $user, 'sbasId' => $sbasId], ['creadted' => 'asc']) as $preset) {
$presetData = $fields = []; $presetData = $fields = [];
array_walk($preset->getData(), function($field) use ($fields) { array_walk($preset->getData(), function ($field) use ($fields) {
$fields[$field['name']][] = $field['value']; $fields[$field['name']][] = $field['value'];
}); });
$presetData['id'] = $preset->getId(); $presetData['id'] = $preset->getId();
@@ -420,6 +420,7 @@ class Xmlhttp implements ControllerProviderInterface
$data[] = $presetData; $data[] = $presetData;
} }
return $app['twig']->render('thesaurus/presets.html.twig', ['presets' => $data]); return $app['twig']->render('thesaurus/presets.html.twig', ['presets' => $data]);
} }

View File

@@ -31,7 +31,7 @@ class ReconnectableConnection implements ConnectionInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function prepare($prepareString) public function prepare($prepareString)
{ {
return $this->tryMethod(__FUNCTION__, func_get_args()); return $this->tryMethod(__FUNCTION__, func_get_args());
} }
@@ -39,7 +39,7 @@ class ReconnectableConnection implements ConnectionInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function query() public function query()
{ {
return $this->tryMethod(__FUNCTION__, func_get_args()); return $this->tryMethod(__FUNCTION__, func_get_args());
} }
@@ -47,7 +47,7 @@ class ReconnectableConnection implements ConnectionInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function quote($input, $type=\PDO::PARAM_STR) public function quote($input, $type=\PDO::PARAM_STR)
{ {
return $this->tryMethod(__FUNCTION__, func_get_args()); return $this->tryMethod(__FUNCTION__, func_get_args());
} }
@@ -55,7 +55,7 @@ class ReconnectableConnection implements ConnectionInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function exec($statement) public function exec($statement)
{ {
return $this->tryMethod(__FUNCTION__, func_get_args()); return $this->tryMethod(__FUNCTION__, func_get_args());
} }
@@ -63,7 +63,7 @@ class ReconnectableConnection implements ConnectionInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function lastInsertId($name = null) public function lastInsertId($name = null)
{ {
return $this->tryMethod(__FUNCTION__, func_get_args()); return $this->tryMethod(__FUNCTION__, func_get_args());
} }
@@ -71,7 +71,7 @@ class ReconnectableConnection implements ConnectionInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function beginTransaction() public function beginTransaction()
{ {
return $this->tryMethod(__FUNCTION__, func_get_args()); return $this->tryMethod(__FUNCTION__, func_get_args());
} }
@@ -79,7 +79,7 @@ class ReconnectableConnection implements ConnectionInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function commit() public function commit()
{ {
return $this->tryMethod(__FUNCTION__, func_get_args()); return $this->tryMethod(__FUNCTION__, func_get_args());
} }
@@ -87,7 +87,7 @@ class ReconnectableConnection implements ConnectionInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function rollBack() public function rollBack()
{ {
return $this->tryMethod(__FUNCTION__, func_get_args()); return $this->tryMethod(__FUNCTION__, func_get_args());
} }
@@ -95,7 +95,7 @@ class ReconnectableConnection implements ConnectionInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function errorCode() public function errorCode()
{ {
return $this->tryMethod(__FUNCTION__, func_get_args()); return $this->tryMethod(__FUNCTION__, func_get_args());
} }
@@ -103,7 +103,7 @@ class ReconnectableConnection implements ConnectionInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
function errorInfo() public function errorInfo()
{ {
return $this->tryMethod(__FUNCTION__, func_get_args()); return $this->tryMethod(__FUNCTION__, func_get_args());
} }

View File

@@ -23,7 +23,6 @@ use Alchemy\Phrasea\Authentication\Phrasea\NativeAuthentication;
use Alchemy\Phrasea\Authentication\Phrasea\OldPasswordEncoder; use Alchemy\Phrasea\Authentication\Phrasea\OldPasswordEncoder;
use Alchemy\Phrasea\Authentication\Phrasea\PasswordEncoder; use Alchemy\Phrasea\Authentication\Phrasea\PasswordEncoder;
use Alchemy\Phrasea\Authentication\SuggestionFinder; use Alchemy\Phrasea\Authentication\SuggestionFinder;
use Alchemy\Phrasea\Authentication\Token\TokenValidator;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Alchemy\Phrasea\Core\Event\Subscriber\PersistentCookieSubscriber; use Alchemy\Phrasea\Core\Event\Subscriber\PersistentCookieSubscriber;

View File

@@ -15,7 +15,6 @@ use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Model\Manipulator\TokenManipulator; use Alchemy\Phrasea\Model\Manipulator\TokenManipulator;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class PasswordToken extends Constraint class PasswordToken extends Constraint
{ {

View File

@@ -24,7 +24,7 @@ class Apache extends AbstractServerMode implements H264Interface
*/ */
public function setMapping(array $mapping) public function setMapping(array $mapping)
{ {
$final = array(); $final = [];
foreach ($mapping as $key => $entry) { foreach ($mapping as $key => $entry) {
if (!is_array($entry)) { if (!is_array($entry)) {
@@ -47,11 +47,11 @@ class Apache extends AbstractServerMode implements H264Interface
continue; continue;
} }
$final[$key] = array( $final[$key] = [
'directory' => $this->sanitizePath(realpath($entry['directory'])), 'directory' => $this->sanitizePath(realpath($entry['directory'])),
'mount-point' => $this->sanitizeMountPoint($entry['mount-point']), 'mount-point' => $this->sanitizeMountPoint($entry['mount-point']),
'passphrase' => trim($entry['passphrase']), 'passphrase' => trim($entry['passphrase']),
); ];
} }
$this->mapping = $final; $this->mapping = $final;

View File

@@ -70,7 +70,7 @@ class H264Factory
/** /**
* Creates a new instance of H264 Factory given a configuration. * Creates a new instance of H264 Factory given a configuration.
* *
* @param Application $app * @param Application $app
* *
* @return H264Factory * @return H264Factory
*/ */
@@ -78,7 +78,7 @@ class H264Factory
{ {
$conf = $app['phraseanet.configuration']['h264-pseudo-streaming']; $conf = $app['phraseanet.configuration']['h264-pseudo-streaming'];
$mapping = array(); $mapping = [];
if (isset($conf['mapping'])) { if (isset($conf['mapping'])) {
$mapping = $conf['mapping']; $mapping = $conf['mapping'];

View File

@@ -24,7 +24,7 @@ class Nginx extends AbstractServerMode implements H264Interface
*/ */
public function setMapping(array $mapping) public function setMapping(array $mapping)
{ {
$final = array(); $final = [];
foreach ($mapping as $key => $entry) { foreach ($mapping as $key => $entry) {
if (!is_array($entry)) { if (!is_array($entry)) {
@@ -47,11 +47,11 @@ class Nginx extends AbstractServerMode implements H264Interface
continue; continue;
} }
$final[$key] = array( $final[$key] = [
'directory' => $this->sanitizePath(realpath($entry['directory'])), 'directory' => $this->sanitizePath(realpath($entry['directory'])),
'mount-point' => $this->sanitizeMountPoint($entry['mount-point']), 'mount-point' => $this->sanitizeMountPoint($entry['mount-point']),
'passphrase' => trim($entry['passphrase']), 'passphrase' => trim($entry['passphrase']),
); ];
} }
$this->mapping = $final; $this->mapping = $final;
@@ -107,7 +107,7 @@ class Nginx extends AbstractServerMode implements H264Interface
$path = $entry['mount-point'].substr($pathfile, strlen($entry['directory'])); $path = $entry['mount-point'].substr($pathfile, strlen($entry['directory']));
$expire = time() + 3600; // At which point in time the file should expire. time() + x; would be the usual usage. $expire = time() + 3600; // At which point in time the file should expire. time() + x; would be the usual usage.
$hash = str_replace(array('+', '/', '='), array('-', '_', ''), base64_encode(md5($expire.$path.' '.$entry['passphrase'], true))); $hash = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode(md5($expire.$path.' '.$entry['passphrase'], true)));
return Url::factory($path.'?hash='.$hash.'&expires='.$expire); return Url::factory($path.'?hash='.$hash.'&expires='.$expire);
} }

View File

@@ -62,7 +62,7 @@ class Token
/** /**
* Set value * Set value
* *
* @param string $value * @param string $value
* @return Token * @return Token
*/ */
public function setValue($value) public function setValue($value)
@@ -85,7 +85,7 @@ class Token
/** /**
* Set type * Set type
* *
* @param string $type * @param string $type
* @return Token * @return Token
*/ */
public function setType($type) public function setType($type)
@@ -108,7 +108,7 @@ class Token
/** /**
* Set data * Set data
* *
* @param string $data * @param string $data
* @return Token * @return Token
*/ */
public function setData($data) public function setData($data)
@@ -131,7 +131,7 @@ class Token
/** /**
* Set created * Set created
* *
* @param \DateTime $created * @param \DateTime $created
* @return Token * @return Token
*/ */
public function setCreated($created) public function setCreated($created)
@@ -154,7 +154,7 @@ class Token
/** /**
* Set updated * Set updated
* *
* @param \DateTime $updated * @param \DateTime $updated
* @return Token * @return Token
*/ */
public function setUpdated($updated) public function setUpdated($updated)
@@ -177,7 +177,7 @@ class Token
/** /**
* Set expiration * Set expiration
* *
* @param \DateTime $updated * @param \DateTime $updated
* @return Token * @return Token
*/ */
public function setExpiration(\DateTime $expiration = null) public function setExpiration(\DateTime $expiration = null)
@@ -200,7 +200,7 @@ class Token
/** /**
* Set user * Set user
* *
* @param User $user * @param User $user
* @return Token * @return Token
*/ */
public function setUser(User $user = null) public function setUser(User $user = null)

View File

@@ -17,7 +17,6 @@ use Alchemy\Phrasea\Model\Entities\Token;
use Alchemy\Phrasea\Model\Entities\User; use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\Repositories\TokenRepository; use Alchemy\Phrasea\Model\Repositories\TokenRepository;
use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Query;
use RandomLib\Generator; use RandomLib\Generator;
class TokenManipulator implements ManipulatorInterface class TokenManipulator implements ManipulatorInterface
@@ -48,10 +47,10 @@ class TokenManipulator implements ManipulatorInterface
} }
/** /**
* @param User|null $user * @param User|null $user
* @param string $type * @param string $type
* @param \DateTime|null $expiration * @param \DateTime|null $expiration
* @param mixed|null $data * @param mixed|null $data
* *
* @return Token * @return Token
*/ */
@@ -84,7 +83,7 @@ class TokenManipulator implements ManipulatorInterface
/** /**
* @param Basket $basket * @param Basket $basket
* @param User $user * @param User $user
* *
* @return Token * @return Token
*/ */
@@ -99,7 +98,7 @@ class TokenManipulator implements ManipulatorInterface
/** /**
* @param Basket $basket * @param Basket $basket
* @param User $user * @param User $user
* *
* @return Token * @return Token
*/ */
@@ -109,7 +108,7 @@ class TokenManipulator implements ManipulatorInterface
} }
/** /**
* @param User $user * @param User $user
* @param FeedEntry $entry * @param FeedEntry $entry
* *
* @return Token * @return Token

View File

@@ -4,7 +4,6 @@ namespace Alchemy\Phrasea\Model\Repositories;
use Alchemy\Phrasea\Model\Entities\Basket; use Alchemy\Phrasea\Model\Entities\Basket;
use Alchemy\Phrasea\Model\Entities\User; use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\Entities\ValidationParticipant;
use Alchemy\Phrasea\Model\Manipulator\TokenManipulator; use Alchemy\Phrasea\Model\Manipulator\TokenManipulator;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Types; namespace Alchemy\Phrasea\Model\Types;
use Alchemy\Phrasea\Exception\RuntimeException;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;

View File

@@ -19,7 +19,7 @@ class TokenMigration extends AbstractMigration
{ {
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");
$this->addSql("CREATE TABLE Tokens (value VARCHAR(16) NOT NULL, user_id INT DEFAULT NULL, type VARCHAR(32) NOT NULL, data LONGTEXT DEFAULT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, expiration DATETIME DEFAULT NULL, INDEX IDX_ADF614B8A76ED395 (user_id), PRIMARY KEY(value)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE Tokens (value VARCHAR(16) NOT NULL, user_id INT DEFAULT NULL, type VARCHAR(32) NOT NULL, data LONGTEXT DEFAULT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, expiration DATETIME DEFAULT NULL, INDEX IDX_ADF614B8A76ED395 (user_id), PRIMARY KEY(value)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$this->addSql("ALTER TABLE Tokens ADD CONSTRAINT FK_ADF614B8A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)"); $this->addSql("ALTER TABLE Tokens ADD CONSTRAINT FK_ADF614B8A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
} }
@@ -28,7 +28,7 @@ class TokenMigration extends AbstractMigration
{ {
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");
$this->addSql("DROP TABLE Tokens"); $this->addSql("DROP TABLE Tokens");
} }
} }

View File

@@ -12,11 +12,8 @@
namespace Alchemy\Phrasea\Setup\Version\PreSchemaUpgrade; namespace Alchemy\Phrasea\Setup\Version\PreSchemaUpgrade;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\Entities\FtpCredential;
use Doctrine\DBAL\Migrations\Configuration\Configuration; use Doctrine\DBAL\Migrations\Configuration\Configuration;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Doctrine\ORM\NoResultException;
use Doctrine\ORM\Query; use Doctrine\ORM\Query;
use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\ORM\Query\ResultSetMapping;

View File

@@ -17,7 +17,7 @@ class patch_384alpha1a implements patchInterface
private $release = '3.8.4-alpha.1'; private $release = '3.8.4-alpha.1';
/** @var array */ /** @var array */
private $concern = array(base::APPLICATION_BOX); private $concern = [base::APPLICATION_BOX];
/** /**
* {@inheritdoc} * {@inheritdoc}
@@ -58,11 +58,11 @@ class patch_384alpha1a implements patchInterface
{ {
$config = $app['phraseanet.configuration']->getConfig(); $config = $app['phraseanet.configuration']->getConfig();
$config['h264-pseudo-streaming'] = array( $config['h264-pseudo-streaming'] = [
'enabled' => false, 'enabled' => false,
'type' => null, 'type' => null,
'mapping' => array(), 'mapping' => [],
); ];
$app['phraseanet.configuration']->setConfig($config); $app['phraseanet.configuration']->setConfig($config);

View File

@@ -10,8 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Model\Entities\Preset;
use Gedmo\Timestampable\TimestampableListener;
class patch_390alpha18a extends patchAbstract class patch_390alpha18a extends patchAbstract
{ {

View File

@@ -16,7 +16,6 @@ use Doctrine\ORM\Query;
use Doctrine\ORM\NoResultException; use Doctrine\ORM\NoResultException;
use Gedmo\Timestampable\TimestampableListener; use Gedmo\Timestampable\TimestampableListener;
class patch_390alpha1a extends patchAbstract class patch_390alpha1a extends patchAbstract
{ {
/** @var string */ /** @var string */

View File

@@ -25,6 +25,7 @@ class DataboxTest extends \PhraseanetAuthenticatedWebTestCase
{ {
if (!self::$createdCollections) { if (!self::$createdCollections) {
parent::tearDown(); parent::tearDown();
return; return;
} }

View File

@@ -8,7 +8,6 @@ use Alchemy\Phrasea\Controller\Api\V1;
use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Authentication\Context; use Alchemy\Phrasea\Authentication\Context;
use Alchemy\Phrasea\Model\Entities\Task; use Alchemy\Phrasea\Model\Entities\Task;
use Alchemy\Phrasea\Model\Entities\LazaretSession;
use Alchemy\Phrasea\Model\Entities\User; use Alchemy\Phrasea\Model\Entities\User;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Guzzle\Common\Exception\GuzzleException; use Guzzle\Common\Exception\GuzzleException;
@@ -1783,9 +1782,9 @@ abstract class ApiTestCase extends \PhraseanetWebTestCase
$route = '/api/v1/me/'; $route = '/api/v1/me/';
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE')); $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType())); self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent()); $content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->assertArrayHasKey('user', $content['response']); $this->assertArrayHasKey('user', $content['response']);
@@ -1795,7 +1794,7 @@ abstract class ApiTestCase extends \PhraseanetWebTestCase
protected function evaluateGoodUserItem($data, User $user) protected function evaluateGoodUserItem($data, User $user)
{ {
foreach (array( foreach ([
'@entity@' => V1::OBJECT_TYPE_USER, '@entity@' => V1::OBJECT_TYPE_USER,
'id' => $user->getId(), 'id' => $user->getId(),
'email' => $user->getEmail() ?: null, 'email' => $user->getEmail() ?: null,
@@ -1817,7 +1816,7 @@ abstract class ApiTestCase extends \PhraseanetWebTestCase
'created_on' => $user->getCreated() ? $user->getCreated()->format(DATE_ATOM) : null, 'created_on' => $user->getCreated() ? $user->getCreated()->format(DATE_ATOM) : null,
'updated_on' => $user->getUpdated() ? $user->getUpdated()->format(DATE_ATOM) : null, 'updated_on' => $user->getUpdated() ? $user->getUpdated()->format(DATE_ATOM) : null,
'locale' => $user->getLocale() ?: null, 'locale' => $user->getLocale() ?: null,
) as $key => $value) { ] as $key => $value) {
$this->assertArrayHasKey($key, $data, 'Assert key is present '.$key); $this->assertArrayHasKey($key, $data, 'Assert key is present '.$key);
if ($value) { if ($value) {
$this->assertEquals($value, $data[$key], 'Check key '.$key); $this->assertEquals($value, $data[$key], 'Check key '.$key);

View File

@@ -28,10 +28,10 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
{ {
$this->authenticate(self::$DI['app']); $this->authenticate(self::$DI['app']);
$this->XMLHTTPRequest('GET', '/report/dashboard', array( $this->XMLHTTPRequest('GET', '/report/dashboard', [
'dmin' => $this->dmin->format('Y-m-d'), 'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmin->format('Y-m-d'), 'dmax' => $this->dmin->format('Y-m-d'),
)); ]);
$response = self::$DI['client']->getResponse(); $response = self::$DI['client']->getResponse();

View File

@@ -6,7 +6,6 @@ use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Model\Entities\Registration; use Alchemy\Phrasea\Model\Entities\Registration;
use Alchemy\Phrasea\Model\Entities\User; use Alchemy\Phrasea\Model\Entities\User;
use RandomLib\Factory; use RandomLib\Factory;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class AccountTest extends \PhraseanetAuthenticatedWebTestCase class AccountTest extends \PhraseanetAuthenticatedWebTestCase
{ {

View File

@@ -14,4 +14,4 @@ class ConnectionProviderTest extends \PhraseanetTestCase
usleep(1200000); usleep(1200000);
$conn->exec('SHOW DATABASES'); $conn->exec('SHOW DATABASES');
} }
} }

View File

@@ -5,7 +5,6 @@ namespace Alchemy\Tests\Phrasea\Form\Constraint;
use Alchemy\Phrasea\Form\Constraint\PasswordToken; use Alchemy\Phrasea\Form\Constraint\PasswordToken;
use Alchemy\Phrasea\Model\Entities\Token; use Alchemy\Phrasea\Model\Entities\Token;
use Alchemy\Phrasea\Model\Manipulator\TokenManipulator; use Alchemy\Phrasea\Model\Manipulator\TokenManipulator;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class PasswordTokenTest extends \PhraseanetTestCase class PasswordTokenTest extends \PhraseanetTestCase
{ {

View File

@@ -31,16 +31,16 @@ class ApacheTest extends \PhraseanetTestCase
touch($file); touch($file);
} }
$mapping = array(array( $mapping = [[
'directory' => $dir, 'directory' => $dir,
'mount-point' => 'mp4-videos', 'mount-point' => 'mp4-videos',
'passphrase' => '123456', 'passphrase' => '123456',
)); ]];
return array( return [
array(array(), null, '/path/to/file'), [[], null, '/path/to/file'],
array($mapping, null, '/path/to/file'), [$mapping, null, '/path/to/file'],
array($mapping, '/^\/mp4-videos\/[a-zA-Z0-9]+\/[0-9a-f]+\/to\/file$/', $file), [$mapping, '/^\/mp4-videos\/[a-zA-Z0-9]+\/[0-9a-f]+\/to\/file$/', $file],
); ];
} }
} }

View File

@@ -66,19 +66,19 @@ class H264FactoryTest extends \PhraseanetTestCase
public function provideTypes() public function provideTypes()
{ {
return array( return [
array('nginx', $this->getNginxMapping(), 'Alchemy\Phrasea\Http\H264PseudoStreaming\Nginx'), ['nginx', $this->getNginxMapping(), 'Alchemy\Phrasea\Http\H264PseudoStreaming\Nginx'],
array('apache', $this->getNginxMapping(), 'Alchemy\Phrasea\Http\H264PseudoStreaming\Apache'), ['apache', $this->getNginxMapping(), 'Alchemy\Phrasea\Http\H264PseudoStreaming\Apache'],
array('apache2', $this->getNginxMapping(), 'Alchemy\Phrasea\Http\H264PseudoStreaming\Apache'), ['apache2', $this->getNginxMapping(), 'Alchemy\Phrasea\Http\H264PseudoStreaming\Apache'],
); ];
} }
private function getNginxMapping() private function getNginxMapping()
{ {
return array(array( return [[
'directory' => __DIR__ . '/../../../../files/', 'directory' => __DIR__ . '/../../../../files/',
'mount-point' => '/protected/', 'mount-point' => '/protected/',
'passphrase' => 'dfdskqhfsfilddsmfmqsdmlfomqs', 'passphrase' => 'dfdskqhfsfilddsmfmqsdmlfomqs',
)); ]];
} }
} }

View File

@@ -31,16 +31,16 @@ class NginxTest extends \PhraseanetTestCase
touch($file); touch($file);
} }
$mapping = array(array( $mapping = [[
'directory' => $dir, 'directory' => $dir,
'mount-point' => 'mp4-videos', 'mount-point' => 'mp4-videos',
'passphrase' => '123456', 'passphrase' => '123456',
)); ]];
return array( return [
array(array(), null, '/path/to/file'), [[], null, '/path/to/file'],
array($mapping, null, '/path/to/file'), [$mapping, null, '/path/to/file'],
array($mapping, '/^\/mp4-videos\/to\/file\?hash=[a-zA-Z0-9-_+]+&expires=[0-9]+/', $file), [$mapping, '/^\/mp4-videos\/to\/file\?hash=[a-zA-Z0-9-_+]+&expires=[0-9]+/', $file],
); ];
} }
} }

View File

@@ -88,7 +88,7 @@ class TokenManipulatorTest extends \PhraseanetTestCase
public function testCreateDownloadToken() public function testCreateDownloadToken()
{ {
$data = serialize(array('some' => 'data')); $data = serialize(['some' => 'data']);
$manipulator = new TokenManipulator(self::$DI['app']['EM'], self::$DI['app']['random.low'], self::$DI['app']['repo.tokens']); $manipulator = new TokenManipulator(self::$DI['app']['EM'], self::$DI['app']['random.low'], self::$DI['app']['repo.tokens']);
$token = $manipulator->createDownloadToken(self::$DI['user'], $data); $token = $manipulator->createDownloadToken(self::$DI['user'], $data);
@@ -100,7 +100,7 @@ class TokenManipulatorTest extends \PhraseanetTestCase
public function testCreateEmailExportToken() public function testCreateEmailExportToken()
{ {
$data = serialize(array('some' => 'data')); $data = serialize(['some' => 'data']);
$manipulator = new TokenManipulator(self::$DI['app']['EM'], self::$DI['app']['random.low'], self::$DI['app']['repo.tokens']); $manipulator = new TokenManipulator(self::$DI['app']['EM'], self::$DI['app']['random.low'], self::$DI['app']['repo.tokens']);
$token = $manipulator->createEmailExportToken($data); $token = $manipulator->createEmailExportToken($data);

View File

@@ -80,7 +80,7 @@ abstract class PhraseanetTestCase extends WebTestCase
ini_set('memory_limit', '4096M'); ini_set('memory_limit', '4096M');
error_reporting(-1); error_reporting(-1);
\PHPUnit_Framework_Error_Warning::$enabled = true; \PHPUnit_Framework_Error_Warning::$enabled = true;
\PHPUnit_Framework_Error_Notice::$enabled = true; \PHPUnit_Framework_Error_Notice::$enabled = true;