Disable a license
@param string $license the shortname of license
@return boolean
423199
static public function disable($license) {
        global $DB, $CFG;
        // Site default license cannot be disabled!
        if ($license == $CFG->sitedefaultlicense) {
            print_error('error');
        }
        if ($license = self::get_license_by_shortname($license)) {
            $license->enabled = 0;
            $DB->update_record('license', $license);
        }
        self::set_active_licenses();
        return true;
    }
633925
public function unregister($alias) {
    // unregister
    unset($this->files[$alias]);

    // aus queued entfernen
    $key = array_search($alias, $this->enqueued);
    if ($key !== FALSE) {
      unset($this->enqueued[$key]);
    }
    return $this;
  }
1328669
def deactivate_license(key_name=None):
    '''
    

    '''

    _required_version = '7.0.0'
    if not __proxy__['panos.is_required_version'](_required_version):
        return False, 'The panos device requires version {0} or greater for this command.'.format(_required_version)

    if not key_name:
        return False, 'You must specify a key_name.'
    else:
        query = {'type': 'op', 'cmd': '<request><license><deactivate><key><features><member>{0}</member></features>'
                                      '</key></deactivate></license></request>'.format(key_name)}

    return __proxy__['panos.call'](query)
1157716
public function getLicense() : ?int 
    {
        if ( ! $this->hasLicense()) {
            $this->setLicense($this->getDefaultLicense());
        }
        return $this->license;
    }
822575
public function removeAlias($alias)
    {
        if (isset($this->aliasDefinitions[$alias = $this->normalizeId($alias)])) {
            unset($this->aliasDefinitions[$alias]);
            $this->removedIds[$alias] = true;
        }
    }
1178537
public function remove($alias)
    {
        $id = $this->getId($alias);
        if ($id) {
            unset($this->aliases[$alias]);
            $aliases = &$this->ids[$id];
            unset($aliases[array_search($alias, $aliases, true)]);
            if (!empty($aliases)) {
                $this->removeDependedAliases($alias, $id);
            } else {
                unset($this->ids[$id]);
            }
        }

        return $this;
    }
1105102
public function unregister($alias)
    {
        $this->_collection->remove($alias);
        $this->remove($alias);
        return $this;
    }
886441
public static function setDefaultLicense(array $license)
    {
        if (!array_key_exists('name', $license) || !array_key_exists('key', $license)) {
            throw new Exception\InvalidArgumentException(__METHOD__ . " In order to set a default libxl license you must provide an associative array with 'name' and 'key' set.");
        }

        self::$default_license = $license;
    }
81024
private function _sync_site_subscription( $license ) {
            if ( ! is_object( $license ) ) {
                $this->delete_unused_subscriptions();

                return false;
            }

            // Load subscription details if not lifetime.
            $subscription = $license->is_lifetime() ?
                false :
                $this->_fetch_site_license_subscription();

            if ( is_object( $subscription ) && ! isset( $subscription->error ) ) {
                $this->store_subscription( $subscription );
            } else {
                $this->delete_unused_subscriptions();
            }

            return $subscription;
        }
1367986
public function isDisabled($id)
    {
        $code = $this->getIdentifier($id);

        if (array_key_exists($code, $this->disabledPlugins)) {
            return true;
        }

        return false;
    }
