Skip to content

Commit 77a2329

Browse files
committed
Include install functions in upgrade() method
Doing this in init() does not work, as the plugin is never initialized in an install/upgrade context. Fixes #55
1 parent 79a761d commit 77a2329

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Snippets.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ public function hooks() {
5454

5555
public function init() {
5656
require_once("Snippets.API.php");
57-
58-
if( plugin_needs_upgrade( $this ) ) {
59-
require_once( dirname( __FILE__ ) . '/install_functions.php' );
60-
}
6157
}
6258

6359
/**
@@ -175,6 +171,13 @@ public function schema() {
175171
);
176172
}
177173

174+
public function upgrade( $p_schema ) {
175+
if( $p_schema == 1 ) {
176+
require_once( dirname( __FILE__ ) . '/install_functions.php' );
177+
}
178+
return true;
179+
}
180+
178181
/**
179182
* RESTful route for Snippets Pattern Help (tooltip).
180183
*

0 commit comments

Comments
 (0)