Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined('BASEPATH')) exit('No direct script access allowed');
- require_once(DIR_LIB . "Database/DatabaseManager.php");
- class ChangeDatabase{
- function changeToRead(){
- $CI =& get_instance();
- $database = DatabaseManager::initDatabase();
- //if it's a 'superuser'
- if($superuser){
- $user = &$database->getUsername();
- $active_group = &$database->getActiveGroup();
- $active_group = "group_vision";
- $user = "user_vision";
- //the database pass is returned by the user informed
- $database->setPassword($user);
- $referencePass = &$database->getPassword();
- $LumConnManager = Lumine_ConnectionManager::getInstance();
- $LumConfList = $LumConnManager->getConfigurationList();
- $lumineConfig = current($LumConfList);
- $lumineConfig->connection->setPassword($referencePass);
- $lumineConfig->connection->setUser($user);
- //override the db original object
- try{
- $dbObject = DB($active_group);
- $CI->db = $dbObject;
- }catch(Exception $e){
- throw($e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement