moodleou / moodle-mod_forumng

ForumNG forum module for Moodle
19 stars 20 forks source link

Subplugin type "forumngfeature" should define class (Moodle 2.7) #28

Closed nadavkav closed 10 years ago

nadavkav commented 10 years ago

After installing the plugin on a fresh Moodle 2.7 stable version I get the following debug errors:

Subplugin type "forumngfeature" should define class "\mod_forumng\plugininfo\forumngfeature"

line 436 of /lib/classes/plugin_manager.php: call to debugging() line 241 of /lib/classes/plugin_manager.php: call to core_plugin_manager::resolve_plugininfo_class() line 262 of /lib/classes/plugin_manager.php: call to core_plugin_manager->load_enabled_plugins() line 389 of /lib/classes/plugininfo/base.php: call to core_plugin_manager->get_enabled_plugins() line 88 of /lib/classes/plugininfo/mod.php: call to core\plugininfo\base->is_enabled() line 38 of /admin/settings/plugins.php: call to core\plugininfo\mod->load_settings() line 6626 of /lib/adminlib.php: call to require() line 6511 of /lib/adminlib.php: call to admin_get_root() line 19 of /admin/upgradesettings.php: call to admin_externalpage_setup()

Subplugin type "forumngtype" should define class "\mod_forumng\plugininfo\forumngtype"

line 436 of /lib/classes/plugin_manager.php: call to debugging() line 241 of /lib/classes/plugin_manager.php: call to core_plugin_manager::resolve_plugininfo_class() line 262 of /lib/classes/plugin_manager.php: call to core_plugin_manager->load_enabled_plugins() line 389 of /lib/classes/plugininfo/base.php: call to core_plugin_manager->get_enabled_plugins() line 88 of /lib/classes/plugininfo/mod.php: call to core\plugininfo\base->is_enabled() line 38 of /admin/settings/plugins.php: call to core\plugininfo\mod->load_settings() line 6626 of /lib/adminlib.php: call to require() line 6511 of /lib/adminlib.php: call to admin_get_root() line 19 of /admin/upgradesettings.php: call to admin_externalpage_setup()

nadavkav commented 10 years ago

I know about the release schedule, just letting you know :smile:

alex-rowe commented 10 years ago

Same on 2.6.3 at /admin/plugins.php

Subplugin type "forumngfeature" should define class "\mod_forumng\plugininfo\forumngfeature"

    line 435 of /lib/classes/plugin_manager.php: call to debugging()
    line 367 of /lib/classes/plugin_manager.php: call to core_plugin_manager::resolve_plugininfo_class()
    line 328 of /lib/classes/plugin_manager.php: call to core_plugin_manager->get_plugins_of_type()
    line 1058 of /admin/renderer.php: call to core_plugin_manager->get_plugins()
    line 355 of /admin/renderer.php: call to core_admin_renderer->plugins_overview_panel()
    line 207 of /admin/plugins.php: call to core_admin_renderer->plugin_management_page()

Subplugin type "forumngtype" should define class "\mod_forumng\plugininfo\forumngtype"

    line 435 of /lib/classes/plugin_manager.php: call to debugging()
    line 367 of /lib/classes/plugin_manager.php: call to core_plugin_manager::resolve_plugininfo_class()
    line 328 of /lib/classes/plugin_manager.php: call to core_plugin_manager->get_plugins_of_type()
    line 1058 of /admin/renderer.php: call to core_plugin_manager->get_plugins()
    line 355 of /admin/renderer.php: call to core_admin_renderer->plugins_overview_panel()
    line 207 of /admin/plugins.php: call to core_admin_renderer->plugin_management_page()

Subplugin type "forumngfeature" should define class "\mod_forumng\plugininfo\forumngfeature"

    line 435 of /lib/classes/plugin_manager.php: call to debugging()
    line 1190 of /admin/renderer.php: call to core_plugin_manager::resolve_plugininfo_class()
    line 370 of /admin/renderer.php: call to core_admin_renderer->plugins_control_panel()
    line 207 of /admin/plugins.php: call to core_admin_renderer->plugin_management_page()

Subplugin type "forumngtype" should define class "\mod_forumng\plugininfo\forumngtype"

    line 435 of /lib/classes/plugin_manager.php: call to debugging()
    line 1190 of /admin/renderer.php: call to core_plugin_manager::resolve_plugininfo_class()
    line 370 of /admin/renderer.php: call to core_admin_renderer->plugins_control_panel()
    line 207 of /admin/plugins.php: call to core_admin_renderer->plugin_management_page()
nadavkav commented 10 years ago

Creating mod/forumng/classes/plugininfo folder and adding the following files: forumng.php, forumngfeature.php and forumnngtype.php with the following content solved it

(not sure how good the implementation was, I was reading http://docs.moodle.org/dev/Subplugins and taking an example from mod/data/classes/plugininfo)

nadavkav commented 10 years ago

forumng.php

<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Version.
 *
 * @package mod_forumng
 * @copyright 2012 The Open University
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
namespace mod_forumng\plugininfo;

use core\plugininfo\base;

defined('MOODLE_INTERNAL') || die();

class forumng extends base {
    public function is_uninstall_allowed() {
        return true;
    }

    /**
     * Pre-uninstall hook.
     *
     * This is intended for disabling of plugin, some DB table purging, etc.
     *
     * NOTE: to be called from uninstall_plugin() only.
     * @private
     */
    public function uninstall_cleanup() {
        global $DB;

        // Do the opposite of db/install.php scripts - deregister the report.

        $DB->delete_records('forumng', array('name'=>$this->name));
        $DB->delete_records('forumng_discussions');
        $DB->delete_records('forumng_posts');
        $DB->delete_records('forumng_ratings');
        $DB->delete_records('forumng_subscriptions');
        $DB->delete_records('forumng_read');
        $DB->delete_records('forumng_drafts');
        $DB->delete_records('forumng_flags');

        parent::uninstall_cleanup();
    }
}
nadavkav commented 10 years ago

forumngfeature.php

<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Version.
 *
 * @package mod_forumng
 * @copyright 2012 The Open University
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
namespace mod_forumng\plugininfo;

use core\plugininfo\base;

defined('MOODLE_INTERNAL') || die();

class forumngfeature extends base {
    public function is_uninstall_allowed() {
        return false;
    }
}
nadavkav commented 10 years ago

forumng.php

<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Version.
 *
 * @package mod_forumng
 * @copyright 2012 The Open University
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
namespace mod_forumng\plugininfo;

use core\plugininfo\base;

defined('MOODLE_INTERNAL') || die();

class forumngtype extends base {
    public function is_uninstall_allowed() {
        return false;
    }
}
jason-platts commented 10 years ago

Are you using the 2.6/master version as we already have the class files for the sub-plugins in there already?

We don't have one for the main module though

nadavkav commented 10 years ago

Oups, I was not aware of it. (never mind. it took me a few minutes and it was a good practice) I am using master.

btw, I am not sure forumng.php - uninstall_cleanup() is the right cleanup sequence. do check it :wink:

jason-platts commented 10 years ago

Should be OK using master now