Try to restore user from data in session.

@return void
707
protected static function restoreFromSession()
    {
        $session = Http\Session::getInstance();

        try {
            $mapper = new UserMapper(Database::get());
            $user   = $mapper->findFromSession($session);
        } catch (\Exception $exception) {
            $user = new Data\User\User();
        }

        static::$user = $user;
    }
146570
public function restore()
    {
        if ($this->_kept) {
            $this->bring();
            //
            Query::table(static::$table)
            ->set('deleted_at', 'NULL', false)
            ->where($this->_keyName, '=', $this->_keyValue)
            ->update();
        }
    }
1246334
public function restore()
    {
        // If the restoring event does not return false, we will proceed with this
        // restore operation. Otherwise, we bail out so the developer will stop
        // the restore totally. We will clear the deleted timestamp and save.
        if ($this->fireModelEvent('restoring') === false) {
            return false;
        }

        $this->{$this->getDeletedAtColumn()} = null;

        // Once we have saved the model, we will fire the "restored" event so this
        // developer will do anything they need to after a restore operation is
        // totally finished. Then we will return the result of the save call.
        $this->exists = true;

        $result = $this->save();

        $this->fireModelEvent('restored', false);

        return $result;
    }
224594
public function restoreSession() {
	    $sessId = $this->getRequestParameter('session');
	    $url = $this->getRequestParameter('redirect');
	    if (session_id() != $sessId) {  
            common_Logger::i('Changing session to '.$sessId);
            session_unset();
            session_destroy();
            
            session_id($sessId);
            session_start();
            if (session_id() != $sessId) {
               $this->returnError(__('Unable to restore Session'));
            }
            session_regenerate_id(true);
            common_Logger::d('regenerated session to id \''.session_id().'\'');
	    } else {
	        common_Logger::w('Restore session called with correct session id \''.session_id().'\'');
	    }
	    $this->forwardUrl($url);
	}
919628
private function restore() {
        if (!HTTPCookie::exists($this->name)) return (object)[];
        
        return json_decode(Text::unlock(HTTPCookie::get($this->name)));
    }
640059
public function restoreSession($user_id = null)
    {
        if (empty($user_id)) {
            $user_id = activeUser('id');
        }

        if (empty($user_id)) {
            $this->setError('Must specify which user ID\'s session to restore.');
            return false;
        }

        $oUser = $this->oUserModel->getById($user_id);

        if (!$oUser) {
            $this->setError('Invalid User ID');
            return false;
        }

        // --------------------------------------------------------------------------

        //  Clean slate
        $this->oHybridAuth->logoutAllProviders();

        // --------------------------------------------------------------------------

        $this->oDb->where('user_id', $oUser->id);
        $aSessions = $this->oDb->get(NAILS_DB_PREFIX . 'user_social')->result();
        $aRestore  = [];

        foreach ($aSessions as $oSession) {
            $oSession->session_data = unserialize($oSession->session_data);
            $aRestore               = array_merge($aRestore, $oSession->session_data);
        }

        return $this->oHybridAuth->restoreSessionData(serialize($aRestore));
    }
