Skip to content

Commit

Permalink
Merge branch 'release/2.5.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
adrenth committed Jun 16, 2020
2 parents 73a5a70 + a4c8489 commit 64e318e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.5.2

* Fix bug that causes re-writing the redirect rules file when hits are updated

# 2.5.1

* Fixes issues with redirect rules file not being present
Expand Down
5 changes: 2 additions & 3 deletions classes/StatisticsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,17 @@ public function increaseHitsForRedirect(int $redirectId): void

$now = Carbon::now();

RedirectObserver::startHandleChanges();
RedirectObserver::stopHandleChanges();

/** @noinspection PhpUndefinedClassInspection */
$redirect->forceFill([
'hits' => DB::raw('hits + 1'),
'last_used_at' => $now,
]);


$redirect->forceSave();

RedirectObserver::stopHandleChanges();
RedirectObserver::startHandleChanges();

$crawlerDetect = new CrawlerDetect();

Expand Down
3 changes: 3 additions & 0 deletions controllers/Redirects.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Vdlp\Redirect\Classes\Exceptions\InvalidScheme;
use Vdlp\Redirect\Classes\Exceptions\NoMatchForRequest;
use Vdlp\Redirect\Classes\Exceptions\UnableToLoadRules;
use Vdlp\Redirect\Classes\Observers\RedirectObserver;
use Vdlp\Redirect\Classes\RedirectManager;
use Vdlp\Redirect\Classes\RedirectRule;
use Vdlp\Redirect\Classes\StatisticsHelper;
Expand Down Expand Up @@ -282,6 +283,8 @@ public function index_onResetAllStatistics(): array
{
$redirectIds = $this->getAllRedirectIds();

RedirectObserver::stopHandleChanges();

Models\Redirect::query()->update(['hits' => 0]);
Models\Client::query()->delete();

Expand Down
2 changes: 2 additions & 0 deletions updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@
- "Add support for using relative paths -- See: https://github.com/vdlp/oc-redirect-plugin/releases/tag/2.5.0"
2.5.1:
- "Fixes issues with redirect rules file not being present -- See: https://github.com/vdlp/oc-redirect-plugin/releases/tag/2.5.1"
2.5.2:
- "Fix bug that causes re-writing the redirect rules file when hits are updated -- See: https://github.com/vdlp/oc-redirect-plugin/releases/tag/2.5.2"

0 comments on commit 64e318e

Please sign in to comment.