757579
function _sync_licenses( $site_license_id = false, $blog_id = null ) {
            $this->_logger->entrance();

            $is_network_admin = fs_is_network_admin();

            if ( $is_network_admin && is_null( $blog_id ) ) {
                $all_licenses = self::get_all_licenses( $this->_module_id );
            } else {
                $all_licenses = $this->get_user_licenses( $this->_user->id );
            }

            $foreign_licenses = array(
                'ids'          => array(),
                'license_keys' => array()
            );

            $all_licenses_map = array();
            foreach ( $all_licenses as $license ) {
                $all_licenses_map[ $license->id ] = true;
                if ( $license->user_id == $this->_user->id || $license->id == $site_license_id ) {
                    continue;
                }

                $foreign_licenses['ids'][]          = $license->id;
                $foreign_licenses['license_keys'][] = $license->secret_key;
            }

            if ( empty( $foreign_licenses['ids'] ) ) {
                $foreign_licenses = array();
            }

            $licenses = $this->_fetch_licenses( false, $site_license_id, $foreign_licenses, $blog_id );

            if ( $this->is_array_instanceof( $licenses, 'FS_Plugin_License' ) ) {
                $licenses_map = array();
                foreach ( $licenses as $license ) {
                    $licenses_map[ $license->id ] = true;
                }

//                $license_ids_to_keep = $this->get_license_ids_associated_with_installs();
//                foreach ( $license_ids_to_keep as $license_id ) {
//                    if ( isset( $licenses_map[ $license_id ] ) ) {
//                        continue;
//                    }
//
//                    $missing_license = self::_get_license_by_id( $license_id, false );
//                    if ( is_object( $missing_license ) ) {
//                        $licenses[]                           = $missing_license;
//                        $licenses_map[ $missing_license->id ] = true;
//                    }
//                }

                $user_license_ids = $this->get_user_linked_license_ids( $this->_user->id );

                foreach ( $user_license_ids as $key => $license_id ) {
                    if ( ! isset( $licenses_map[ $license_id ] ) ) {
                        // Remove access to licenses that no longer exist.
                        unset( $user_license_ids[ $key ] );
                    }
                }

                if ( ! empty( $user_license_ids ) ) {
                    foreach ( $licenses_map as $license_id => $value ) {
                        if ( ! isset( $all_licenses_map[ $license_id ] ) ) {
                            // Associate new licenses with the user who triggered the license syncing.
                            $user_license_ids[] = $license_id;
                        }
                    }

                    $user_license_ids = array_unique( $user_license_ids );
                } else {
                    $user_license_ids = array_keys( $licenses_map );
                }

                if ( ! $is_network_admin || ! is_null( $blog_id ) ) {
                    $user_licenses = array();
                    foreach ( $licenses as $license ) {
                        if ( ! in_array( $license->id, $user_license_ids ) ) {
                            continue;
                        }

                        $user_licenses[] = $license;
                    }

                    $this->_licenses = $user_licenses;
                } else {
                    $this->_licenses = $licenses;
                }

                $this->set_user_linked_license_ids( $this->_user->id, $user_license_ids );

                $this->_store_licenses( true, $this->_module_id, $licenses );
            }

            // Update current license.
            if ( is_object( $this->_license ) ) {
                $this->_license = $this->_get_license_by_id( $this->_license->id );
            }

            return $this->_licenses;
        }
404161
public function deleteTbl($table)
    {
        if (isset($table) && !empty(trim($table))) {
            $sql = "DROP TABLE `{$table}` ";

            return $sql;
        } else {
            return false;
        }
    }
199710
public function prune($license = null)
    {
        if ($license) {
            $this->addUsingAlias(LicensePeer::ID, $license->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }
1217114
public function isFunctionDisabled(string $function): bool
    {
        $disable_functions = explode(',', ini_get('disable_functions'));
        $disable_functions = array_map(static function (string $func): string {
            return strtolower(trim($func));
        }, $disable_functions);

        $function = strtolower($function);

        return in_array($function, $disable_functions, true) || !function_exists($function);
    }
633654
public function validate( $license ) {
		try {
			$url      = untrailingslashit( home_url( '' ) );
			$guid     = $this->guid;
			$response = wp_remote_post( $this->validate_url, [
				'body' => [
					'license' => $license,
					'url'     => $url,
				],
			] );
			if ( is_wp_error( $response ) ) {
				return $response;
			}
			if ( 200 === $response['response']['code'] ) {
				return true;
			} else {
				$body = json_decode( $response['body'] );
				return new \WP_Error( $response['response']['code'], $body->message );
			}
		} catch ( \Exception $e ) {
			return new \WP_Error( $e->getCode(), $e->getMessage() );
		}
	}
360915
public function setLicense(array $license)
    {
        if (!array_key_exists('name', $license) || !array_key_exists('key', $license)) {
            throw new Exception\InvalidArgumentException(__METHOD__ . " In order to set a libxl license you must provide an associative array with 'name' and 'key' set.");
        }
        $this->license = $license;
    }
900554
function has_features_enabled_license() {
            return (
                is_object( $this->_license ) &&
                is_numeric( $this->_license->id ) &&
                $this->_license->is_features_enabled()
            );
        }