| | 1248 | /** |
| | 1249 | * Called before upgrade for plugins to clean up. |
| | 1250 | * |
| | 1251 | * Plugins must not die during their call. Plugins will be able to enable themselves |
| | 1252 | * after the upgrade has been made and the result of the pre-upgrade hook will be passed |
| | 1253 | * to the post upgrade plugin hook. |
| | 1254 | * |
| | 1255 | * @uses apply_filters() Calls pre_upgrade_PLUGIN PLUGIN is the path from PLUGINDIR. |
| | 1256 | * |
| | 1257 | * @returns array The results of the |
| | 1258 | */ |
| | 1259 | function wp_call_pre_upgrade_hook() |
| | 1260 | { |
| | 1261 | $plugin_pre_upgrade = array(); |
| | 1262 | $current_plugins = __get_option('active_plugins'); |
| | 1263 | if ( is_array($current_plugins) ) { |
| | 1264 | foreach ($current_plugins as $plugin) { |
| | 1265 | if ('' != $plugin && file_exists(ABSPATH . PLUGINDIR . '/' . $plugin)) { |
| | 1266 | include_once(ABSPATH . PLUGINDIR . '/' . $plugin); |
| | 1267 | |
| | 1268 | $plugin_pre_upgrade[ $plugin ] = apply_filters('pre_upgrade_'.$plugin, null); |
| | 1269 | } |
| | 1270 | } |
| | 1271 | } |
| | 1272 | |
| | 1273 | return $plugin_pre_upgrade; |
| | 1274 | } |
| | 1275 | |
| | 1276 | /** |
| | 1277 | * Called for plugins after the WordPress upgrade process has been made. |
| | 1278 | * |
| | 1279 | * The results of the pre-upgrade process is passed to the plugin from the pre |
| | 1280 | * upgrade process. The plugin can use this as they will. The plugin may also |
| | 1281 | * output their status for the user to see on the upgrade page to provide feedback. |
| | 1282 | * |
| | 1283 | * @uses do_action() Calls post_upgrade_PLUGIN where PLUGIN is the path of the plugin from PLUGINDIR |
| | 1284 | * @param array $pre_upgrade Passed the array from the pre upgrade |
| | 1285 | */ |
| | 1286 | function wp_call_post_upgrade_hook($pre_upgrade) |
| | 1287 | { |
| | 1288 | if ( is_array($pre_upgrade) ) { |
| | 1289 | foreach ($pre_upgrade as $plugin => $result) { |
| | 1290 | do_action( 'post_upgrade_'.$plugin, $result ); |
| | 1291 | } |
| | 1292 | } |
| | 1293 | } |
| | 1294 | |