Get rid of registered Logman plugins and disable it permanently afterwards if it's version 1 or 2
357962
public static function disableLogman()
    {
        $dispatcher = JEventDispatcher::getInstance();

        foreach ($dispatcher->_observers as $key => $observer)
        {
            if (is_object($observer)
                && (substr(get_class($observer), 0, 9) === 'PlgLogman' || get_class($observer) === 'PlgSystemKoowa')) {
                $dispatcher->detach($observer);
            }
        }

        $logman_manifest = JPATH_ADMINISTRATOR.'/components/com_logman/logman.xml';
        if (file_exists($logman_manifest))
        {
            $manifest = simplexml_load_file($logman_manifest);

            if ($manifest && $manifest->version)
            {
                $version = (string)$manifest->version;

                if ($version && version_compare($version, '3', '<'))
                {
                    $db = JFactory::getDbo();

                    $query = "UPDATE #__extensions SET enabled = 0 WHERE type='plugin' AND folder='koowa' AND element='logman'";
                    $db->setQuery($query)->query();

                    $query = "UPDATE #__extensions SET enabled = 0 WHERE type='plugin' AND folder='system' AND element='logman'";
                    $db->setQuery($query)->query();

                    $query = "UPDATE #__modules SET published = 0 WHERE module='mod_logman'";
                    $db->setQuery($query)->query();
                }
            }
        }
    }
321814
function unreference() {
    var plugins = this._plugins

    Object.keys(plugins).forEach(function (name) {
        var plugin = plugins[ name ]

        // `unref()` is preferred
        if (typeof plugin.unref === 'function')
            plugin.unref()
        // if we cannot stop gracefully then destroy open
        // connections immediately
        else {
            // `destroy()` is required by `Plugin` base class,
            // so it's guaranteed that it exists
            plugin.destroy()
        }
    })

    // make it chainable
    return this
}
1035756
def cleanup_log_files(outputfile):
    """"""
    d = os.path.dirname(os.path.abspath(outputfile))
    logfiles = [f for f in os.listdir(d) if f.endswith('ogg.log')]
    for f in logfiles:
        os.remove(f)
88457
def log_deprecated(name="", text="", eos=""):
    
    assert name or text
    if eos:
        eos = "after " + datetime(*map(int, eos.split("-"))).strftime("%d %b")
    if name:
        if eos:
            warn_msg = "%s will be deprecated %s. %s" % (name, eos, text)
        else:
            warn_msg = "%s was deprecated. %s" % (name, text)
    else:
        warn_msg = text
        if eos:
            warn_msg += " Legacy period ends %s" % eos
    logger.warn("[Deprecated] " + warn_msg)
1060471
def _enable_logpersist(self):
        """"""
        # Logpersist is only allowed on rootable devices because of excessive
        # reads/writes for persisting logs.
        if not self._ad.is_rootable:
            return

        logpersist_warning = ('%s encountered an error enabling persistent'
                              ' logs, logs may not get saved.')
        # Android L and older versions do not have logpersist installed,
        # so check that the logpersist scripts exists before trying to use
        # them.
        if not self._ad.adb.has_shell_command('logpersist.start'):
            logging.warning(logpersist_warning, self)
            return

        try:
            # Disable adb log spam filter for rootable devices. Have to stop
            # and clear settings first because 'start' doesn't support --clear
            # option before Android N.
            self._ad.adb.shell('logpersist.stop --clear')
            self._ad.adb.shell('logpersist.start')
        except adb.AdbError:
            logging.warning(logpersist_warning, self)
31043
def cleanup_logger(self):
        
        self.log_handler.close()
        self.log.removeHandler(self.log_handler)
184546
function(bs, done) {
        var plugins = bs.options
            .get("plugins")
            .map(pluginUtils.resolvePlugin)
            .map(pluginUtils.requirePlugin);

        plugins.forEach(function(plugin) {
            if (plugin.get("errors").size) {
                return logPluginError(plugin);
            }
            var jsPlugin = plugin.toJS();
            jsPlugin.options = jsPlugin.options || {};
            jsPlugin.options.moduleName = jsPlugin.moduleName;
            bs.registerPlugin(jsPlugin.module, jsPlugin.options);
        });

        function logPluginError(plugin) {
            utils.fail(true, plugin.getIn(["errors", 0]), bs.cb);
        }

        done();
    }
1112923
def freeze(plugins_directory):
    '''
    
    '''
    # Check existing version (if any).
    package_versions = []
    for plugin_path_i in plugins_directory.dirs():
        try:
            plugin_metadata = yaml.load(plugin_path_i
                                        .joinpath('properties.yml').bytes())
            if plugin_path_i.name != plugin_metadata['package_name']:
                continue
            package_versions.append((plugin_metadata['package_name'],
                                     plugin_metadata['version']))
        except:
            continue
    return ['%s==%s' % v for v in package_versions]
