Skip to content

Commit

Permalink
Fixes #5371 Make Piwik work PHP session hash function is non default …
Browse files Browse the repository at this point in the history
…such as sha1 or sha512 or other

id is now VARCHAR field

Tested with: session.hash_function = sha256

Had to use VARCHAR as the session id can be 128 chars eg.
```
$ php -r "var_dump(hash('sha512','test'));"
string(128) "ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff"
```
  • Loading branch information
mattab committed Jun 25, 2014
1 parent 2e1384b commit 6ca0524
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/Db/Schema/Mysql.php
Expand Up @@ -299,7 +299,7 @@ public function getTablesCreateSql()
",

'session' => "CREATE TABLE {$prefixTables}session (
id CHAR(32) NOT NULL,
id VARCHAR( 255 ) NOT NULL,
modified INTEGER,
lifetime INTEGER,
data TEXT,
Expand Down
29 changes: 29 additions & 0 deletions core/Updates/2.4.0-b8.php
@@ -0,0 +1,29 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Updates;

use Piwik\Common;
use Piwik\Updater;
use Piwik\Updates;

class Updates_2_4_0_b8 extends Updates
{
static function getSql()
{
return array(
"ALTER TABLE `" . Common::prefixTable('session')
. "` CHANGE `id` `id` VARCHAR( 255 ) NOT NULL " => false,
);
}

static function update()
{
Updater::updateDatabase(__FILE__, self::getSql());
}
}
2 changes: 1 addition & 1 deletion core/Version.php
Expand Up @@ -21,5 +21,5 @@ final class Version
* The current Piwik version.
* @var string
*/
const VERSION = '2.4.0-b7';
const VERSION = '2.4.0-b8';
}

0 comments on commit 6ca0524

Please sign in to comment.