Skip to content

Commit

Permalink
PdoSessionHandler を使用しないよう修正
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Jan 14, 2016
1 parent c4b643c commit 41d456f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/Eccube/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
use Symfony\Component\Yaml\Yaml;

class Application extends ApplicationTrait
Expand Down Expand Up @@ -271,6 +270,7 @@ public function initLocale()
public function initSession()
{
$this->register(new \Silex\Provider\SessionServiceProvider(), array(
'session.storage.save_path' => $this['config']['root_dir'] . '/app/cache/eccube/session',
'session.storage.options' => array(
'name' => 'eccube',
'cookie_path' => $this['config']['root_urlpath'] ?: '/',
Expand All @@ -281,17 +281,6 @@ public function initSession()
// http://blog.tokumaru.org/2011/10/cookiedomain.html
),
));
$this['session.db_options'] = array(
'db_table' => 'dtb_session',
);

$app = $this;
$this['session.storage.handler'] = function() use ($app) {
return new PdoSessionHandler(
$app['dbs']['session']->getWrappedConnection(),
$app['session.db_options']
);
};
}

public function initRendering()
Expand Down Expand Up @@ -440,8 +429,7 @@ public function initDoctrine()
{
$this->register(new \Silex\Provider\DoctrineServiceProvider(), array(
'dbs.options' => array(
'default' => $this['config']['database'],
'session' => $this['config']['database'],
'default' => $this['config']['database']
)));
$this->register(new \Saxulum\DoctrineOrmManagerRegistry\Silex\Provider\DoctrineOrmManagerRegistryProvider());

Expand Down
33 changes: 33 additions & 0 deletions src/Eccube/Resource/doctrine/migration/Version20160114093442.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace DoctrineMigrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160114093442 extends AbstractMigration
{
const NAME = 'dtb_session';

/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
if ($schema->hasTable(self::NAME)) {
$schema->dropTable(self::NAME);
}
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs

}
}

0 comments on commit 41d456f

Please sign in to comment.