summaryrefslogtreecommitdiff
path: root/init.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-03-04 10:14:09 +0300
committerAndrew Dolgov <[email protected]>2021-03-04 10:14:09 +0300
commit41ff83f347568960adfd336b897088af1a27633b (patch)
tree935d7ec70a576018304d753a203bfda154a8358a /init.php
parenteaac938bcf65b040442e5307a1a5681512675a3b (diff)
use migrations to install schema
Diffstat (limited to 'init.php')
-rwxr-xr-xinit.php23
1 files changed, 14 insertions, 9 deletions
diff --git a/init.php b/init.php
index 04fb002..a9bf9b2 100755
--- a/init.php
+++ b/init.php
@@ -52,15 +52,20 @@ class Af_Img_Phash extends Plugin {
Config::add("IMG_HASH_SQL_FUNCTION", "");
- $host->add_hook($host::HOOK_ARTICLE_FILTER, $this, 100);
- $host->add_hook($host::HOOK_PREFS_TAB, $this);
- $host->add_hook($host::HOOK_PREFS_EDIT_FEED, $this);
- $host->add_hook($host::HOOK_PREFS_SAVE_FEED, $this);
- $host->add_hook($host::HOOK_HOUSE_KEEPING, $this);
- $host->add_hook($host::HOOK_RENDER_ARTICLE, $this, 100);
- $host->add_hook($host::HOOK_RENDER_ARTICLE_CDM, $this, 100);
- $host->add_hook($host::HOOK_RENDER_ARTICLE_API, $this, 100);
- $host->add_hook($host::HOOK_ARTICLE_IMAGE, $this, 100);
+ $migrations = new Db_Migrations();
+ $migrations->initialize_for_plugin($this);
+
+ if ($migrations->migrate()) {
+ $host->add_hook($host::HOOK_ARTICLE_FILTER, $this, 100);
+ $host->add_hook($host::HOOK_PREFS_TAB, $this);
+ $host->add_hook($host::HOOK_PREFS_EDIT_FEED, $this);
+ $host->add_hook($host::HOOK_PREFS_SAVE_FEED, $this);
+ $host->add_hook($host::HOOK_HOUSE_KEEPING, $this);
+ $host->add_hook($host::HOOK_RENDER_ARTICLE, $this, 100);
+ $host->add_hook($host::HOOK_RENDER_ARTICLE_CDM, $this, 100);
+ $host->add_hook($host::HOOK_RENDER_ARTICLE_API, $this, 100);
+ $host->add_hook($host::HOOK_ARTICLE_IMAGE, $this, 100);
+ }
}
function hook_prefs_tab($args) {