36250
public function actionRestore()
    {
        $model = new Restore($this->getModule()->dbList);
        if (is_null($this->file)) {
            if ($this->storage) {
                if (Yii::$app->has('backupStorage')) {
                    foreach (Yii::$app->backupStorage->listContents() as $file) {
                        $fileList[] = [
                            'basename' => $file['basename'],
                            'timestamp' => $file['timestamp'],
                        ];
                    }
                } else {
                    Console::output('Storage component is not configured.');
                }
            } else {
                foreach ($this->getModule()->getFileList() as $file) {
                    $fileList[] = [
                        'basename' => StringHelper::basename($file),
                        'timestamp' => filectime($file),
                    ];
                }
            }
            ArrayHelper::multisort($fileList, ['timestamp'], [SORT_DESC]);
            $this->file = ArrayHelper::getValue(array_shift($fileList), 'basename');
        }
        $runtime = null;
        $dumpFile = null;
        if ($this->storage) {
            if (Yii::$app->has('backupStorage')) {
                if (Yii::$app->backupStorage->has($this->file)) {
                    $runtime = Yii::getAlias('@runtime/backups');
                    if (!is_dir($runtime)) {
                        FileHelper::createDirectory($runtime);
                    }
                    $dumpFile = $runtime . '/' . $this->file;
                    file_put_contents($dumpFile, Yii::$app->backupStorage->read($this->file));
                } else {
                    Console::output('File not found.');
                }
            } else {
                Console::output('Storage component is not configured.');
            }
        } else {
            $fileExists = $this->getModule()->path . $this->file;
            if (file_exists($fileExists)) {
                $dumpFile = $fileExists;
            } else {
                Console::output('File not found.');
            }
        }
        if (ArrayHelper::isIn($this->db, $this->getModule()->dbList)) {
            $dbInfo = $this->getModule()->getDbInfo($this->db);
            $restoreOptions = $model->makeRestoreOptions();
            $manager = $this->getModule()->createManager($dbInfo);
            $restoreCommand = $manager->makeRestoreCommand($dumpFile, $dbInfo, $restoreOptions);
            Yii::trace(compact('restoreCommand', 'dumpFile', 'restoreOptions'), get_called_class());
            $process = new Process($restoreCommand);
            $process->run();
            if (!is_null($runtime)) {
                FileHelper::removeDirectory($runtime);
            }
            if ($process->isSuccessful()) {
                Console::output('Dump successfully restored.');
            } else {
                Console::output('Dump failed restored.');
            }
        } else {
            Console::output('Database configuration not found.');
        }
    }
364832
public function reset()
    {
        $this->values[self::CURRENTSESSION] = null;
        $this->values[self::PREVIOUSSESSIONS] = [];
    }
1155572
protected function saveToSession()
    {
        if ($this->session !== null) {
            $this->session->set(self::SESSION_ID, $this->loginData);
        }
    }
1050976
public function restore()
	{
		$this->master->params()->rollback();
		$this->slave->params()->rollback();

		// We should also save these so we know any changes have been fully reversed
		$this->master->save();
		$this->slave->save();
	}
965343
protected function refresh()
    {
        if (Session::get()->exists(App::get()->shortName . $this->sessionKey)) {
            $state = Session::get()->value(App::get()->shortName . $this->sessionKey);
            $this->_userData = $state['vars'];
            $this->_rights = $state['rights'];
            $this->connected = (count($this->_userData) > 0);
        }
    }
360795
public function save()
    {
        $this->session['last_activity'] = time();

        // age it that should expire at the end of the user's next request.
        $this->age();

        $sessionConf = Config::get('session');

        // save data into the specialized storage.
        $this->storage->save($this->session, $sessionConf, $this->exists);

        // determine the owner of the session
        // on the user's subsequent requests to the application.
        $this->cookie($sessionConf);

        // calculate and run garbage collection cleaning.
        $cleaning = $sessionConf['garbage_collection'];

        if (mt_rand(1, $cleaning[1]) <= $cleaning[0]) {
            $this->clean();
        }
    }
180556
protected static function bootNtrustUserTrait()
    {
        static::saved(function()
        {
            self::clearCache();
        });

        static::deleted(function($user)
        {
            self::clearCache($user);
        });

        if(method_exists(self::class, 'restored')) {
            static::restored(function($user)
            {
                self::clearCache($user);
            });
        }
    }
40756
public function restoreState()
    {
        if ($data = $this->stateService->getByKey(self::IDENTIFIER)) {
            list($this->total, $this->status, $this->updateRequested) = $data;
        }
    }
735133
function reset()
    {
        $this->connection->query(sprintf("DELETE FROM %s",
                                         $this->associations_table_name));

        $this->connection->query(sprintf("DELETE FROM %s",
                                         $this->nonces_table_name));
    }
864042
protected function _assertSessionRestriction()
    {
        $stat = false;
        if ( php_sapi_name() !== 'cli' ) {
            if ( version_compare(phpversion(), '5.4.0', '>=') ) {
                $stat = ( session_status() !== PHP_SESSION_DISABLED ? true : false );
            } else {
                $stat = ( session_id() === '' ? false : true );
            }
        }

        if ( false === $stat )
            throw new \Exception('Session Cant Be Initialized.');
    }
293264
public function reset()
    {
        session()->forget($this->getSearchableKey());

        if (request()->redirectUri) {
            return redirect()->to(request()->redirectUri);
        }

        return redirect()->to($this->previousUrl());
    }