Skip to content

Commit

Permalink
accommodate blameable user value when installing. fixes #1704
Browse files Browse the repository at this point in the history
  • Loading branch information
craigh committed Jun 4, 2014
1 parent bda9e4c commit d5ef2b8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/lib/Zikula/Bundle/CoreBundle/EventListener/BlameListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@ public function onKernelRequest(GetResponseEvent $event)

public function onPostInit(GenericEvent $event)
{
if (\System::isInstalling()) {
return;
}

$em = ServiceUtil::get('doctrine.entitymanager');
$user = $em->getRepository('ZikulaUsersModule:UserEntity')->findOneBy(array('uid' => UserUtil::getVar('uid')));
$this->blameableListener->setUserValue($user);
try {
if (\System::isInstalling()) {
$uid = 2;
} else {
$uid = UserUtil::getVar('uid');
}
$user = $em->getReference('ZikulaUsersModule:UserEntity', $uid);
$this->blameableListener->setUserValue($user);
} catch (\Exception $e) {
// silently fail - likely installing and tables not available
}
}

/**
Expand Down

0 comments on commit d5ef2b8

Please sign in to comment.