本文整理汇总了PHP中Magento\Backend\Model\Auth\Session::unsUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::unsUser方法的具体用法?PHP Session::unsUser怎么用?PHP Session::unsUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Backend\Model\Auth\Session
的用法示例。
在下文中一共展示了Session::unsUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run installation in context of the specified admin user
*
* @param $userName
* @param array $modules
* @return void
* @throws \Exception
*/
public function run($userName, array $modules = [])
{
set_time_limit(0);
/** @var \Magento\User\Model\User $user */
$user = $this->userFactory->create()->loadByUsername($userName);
if (!$user->getId()) {
throw new \Exception('Invalid admin user provided');
}
$this->state->start();
$this->session->setUser($user);
$this->deploy->run();
$resources = $this->initResources($modules);
$this->state->clearErrorFlag();
try {
foreach ($this->moduleList->getNames() as $moduleName) {
if (isset($resources[$moduleName])) {
$resourceType = $resources[$moduleName];
$this->setupFactory->create($resourceType)->run();
$this->postInstaller->addModule($moduleName);
}
}
$this->session->unsUser();
$this->postInstaller->run();
$this->state->finish();
} catch (\Exception $e) {
$this->state->setError();
$this->logger->log($e->getMessage());
}
}
示例2: logout
/**
* Log Out
*
* @return \Magento\Downloader\Model\Session
*/
public function logout()
{
if (!$this->_session) {
return $this;
}
$this->_session->unsUser();
return $this;
}
示例3: run
/**
* Run installation in context of the specified admin user
*
* @param \Magento\User\Model\User $adminUser
* @throws \Exception
*
* @return void
*/
public function run(\Magento\User\Model\User $adminUser)
{
set_time_limit(3600);
if (!$adminUser || !$adminUser->getId()) {
throw new \Exception('Invalid admin user provided');
}
$this->session->setUser($adminUser);
$this->deploy->run();
$resources = $this->initResources();
foreach ($this->moduleList->getNames() as $moduleName) {
if (isset($resources[$moduleName])) {
$resourceType = $resources[$moduleName];
$this->setupFactory->create($resourceType)->run();
$this->postInstaller->addModule($moduleName);
}
}
$this->session->unsUser();
$this->postInstaller->run();
}