|
Server : LiteSpeed System : Linux quebec.us.hostns.io 5.14.0-687.42.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Aug 27 11:55:12 EDT 2026 x86_64 User : gazetufm ( 1431) PHP Version : 8.1.35 Disable Function : NONE Directory : /home2/gazetufm/leonora.al/wp-content/plugins/wpforms-lite/src/Migrations/ | |
|
Path: //home2/gazetufm/leonora.al/wp-content/plugins/wpforms-lite/src/Migrations/Upgrade2_0_5.php
Size: 1.4 KB
Permissions: 0644
<?php
namespace WPForms\Migrations;
use WPForms\Integrations\Drip\RetiredAddon;
/**
* Class upgrade for 2.0.5 release.
*
* @since 2.0.5
*
* @noinspection PhpUnused
*/
class Upgrade2_0_5 extends UpgradeBase {
/**
* Run upgrade.
*
* @since 2.0.5
*
* @return bool Always true: the upgrade completes in this request.
*/
public function run() {
// Drip is built into core from this release; left active, the addon would only show a requirements notice.
if ( ! $this->is_addon_active() ) {
return true;
}
// Right away, not on admin_init: the first request on the new core can be WP-CLI, cron, or an
// admin URL that redirects to the login page before admin_init, and the migration runs once.
$this->deactivate_addon();
return true;
}
/**
* Whether the Drip addon is active: its main file defines the load function unconditionally.
*
* @since 2.0.5
*
* @return bool
*/
protected function is_addon_active(): bool {
return function_exists( 'wpforms_drip_load' );
}
/**
* Deactivate the Drip addon and record it, so the notice asking to delete the addon outlives this request.
*
* @since 2.0.5
*/
private function deactivate_addon() {
if ( ! function_exists( 'deactivate_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
deactivate_plugins( RetiredAddon::BASENAME );
update_option( RetiredAddon::DEACTIVATED_OPTION, time() );
}
}