Skip to content
This repository was archived by the owner on Jun 1, 2019. It is now read-only.

Commit b734982

Browse files
committed
make sure migrations are not published twice
1 parent 0a64977 commit b734982

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ php:
66
- 5.6
77
- hhvm
88
- 7
9-
10-
matrix:
11-
allow_failures:
12-
- php: 7
139

1410
before_script:
1511
- travis_retry composer self-update

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
All Notable changes to `activitylog` will be documented in this file
44

5+
### 2.4.2 - 2016-03-23
6+
- Make sure the migrations are not published twice
7+
58
### 2.4.1
69
- Added `userModel` configuration
710

src/Spatie/Activitylog/ActivitylogServiceProvider.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@ public function boot()
2020
{
2121
// Publish a config file
2222
$this->publishes([
23-
__DIR__.'/../../config/activitylog.php' => config_path('activitylog.php'),
23+
__DIR__ . '/../../config/activitylog.php' => config_path('activitylog.php'),
2424
], 'config');
2525

26-
$files = glob(database_path('/migrations/*_create_activity_log_table.php'));
27-
28-
if (! $files) {
29-
// Publish your migrations
26+
if (!$this->migrationHasAlreadyBeenPublished()) {
27+
// Publish migration
3028
$timestamp = date('Y_m_d_His', time());
3129

3230
$this->publishes([
33-
__DIR__.'/../../migrations/create_activity_log_table.stub' => database_path('/migrations/'.$timestamp.'_create_activity_log_table.php'),
31+
__DIR__ . "/../../migrations/create_activity_log_table.stub" => database_path("/migrations/{$timestamp}_create_activity_log_table.php"),
3432
], 'migrations');
3533
}
3634
}
@@ -60,4 +58,14 @@ public function provides()
6058
{
6159
return [];
6260
}
61+
62+
/**
63+
* @return bool
64+
*/
65+
protected function migrationHasAlreadyBeenPublished()
66+
{
67+
$files = glob(database_path('/migrations/*_create_activity_log_table.php'));
68+
69+
return count($files) > 0;
70+
}
6371
}

0 commit comments

Comments
 (0)