From aecfb6811764f92a6409b977ccb2acaabdb4bcd7 Mon Sep 17 00:00:00 2001 From: franzz Date: Sun, 14 Dec 2014 15:24:19 +0100 Subject: [PATCH] removing option migration kit & fixing nickname bug --- inc/databap.php | 22 +--------------------- index.php | 3 --- todo | 8 +------- 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/inc/databap.php b/inc/databap.php index 2eb56d6..a523592 100755 --- a/inc/databap.php +++ b/inc/databap.php @@ -1292,26 +1292,6 @@ class Databap extends PhpObject /* Options Management */ //TODO Create class - //TODO delete - public function migrateOptionValues() - { - $sResult = 'ok'; - $asInfo = array('select' => array('id_option', 'id_option_name', 'option'), - 'from' => self::OPT_TABLE, - 'constraint'=> array('id_option_value'=>'NULL'), - 'constOpe' => array('id_option_value'=>" IS "), - 'constVar' => true); - $asOptions = $this->oMySql->selectRows($asInfo, true, 'id_option'); - - foreach($asOptions as $iOptionId=>$asOption) - { - $iOptionValueId = $this->oMySql->insertRow(self::OPTVAL_TABLE, array('id_option_name'=>$asOption['id_option_name'], 'option_value'=>$asOption['option'], 'language'=>self::LANG_FR)); - if($iOptionValueId>0) $this->oMySql->updateRow(self::OPT_TABLE, $iOptionId, array('id_option_value'=>$iOptionValueId)); - else $sResult = 'ko'; - } - return $sResult; - } - private function getAvailableOptions() { $sOptNameIdCol = MySqlManager::getId(self::OPTNAME_TABLE); @@ -2200,7 +2180,7 @@ class Databap extends PhpObject { $sChanId = $asUser[MySqlManager::getId(self::CHAN_TABLE)]; $iUserId = $asUser[$iUserIdCol]; - if(!array_key_exists($iUserId, $asUserOptions)) $asUserOptions[$iUserId] = $this->getUserOptions(array(self::OPT_NICKNAME, self::OPT_STATUS)); + if(!array_key_exists($iUserId, $asUserOptions)) $asUserOptions[$iUserId] = $this->getUserOptions(array(self::OPT_NICKNAME, self::OPT_STATUS), $iUserId); $sNickName = self::getNickNameFormat($asUserOptions[$iUserId][self::OPT_NICKNAME][MySqlManager::getText(self::OPTVAL_TABLE)]); $asConnectedUsers[$sChanId][$sNickName.$iUserId]['id_user'] = $iUserId; $asConnectedUsers[$sChanId][$sNickName.$iUserId]['name'] = self::getNameFormat($asUser['first_name'], $asUser['last_name']); diff --git a/index.php b/index.php index 6c59c98..ff876bb 100644 --- a/index.php +++ b/index.php @@ -206,9 +206,6 @@ if($bUserOk && $sAction!=Databap::EXT_ACCESS) case 'reset_chan_safe_names': $sResult = $oDatabap->resetChanSafeNames(); break; - case 'migrate': - $sResult = $oDatabap->migrateOptionValues(); - break; } } break; diff --git a/todo b/todo index 34fb07e..83d06b5 100644 --- a/todo +++ b/todo @@ -58,10 +58,4 @@ Testing MEP 1.2 ------- -- ALTER TABLE option_values MODIFY option_value varchar(100) NOT NULL; -- insert into option_values (id_option_name, option_value, default_value, language) values (1, 'utilisateur inconnu', 1, 'FR'); -- insert into option_values (id_option_name, option_value, default_value, language) values (9, 'email inconnu', 1, 'FR'); -- Commit & push git -- ALTER TABLE `options` DROP `option`; -- delete migrateOptionValues(); (databap.php) -- delete case 'migrate' (index.php) \ No newline at end of file +- \ No newline at end of file