Skip to content

Commit

Permalink
fixed listeners to work also with install process
Browse files Browse the repository at this point in the history
  • Loading branch information
takeit committed Nov 5, 2014
1 parent e586fc3 commit f45b32c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions newscoop/library/Newscoop/Services/IssueService.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ public function issueResolver(Request $request)
*/
public function getLatestPublishedIssue()
{
if (!$this->publicationService->getPublication()) {
return;
}

$issues = $this->publicationService->getPublication()->getIssues()->toArray();
usort($issues, function ($x, $y) {
return $y->getId() - $x->getId();
Expand Down
4 changes: 4 additions & 0 deletions newscoop/library/Newscoop/Services/ThemesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public function __construct(
public function getThemePath()
{
$issue = $this->issueService->getIssue();
if (!$issue) {
return;
}

$languageId = $issue->getLanguageId();
$publication = $this->publicationService->getPublication();
$cacheKeyThemePath = $this->cacheService->getCacheKey(array('getThemePath', $languageId, $publication->getId(), $issue->getNumber()), 'issue');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ public function onRequest(GetResponseEvent $event)
if ($this->cacheService->contains($cacheKey)) {
$files = $this->cacheService->fetch($cacheKey);
} else {
$dir = __DIR__.'/../../../../plugins/*/admin-files/translations';
if (!file_exists($dir)) {
return;
}

$finder = new Finder();
$extension = $locale.'.yml';
$files = array();

$finder->files()->in(__DIR__.'/../../../../plugins/*/admin-files/translations');
$finder->files()->in($dir);
$finder->files()->name('*.'.$locale.'.yml');

foreach ($finder as $file) {
Expand Down

0 comments on commit f45b32c

Please sign in to comment.