コード例 #1
0
<?php

/**
 * This file performs a check to determine whether an update is required
 */
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'common.php';
// Check if we need to do an upgrade from a previous version
$previous_plugin_version = get_option(HA_Common::PLUGIN_VERSION_OPTION);
if ($previous_plugin_version != HA_Common::PLUGIN_VERSION) {
    // reactivate plugin and db updates will occur
    HA_Admin_Controller::activate_plugin();
    try {
        // Delete old files that are no longer used from previous versions
        // PHP files
        if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'class-frontend.php')) {
            unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'class-frontend.php');
        }
        if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'class-admin.php')) {
            unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'class-admin.php');
        }
        if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'class-admin-tables.php')) {
            unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'class-admin-tables.php');
        }
        if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'updates.php')) {
            unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'updates.php');
        }
        if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'class-common.php')) {
            unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'class-common.php');
        }
        // Dirs
        if (is_dir(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'heatmap.js')) {
コード例 #2
0
ファイル: hotspots.php プロジェクト: klebercarvalho/demo
function ha_uninstall_plugin()
{
    if (is_admin() && class_exists('HA_Admin_Controller')) {
        HA_Admin_Controller::uninstall_plugin();
    }
}