Skip to content

Commit

Permalink
Merge branch 'CorePack' into pilot
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Oct 17, 2015
2 parents b38f9b1 + b334804 commit 99917cf
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion html/include/corepack_version.php
@@ -1,6 +1,6 @@
<?php
// XOOPS X (ten) CorePack version
define('XOOPSX_COREPACK_VERSION', '20150801.0913');
define('XOOPSX_COREPACK_VERSION', '20150801.1017');
// detaild_version for X-update
define('_MI_LEGACY_DETAILED_VERSION', 'CorePack ' . XOOPSX_COREPACK_VERSION);
define('XOOPS_DISTRIBUTION_VERSION', 'XOOPS X(ten) ' . XOOPSX_COREPACK_VERSION);
Expand Down
2 changes: 1 addition & 1 deletion html/install/sql/mysql.structure.sql
Expand Up @@ -463,7 +463,7 @@ CREATE TABLE session (
sess_id varchar(32) NOT NULL default '',
sess_updated int(10) unsigned NOT NULL default '0',
sess_ip varchar(15) NOT NULL default '',
sess_data text NOT NULL,
sess_data blob NOT NULL,
PRIMARY KEY (sess_id),
KEY updated (sess_updated)
) ENGINE=MyISAM;
Expand Down
37 changes: 37 additions & 0 deletions html/modules/legacy/admin/class/Legacy_Updater.class.php
Expand Up @@ -18,6 +18,43 @@ class Legacy_ModuleUpdater extends Legacy_ModulePhasedUpgrader
'106' => 'update106',
'200' => 'update200'
);

function _processScript()
{
parent::_processScript();
$cVersion = $this->getCurrentVersion();
if ($cVersion < 204) {
$this->auto_update_session_blob();
}
}

function auto_update_session_blob()
{
$root = XCube_Root::getSingleton();
$db = $root->mController->getDB();
$table = $db->prefix('session');

$sql = 'SHOW COLUMNS FROM `'. $table .'` WHERE Field = \'sess_data\'';
if ($res = $db->query($sql)) {

$row = $db->fetchArray($res);

if (strtolower($row['Type']) !== 'blob') {

$sql = 'ALTER TABLE `'. $table .'` CHANGE `sess_data` `sess_data` BLOB NOT NULL';

if ($db->query($sql))
{
$this->mLog->addReport('Table `'.$table.'` field `sess_data` changed type to BLOB.');
}
else
{
$this->mLog->addError('Type change error of table `'.$table.'` field `sess_data` to BLOB.');
}

}
}
}

function update200()
{
Expand Down

0 comments on commit 99917cf

Please sign in to comment.