Skip to content

Commit

Permalink
Fixed a couple of more stupid issues with data caching
Browse files Browse the repository at this point in the history
  • Loading branch information
Jnesselr committed Aug 9, 2024
1 parent a66c9a0 commit 8692023
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
10 changes: 7 additions & 3 deletions app/Console/Commands/IdentifyIssues.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Issues\Types\ICanFixThem;
use App\Issues\Types\IssueBase;
use Illuminate\Console\Command;
use Illuminate\Console\Concerns\InteractsWithIO;
use Illuminate\Support\Str;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -50,7 +51,9 @@ public function handle(): void
/** @var IssueBase $firstIssue */
$firstIssue = $myIssues->first();
$issueTitle = $firstIssue->getIssueTitle();
$canFixThisIssueType = array_key_exists(ICanFixThem::class, (new \ReflectionClass($firstIssue))->getTraits());
$issueTraits = (new \ReflectionClass($firstIssue))->getTraits();
$canFixThisIssueType = array_key_exists(ICanFixThem::class, $issueTraits);
$needsOutputSet = array_key_exists(InteractsWithIO::class, $issueTraits);

$this->info(sprintf('%d: %s (%d)', $issueNumber, $issueTitle, count($myIssues)));
$this->info("URL: {$firstIssue->getIssueURL()}");
Expand All @@ -62,7 +65,9 @@ public function handle(): void
$this->info("\t{$issue->getIssueText()}");
if ($canFixThisIssueType) {
/** @var ICanFixThem|IssueBase $issue */
$issue->setOutput($this->output);
if($needsOutputSet) {
$issue->setOutput($this->output);
}
$fixableIssues->add($issue);
}
}
Expand All @@ -85,7 +90,6 @@ public function handle(): void
foreach ($fixableIssues as $issue) {
/** @var IssueBase|ICanFixThem $issue */
$this->info(sprintf('%d: %s', $issue::getIssueNumber(), $issue->getIssueText()));
$issue->setOutput($this->output);
try {
if ($issue->fix()) {
$numIssuesFixed++;
Expand Down
1 change: 0 additions & 1 deletion app/DataCache/CachedData.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\External\HasApiProgressBar;
use Illuminate\Contracts\Container\Container;
use Illuminate\Support\Collection;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Inherit from this class to automatically scope your instance to the current request lifecycle. It also provides an
Expand Down
2 changes: 1 addition & 1 deletion app/DataCache/GoogleGroupMembers.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function __construct(
}

public function get($groupName) {
return $this->cache(function () use ($groupName) {
return $this->cache($groupName, function () use ($groupName) {
return $this->googleApi->group($groupName)
->list($this->apiProgress("Fetching Google Group Members $groupName"));
});
Expand Down
2 changes: 1 addition & 1 deletion app/Issues/IssueChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function getIssues(): Collection
$this->issues = collect();

foreach ($this->getIssueCheckers() as $checker) {
if (! app()->resolved(OutputInterface::class)) {
if (app()->resolved(OutputInterface::class)) {
$output = app(OutputInterface::class);
$shortName = Str::replace('App\\Issues\\Checkers\\', '', get_class($checker));
$output->writeln("Getting issues for: $shortName");
Expand Down

0 comments on commit 8692023

Please sign in to comment.