mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 13:03:20 +00:00
Merge branch '3.8'
Conflicts: .travis.yml lib/Alchemy/Phrasea/Controller/Permalink.php lib/classes/API/OAuth2/Adapter.php lib/classes/databox.php
This commit is contained in:
10
.travis.yml
10
.travis.yml
@@ -12,8 +12,8 @@ services:
|
|||||||
before_script:
|
before_script:
|
||||||
- node --version
|
- node --version
|
||||||
- npm --version
|
- npm --version
|
||||||
- npm install
|
- travis_retry npm install
|
||||||
- npm install grunt-cli jake -g
|
- travis_retry npm install grunt-cli jake -g
|
||||||
- echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
|
- echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
|
||||||
- sh -c 'if [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
|
- sh -c 'if [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
|
||||||
- echo 'extension="redis.so"' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/redis.ini
|
- echo 'extension="redis.so"' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/redis.ini
|
||||||
@@ -21,8 +21,8 @@ before_script:
|
|||||||
- echo 'extension="memcached.so"' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/memcached.ini
|
- echo 'extension="memcached.so"' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/memcached.ini
|
||||||
- yes | pecl install zmq-beta
|
- yes | pecl install zmq-beta
|
||||||
- yes | pecl install imagick
|
- yes | pecl install imagick
|
||||||
- composer self-update
|
- travis_retry composer self-update
|
||||||
- composer install --dev --prefer-source
|
- travis_retry composer install --dev --prefer-source
|
||||||
- wget http://sphinxsearch.com/files/sphinx-2.0.6-release.tar.gz
|
- wget http://sphinxsearch.com/files/sphinx-2.0.6-release.tar.gz
|
||||||
- tar xzf sphinx-2.0.6-release.tar.gz
|
- tar xzf sphinx-2.0.6-release.tar.gz
|
||||||
- sh -c "cd sphinx-2.0.6-release && wget http://snowball.tartarus.org/dist/libstemmer_c.tgz && tar xzf libstemmer_c.tgz && ./configure --with-libstemmer --with-iconv --with-mysql --enable-id64 --quiet && make -j --quiet && sudo make install"
|
- sh -c "cd sphinx-2.0.6-release && wget http://snowball.tartarus.org/dist/libstemmer_c.tgz && tar xzf libstemmer_c.tgz && ./configure --with-libstemmer --with-iconv --with-mysql --enable-id64 --quiet && make -j --quiet && sudo make install"
|
||||||
@@ -45,7 +45,7 @@ php:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
- bin/developer system:uninstall
|
- bin/developer system:uninstall
|
||||||
- bin/developer dependencies:all --prefer-source
|
- travis_retry bin/developer dependencies:all --prefer-source
|
||||||
- sh -c " if [ '$SETUP_MODE' = 'update' ]; then
|
- sh -c " if [ '$SETUP_MODE' = 'update' ]; then
|
||||||
cp hudson/connexion.inc config/;
|
cp hudson/connexion.inc config/;
|
||||||
cp hudson/_GV.php config/;
|
cp hudson/_GV.php config/;
|
||||||
|
@@ -84,7 +84,7 @@ class XSendFileMappingGenerator extends Command
|
|||||||
|
|
||||||
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) {
|
||||||
$paths[] = (string) $databox->get_sxml_structure()->path;
|
$paths[] = (string) $databox->get_sxml_structure()->path;
|
||||||
|
@@ -25,42 +25,103 @@ class Permalink extends AbstractDelivery
|
|||||||
|
|
||||||
$controllers = $app['controllers_factory'];
|
$controllers = $app['controllers_factory'];
|
||||||
|
|
||||||
$that = $this;
|
$controllers->get('/v1/{sbas_id}/{record_id}/caption/', 'controller.permalink:deliverCaption')
|
||||||
|
->assert('sbas_id', '\d+')->assert('record_id', '\d+')
|
||||||
|
->bind('permalinks_caption');
|
||||||
|
|
||||||
$retrieveRecord = function ($app, $databox, $token, $record_id, $subdef) {
|
$controllers->get('/v1/{sbas_id}/{record_id}/{subdef}/', 'controller.permalink:deliverPermaview')
|
||||||
|
->bind('permalinks_permaview')
|
||||||
|
->assert('sbas_id', '\d+')
|
||||||
|
->assert('record_id', '\d+');
|
||||||
|
|
||||||
|
$controllers->get('/v1/{label}/{sbas_id}/{record_id}/{token}/{subdef}/view/', 'controller.permalink:deliverPermaviewOldWay')
|
||||||
|
->bind('permalinks_permaview_old')
|
||||||
|
->assert('sbas_id', '\d+')
|
||||||
|
->assert('record_id', '\d+');
|
||||||
|
|
||||||
|
$controllers->get('/v1/{sbas_id}/{record_id}/{subdef}/{label}', 'controller.permalink:deliverPermalink')
|
||||||
|
->bind('permalinks_permalink')
|
||||||
|
->assert('sbas_id', '\d+')
|
||||||
|
->assert('record_id', '\d+');
|
||||||
|
|
||||||
|
$controllers->get('/v1/{label}/{sbas_id}/{record_id}/{token}/{subdef}/', 'controller.permalink:deliverPermalinkOldWay')
|
||||||
|
->bind('permalinks_permalink_old')
|
||||||
|
->assert('sbas_id', '\d+')
|
||||||
|
->assert('record_id', '\d+');
|
||||||
|
|
||||||
|
return $controllers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deliverCaption(PhraseaApplication $app, Request $request, $sbas_id, $record_id)
|
||||||
|
{
|
||||||
|
$token = $request->query->get('token');
|
||||||
|
|
||||||
|
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||||
|
|
||||||
|
$record = $this->retrieveRecord($app, $databox, $token, $record_id, \databox_subdef::CLASS_THUMBNAIL);
|
||||||
|
if (null === $record) {
|
||||||
|
throw new NotFoundHttpException("Caption not found");
|
||||||
|
}
|
||||||
|
$caption = $record->get_caption();
|
||||||
|
|
||||||
|
return new Response($caption->serialize(\caption_record::SERIALIZE_JSON), 200, ["Content-Type" => 'application/json']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deliverPermaview(PhraseaApplication $app, Request $request, $sbas_id, $record_id, $subdef)
|
||||||
|
{
|
||||||
|
return $this->doDeliverPermaview($sbas_id, $record_id, $request->query->get('token'), $subdef, $app);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deliverPermaviewOldWay(PhraseaApplication $app, $label, $sbas_id, $record_id, $token, $subdef)
|
||||||
|
{
|
||||||
|
return $this->doDeliverPermaview($sbas_id, $record_id, $token, $subdef, $app);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deliverPermalink(PhraseaApplication $app, Request $request, $sbas_id, $record_id, $subdef, $label)
|
||||||
|
{
|
||||||
|
return $this->doDeliverPermalink($app, $sbas_id, $record_id, $request->query->get('token'), $subdef);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deliverPermalinkOldWay(PhraseaApplication $app, $label, $sbas_id, $record_id, $token, $subdef)
|
||||||
|
{
|
||||||
|
return $this->doDeliverPermalink($app, $sbas_id, $record_id, $token, $subdef);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function retrieveRecord($app, $databox, $token, $record_id, $subdef)
|
||||||
|
{
|
||||||
if (in_array($subdef, [\databox_subdef::CLASS_PREVIEW, \databox_subdef::CLASS_THUMBNAIL]) && $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedItem')->isRecordInPublicFeed($app, $databox->get_sbas_id(), $record_id)) {
|
if (in_array($subdef, [\databox_subdef::CLASS_PREVIEW, \databox_subdef::CLASS_THUMBNAIL]) && $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedItem')->isRecordInPublicFeed($app, $databox->get_sbas_id(), $record_id)) {
|
||||||
$record = $databox->get_record($record_id);
|
$record = $databox->get_record($record_id);
|
||||||
} else {
|
} else {
|
||||||
$record = \media_Permalink_Adapter::challenge_token($app, $databox, $token, $record_id, $subdef);
|
$record = \media_Permalink_Adapter::challenge_token($app, $databox, $token, $record_id, $subdef);
|
||||||
|
|
||||||
if (!($record instanceof \record_adapter)) {
|
if (! ($record instanceof \record_adapter)) {
|
||||||
throw new NotFoundHttpException('Wrong token.');
|
throw new NotFoundHttpException('Wrong token.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $record;
|
return $record;
|
||||||
};
|
}
|
||||||
|
|
||||||
$deliverPermaview = function ($sbas_id, $record_id, $token, $subdef, PhraseaApplication $app) use ($retrieveRecord) {
|
private function doDeliverPermaview($sbas_id, $record_id, $token, $subdef, PhraseaApplication $app)
|
||||||
|
{
|
||||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||||
|
|
||||||
$record = $retrieveRecord($app, $databox, $token, $record_id, $subdef);
|
$record = $this->retrieveRecord($app, $databox, $token, $record_id, $subdef);
|
||||||
|
|
||||||
$params = [
|
return $app['twig']->render('overview.html.twig', [
|
||||||
'subdef_name' => $subdef
|
'subdef_name' => $subdef,
|
||||||
, 'module_name' => 'overview'
|
'module_name' => 'overview',
|
||||||
, 'module' => 'overview'
|
'module' => 'overview',
|
||||||
, 'view' => 'overview'
|
'view' => 'overview',
|
||||||
, 'record' => $record
|
'record' => $record,
|
||||||
];
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
return $app['twig']->render('overview.html.twig', $params);
|
private function doDeliverPermalink(PhraseaApplication $app, $sbas_id, $record_id, $token, $subdef)
|
||||||
};
|
{
|
||||||
|
|
||||||
$deliverPermalink = function (PhraseaApplication $app, $sbas_id, $record_id, $token, $subdef) use ($that, $retrieveRecord) {
|
|
||||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||||
|
|
||||||
$record = $retrieveRecord($app, $databox, $token, $record_id, $subdef);
|
$record = $this->retrieveRecord($app, $databox, $token, $record_id, $subdef);
|
||||||
|
|
||||||
$watermark = $stamp = false;
|
$watermark = $stamp = false;
|
||||||
|
|
||||||
@@ -70,7 +131,6 @@ class Permalink extends AbstractDelivery
|
|||||||
$watermark = !$app['acl']->get($user)->has_right_on_base($record->get_base_id(), 'nowatermark');
|
$watermark = !$app['acl']->get($user)->has_right_on_base($record->get_base_id(), 'nowatermark');
|
||||||
|
|
||||||
if ($watermark) {
|
if ($watermark) {
|
||||||
|
|
||||||
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\BasketElement');
|
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\BasketElement');
|
||||||
|
|
||||||
if (count($repository->findReceivedValidationElementsByRecord($record, $user)) > 0) {
|
if (count($repository->findReceivedValidationElementsByRecord($record, $user)) > 0) {
|
||||||
@@ -79,13 +139,14 @@ class Permalink extends AbstractDelivery
|
|||||||
$watermark = false;
|
$watermark = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$response = $that->deliverContent($app['request'], $record, $subdef, $watermark, $stamp, $app);
|
$response = $this->deliverContent($app['request'], $record, $subdef, $watermark, $stamp, $app);
|
||||||
|
|
||||||
$linkToCaption = $app->url("permalinks_caption", ['sbas_id' => $sbas_id, 'record_id' => $record_id, 'token' => $token]);
|
$linkToCaption = $app->url("permalinks_caption", ['sbas_id' => $sbas_id, 'record_id' => $record_id, 'token' => $token]);
|
||||||
$response->headers->set('Link', $linkToCaption);
|
$response->headers->set('Link', $linkToCaption);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
$collection = \collection::get_from_base_id($app, $record->get_base_id());
|
$collection = \collection::get_from_base_id($app, $record->get_base_id());
|
||||||
switch ($collection->get_pub_wm()) {
|
switch ($collection->get_pub_wm()) {
|
||||||
default:
|
default:
|
||||||
@@ -99,60 +160,12 @@ class Permalink extends AbstractDelivery
|
|||||||
$watermark = false;
|
$watermark = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$response = $that->deliverContent($app['request'], $record, $subdef, $watermark, $stamp, $app);
|
$response = $this->deliverContent($app['request'], $record, $subdef, $watermark, $stamp, $app);
|
||||||
|
|
||||||
$linkToCaption = $app->url("permalinks_caption", ['sbas_id' => $sbas_id, 'record_id' => $record_id, 'token' => $token]);
|
$linkToCaption = $app->url("permalinks_caption", ['sbas_id' => $sbas_id, 'record_id' => $record_id, 'token' => $token]);
|
||||||
$response->headers->set('Link', $linkToCaption);
|
$response->headers->set('Link', $linkToCaption);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
};
|
|
||||||
|
|
||||||
$controllers->get('/v1/{sbas_id}/{record_id}/caption/', function (PhraseaApplication $app, Request $request, $sbas_id, $record_id) use ($retrieveRecord) {
|
|
||||||
$token = $request->query->get('token');
|
|
||||||
|
|
||||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
|
||||||
$record = $retrieveRecord($app, $databox, $token, $record_id, \databox_subdef::CLASS_THUMBNAIL);
|
|
||||||
$caption = $record->get_caption();
|
|
||||||
|
|
||||||
return new Response($caption->serialize(\caption_record::SERIALIZE_JSON), 200, ["Content-Type" => 'application/json']);
|
|
||||||
})
|
|
||||||
->assert('sbas_id', '\d+')->assert('record_id', '\d+')
|
|
||||||
->bind('permalinks_caption');
|
|
||||||
|
|
||||||
$controllers->get('/v1/{sbas_id}/{record_id}/{subdef}/', function (PhraseaApplication $app, Request $request, $sbas_id, $record_id, $subdef) use ($deliverPermaview) {
|
|
||||||
$token = $request->query->get('token');
|
|
||||||
|
|
||||||
return $deliverPermaview($sbas_id, $record_id, $token, $subdef, $app);
|
|
||||||
})
|
|
||||||
->bind('permalinks_permaview')
|
|
||||||
->assert('sbas_id', '\d+')
|
|
||||||
->assert('record_id', '\d+');
|
|
||||||
|
|
||||||
$controllers->get('/v1/{label}/{sbas_id}/{record_id}/{token}/{subdef}/view/', function (PhraseaApplication $app, $label, $sbas_id, $record_id, $token, $subdef) use ($deliverPermaview) {
|
|
||||||
return $deliverPermaview($sbas_id, $record_id, $token, $subdef, $app);
|
|
||||||
})
|
|
||||||
->bind('permalinks_permaview_old')
|
|
||||||
->assert('sbas_id', '\d+')
|
|
||||||
->assert('record_id', '\d+');
|
|
||||||
|
|
||||||
$controllers->get('/v1/{sbas_id}/{record_id}/{subdef}/{label}', function (PhraseaApplication $app, Request $request, $sbas_id, $record_id, $subdef, $label) use ($deliverPermalink) {
|
|
||||||
$token = $request->query->get('token');
|
|
||||||
|
|
||||||
return $deliverPermalink($app, $sbas_id, $record_id, $token, $subdef);
|
|
||||||
})
|
|
||||||
->bind('permalinks_permalink')
|
|
||||||
->assert('sbas_id', '\d+')
|
|
||||||
->assert('record_id', '\d+');
|
|
||||||
|
|
||||||
$controllers->get('/v1/{label}/{sbas_id}/{record_id}/{token}/{subdef}/', function (PhraseaApplication $app, $label, $sbas_id, $record_id, $token, $subdef) use ($deliverPermalink) {
|
|
||||||
return $deliverPermalink($app, $sbas_id, $record_id, $token, $subdef);
|
|
||||||
})
|
|
||||||
->bind('permalinks_permalink_old')
|
|
||||||
->assert('sbas_id', '\d+')
|
|
||||||
->assert('record_id', '\d+');
|
|
||||||
|
|
||||||
return $controllers;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -37,11 +37,11 @@ class RedisSessionHandler implements \SessionHandlerInterface
|
|||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException When unsupported options are passed
|
* @throws \InvalidArgumentException When unsupported options are passed
|
||||||
*/
|
*/
|
||||||
public function __construct(\Redis $redis, array $options = array())
|
public function __construct(\Redis $redis, array $options = [])
|
||||||
{
|
{
|
||||||
$this->redis = $redis;
|
$this->redis = $redis;
|
||||||
|
|
||||||
if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) {
|
if ($diff = array_diff(array_keys($options), ['prefix', 'expiretime'])) {
|
||||||
throw new \InvalidArgumentException(sprintf(
|
throw new \InvalidArgumentException(sprintf(
|
||||||
'The following options are not supported "%s"', implode(', ', $diff)
|
'The following options are not supported "%s"', implode(', ', $diff)
|
||||||
));
|
));
|
||||||
|
@@ -787,7 +787,7 @@ class API_OAuth2_Adapter extends OAuth2
|
|||||||
protected function checkUserCredentials($client_id, $username, $password)
|
protected function checkUserCredentials($client_id, $username, $password)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$application = API_OAuth2_Application::load_from_client_id($this->app, $client_id);
|
$this->setClient(API_OAuth2_Application::load_from_client_id($this->app, $client_id));
|
||||||
|
|
||||||
$usr_id = $this->app['auth.native']->getUsrId($username, $password, Request::createFromGlobals());
|
$usr_id = $this->app['auth.native']->getUsrId($username, $password, Request::createFromGlobals());
|
||||||
|
|
||||||
@@ -795,13 +795,11 @@ class API_OAuth2_Adapter extends OAuth2
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = \User_Adapter::getInstance($usr_id, $this->app);
|
$account = $this->updateAccount($usr_id);
|
||||||
|
|
||||||
$account = API_OAuth2_Account::load_with_user($this->app, $application, $user);
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'redirect_uri' => $application->get_redirect_uri()
|
'redirect_uri' => $this->client->get_redirect_uri()
|
||||||
, 'client_id' => $application->get_client_id()
|
, 'client_id' => $this->client->get_client_id()
|
||||||
, 'account_id' => $account->get_id()
|
, 'account_id' => $account->get_id()
|
||||||
];
|
];
|
||||||
} catch (AccountLockedException $e) {
|
} catch (AccountLockedException $e) {
|
||||||
|
@@ -550,7 +550,7 @@ class collection implements cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
$sql = "SELECT GREATEST(0, MAX(ord)) + 1 AS ord FROM bas WHERE sbas_id = :sbas_id";
|
$sql = "SELECT GREATEST(0, MAX(ord)) + 1 AS ord FROM bas WHERE sbas_id = :sbas_id";
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
$stmt->execute(array(':sbas_id' => $sbas_id));
|
$stmt->execute([':sbas_id' => $sbas_id]);
|
||||||
$ord = $stmt->fetch(\PDO::FETCH_ASSOC);
|
$ord = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
@@ -648,11 +648,11 @@ class collection implements cache_cacheableInterface
|
|||||||
VALUES
|
VALUES
|
||||||
(null, 1, :server_coll_id, :sbas_id, '', :ord)";
|
(null, 1, :server_coll_id, :sbas_id, '', :ord)";
|
||||||
$stmt = $databox->get_appbox()->get_connection()->prepare($sql);
|
$stmt = $databox->get_appbox()->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(
|
$stmt->execute([
|
||||||
':server_coll_id' => $coll_id,
|
':server_coll_id' => $coll_id,
|
||||||
':sbas_id' => $databox->get_sbas_id(),
|
':sbas_id' => $databox->get_sbas_id(),
|
||||||
':ord' => self::getNewOrder($databox->get_appbox()->get_connection(), $databox->get_sbas_id()),
|
':ord' => self::getNewOrder($databox->get_appbox()->get_connection(), $databox->get_sbas_id()),
|
||||||
));
|
]);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$new_bas = $databox->get_appbox()->get_connection()->lastInsertId();
|
$new_bas = $databox->get_appbox()->get_connection()->lastInsertId();
|
||||||
|
@@ -1042,7 +1042,7 @@ class databox extends base
|
|||||||
public function clear_logs()
|
public function clear_logs()
|
||||||
{
|
{
|
||||||
foreach (['log', 'log_colls', 'log_docs', 'log_search', 'log_view', 'log_thumb'] as $table) {
|
foreach (['log', 'log_colls', 'log_docs', 'log_search', 'log_view', 'log_thumb'] as $table) {
|
||||||
$sql = 'TRUNCATE ' . $table;
|
$sql = 'DELETE FROM ' . $table;
|
||||||
$stmt = $this->get_connection()->prepare($sql);
|
$stmt = $this->get_connection()->prepare($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
@@ -18,7 +18,7 @@ class patch_383alpha4a implements patchInterface
|
|||||||
private $release = '3.8.3-alpha.4';
|
private $release = '3.8.3-alpha.4';
|
||||||
|
|
||||||
/** @var array */
|
/** @var array */
|
||||||
private $concern = array(base::APPLICATION_BOX);
|
private $concern = [base::APPLICATION_BOX];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
@@ -89,14 +89,14 @@ class patch_383alpha4a implements patchInterface
|
|||||||
$em->getConnection()->executeQuery(sprintf('UPDATE usr SET usr_login="%s" WHERE usr_id=%d', $row['login_utf8'], $row['usr_id']));
|
$em->getConnection()->executeQuery(sprintf('UPDATE usr SET usr_login="%s" WHERE usr_id=%d', $row['login_utf8'], $row['usr_id']));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (array(
|
foreach ([
|
||||||
// drop index
|
// drop index
|
||||||
"ALTER TABLE usr DROP INDEX usr_login;",
|
"ALTER TABLE usr DROP INDEX usr_login;",
|
||||||
// change field type
|
// change field type
|
||||||
"ALTER TABLE usr MODIFY usr_login VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_bin;",
|
"ALTER TABLE usr MODIFY usr_login VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_bin;",
|
||||||
// recreate index
|
// recreate index
|
||||||
"CREATE UNIQUE INDEX usr_login ON usr (usr_login);"
|
"CREATE UNIQUE INDEX usr_login ON usr (usr_login);"
|
||||||
) as $sql) {
|
] as $sql) {
|
||||||
$em->getConnection()->executeQuery($sql);
|
$em->getConnection()->executeQuery($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user