summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-03-04 11:30:20 +0300
committerAndrew Dolgov <[email protected]>2021-03-04 11:30:20 +0300
commit50b793583ec08146ef7153526e071fd3814b9254 (patch)
treec9e8cd24bb7f26116f98d3df20056f26a8f454e6
parentcfa706e6fb28e363bf95fa2cf5b210c9064c6fef (diff)
don't try to set hooks if migration fails
-rwxr-xr-xinit.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/init.php b/init.php
index c96e230..ed71492 100755
--- a/init.php
+++ b/init.php
@@ -17,12 +17,12 @@ class Reddit_Delay extends Plugin {
$migrations = new Db_Migrations();
$migrations->initialize_for_plugin($this);
- $migrations->migrate();
-
- $host->add_hook(PluginHost::HOOK_FEED_FETCHED, $this);
- $host->add_hook(PluginHost::HOOK_PREFS_TAB, $this);
- $host->add_hook(PluginHost::HOOK_PREFS_EDIT_FEED, $this);
- $host->add_hook(PluginHost::HOOK_PREFS_SAVE_FEED, $this);
+ if ($migrations->migrate()) {
+ $host->add_hook(PluginHost::HOOK_FEED_FETCHED, $this);
+ $host->add_hook(PluginHost::HOOK_PREFS_TAB, $this);
+ $host->add_hook(PluginHost::HOOK_PREFS_EDIT_FEED, $this);
+ $host->add_hook(PluginHost::HOOK_PREFS_SAVE_FEED, $this);
+ }
}
private function cache_exists(int $feed_id, string $link) {