1256672
def destroy_plugin(plugin_name, conn=None):
    
    results = {}
    if plugin_exists(plugin_name, conn=conn):
        results = RPX.table_drop(plugin_name).run(conn)
    return results
866088
public static function _uninstall_plugin_hook() {
            self::_load_required_static();

            self::$_static_logger->entrance();

            if ( ! current_user_can( 'activate_plugins' ) ) {
                return;
            }

            $plugin_file = substr( current_filter(), strlen( 'uninstall_' ) );

            self::$_static_logger->info( 'plugin = ' . $plugin_file );

            define( 'WP_FS__UNINSTALL_MODE', true );

            $fs = self::get_instance_by_file( $plugin_file );

            if ( is_object( $fs ) ) {
                self::require_plugin_essentials();

                if ( is_plugin_active( $fs->_free_plugin_basename ) ||
                     is_plugin_active( $fs->premium_plugin_basename() )
                ) {
                    // Deleting Free or Premium plugin version while the other version still installed.
                    return;
                }

                $fs->_uninstall_plugin_event();

                $fs->do_action( 'after_uninstall' );
            }
        }
578748
function (name, type) {
                logger.debug("Attempting to remove plugin: " + name);
                var index, plug, plugs = this.config.plugins;
                for (index = 0; index < plugs.length; index += 1) {
                    plug = plugs[index];
                    if (plug.name === name && plug.type === type) {
                        plugs.splice(index, 1);
                        logger.debug("Plugin: " + name + " has been removed");
                        break;
                    }
                }
            }
837281
function uninstall() {
  installer.uninstall(Array.prototype.slice.call(arguments), function(errs) {
    if (errs) {
      return out.error("error : %j", errs);
    }
    return out.success("plugins uninstalled");
  });
}
287524
def discard_logcat_logs(self):
        """"""
        if self.driver_wrapper.is_android_test():
            try:
                self.driver_wrapper.driver.get_log('logcat')
            except Exception:
                pass
564507
def disable_plugin(self, plugin_name):
        """"""
        plugin = self.get_plugin_info(plugin_name)
        ENABLED = os.path.join(plugin["plugin_package_abspath"], "ENABLED")
        DISABLED = os.path.join(plugin["plugin_package_abspath"], "DISABLED")
        if os.path.isfile(ENABLED):
            os.remove(ENABLED)
        self.__touch_file(DISABLED)
656897
def init_log(*handlers, **kwargs):
    
    disable_existing_loggers = kwargs.get('disable_existing_loggers', False)

    handlers_config = [t.get_handler() for t in handlers]
    new_handlers_config = {}
    for t in handlers_config:
        new_handlers_config.update(t)

    formatter_config = [t.get_formatter() for t in handlers]
    new_formatter_config = {}
    for t in formatter_config:
        new_formatter_config.update(t)

    handler_name_list = [t.get_formatter_name() for t in handlers]
    dict_config = {
        'version': 1,
        'disable_existing_loggers': disable_existing_loggers,
        'formatters': new_formatter_config,
        'handlers': new_handlers_config,
        'loggers': {
            '': {
                'handlers': handler_name_list,
                'level': 'DEBUG',
            }
        }
    }

    logging.config.dictConfig(dict_config)
798476
def remove(name, log_file=None):
    '''
    

    '''
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    # retrieve all log configuration
    config = __salt__['logadm.list_conf']()

    # figure out log_file and name
    if not log_file:
        if name.startswith('/'):
            log_file = name
            name = None
        else:
            for log in config:
                if 'entryname' in config[log] and config[log]['entryname'] == name:
                    log_file = config[log]['log_file']
                    break
    if not name:
        for log in config:
            if 'log_file' in config[log] and config[log]['log_file'] == log_file:
                if 'entryname' in config[log]:
                    name = config[log]['entryname']
                break

    # remove log if needed
    if log_file in config:
        res = __salt__['logadm.remove'](name if name else log_file)
        ret['result'] = 'Error' not in res
        if ret['result']:
            ret['comment'] = 'Configuration for {} removed.'.format(log_file)
            ret['changes'][log_file] = None
        else:
            ret['comment'] = res['Error']
    else:
        ret['result'] = True
        ret['comment'] = 'No configuration for {} present.'.format(log_file)

    return ret
106008
def _prepare(self):
        

        super(CommandServer, self)._prepare()

        # unregister all active plugins
        for plugin in registration.get_registered():
            registration.disable_plugin_instance(plugin)