Skip to content

Commit

Permalink
Refresh site function #minor
Browse files Browse the repository at this point in the history
  • Loading branch information
server committed Jun 16, 2022
1 parent 820fdfb commit 55db1e8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/autotag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ jobs:
touch changelog/next.md
fi
- name: Commit changes
continue-on-error: true
run: |
git config --global user.email "noreply@dsmdesign.co.uk"
git config --global user.name "AdminUI Action"
git add .
git commit -m "Github Action compiled resources"
git push
- name: Set changelog path
id: changelog_path
run: |
Expand Down
3 changes: 2 additions & 1 deletion changelog/next.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
## Initial Tagged Release
## Features
- Now able to run all migrations, seeds and optimizations without running the update first.
17 changes: 14 additions & 3 deletions src/Controllers/UpdateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function checkUpdate(Request $request)
]
);

if (file_exists(base_path('packages/adminui')) === false) {
if (file_exists(base_path('packages/adminui')) === false) {
$this->addOutput('Can\'t update this copy of AdminUI since it appears to be outside the packages folder');
return $this->sendFailed();
}
Expand Down Expand Up @@ -131,18 +131,21 @@ public function updateSystem(Request $request)
*/
private function migrateAndSeedUpdate()
{
sleep(2);
sleep(1);

// Migrate any db updates
$this->addOutput("Running DB migrations");
Artisan::call('migrate');
Artisan::call('migrate', [
'--force' => true
]);
$this->addOutput("Output:", true);

// Update database seeds
// Update adminui navigation seeds
$this->addOutput("Running DB navigation seed");
Artisan::call('db:seed', [
'--class' => 'AdminUI\AdminUI\Database\Seeds\NavigationTableSeeder',
'--force' => true
]);
$this->addOutput("Output:", true);

Expand All @@ -154,4 +157,12 @@ private function migrateAndSeedUpdate()
$this->addOutput("Output:", true);
}
}

public function refresh()
{
$this->migrateAndSeedUpdate();
Artisan::call('optimize:clear');
Artisan::call('optimize');
return $this->sendSuccess("Site refreshed");
}
}
1 change: 1 addition & 0 deletions src/routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
// Route::get('/uninstall-adminui', [UninstallController::class, 'index'])->name('adminui.uninstaller');

Route::get('/update-adminui/check', [UpdateController::class, 'checkUpdate'])->name('adminui.update.check');
Route::get('/update-adminui/refresh', [UpdateController::class, 'refresh'])->name('adminui.update.refresh');
Route::post('/update-adminui', [UpdateController::class, 'updateSystem'])->name('adminui.update.install');

0 comments on commit 55db1e8

Please sign in to comment.