Skip to content

Commit

Permalink
ELIS-8632 Code changes for migration to local plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko Vidberg authored and brentboghosian committed Mar 5, 2014
1 parent 41670af commit deb3120
Show file tree
Hide file tree
Showing 246 changed files with 5,758 additions and 5,707 deletions.
123 changes: 3 additions & 120 deletions adminlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,128 +16,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package block_rlip
* @subpackage rlip
* @package local_datahub
* @author Remote-Learner.net Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2008-2013 Remote Learner.net Inc http://www.remote-learner.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright (C) 2008-2013 Remote-Learner.net Inc (http://www.remote-learner.net)
*
*/

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

/**
* custom class that handles the versioning structure for RLIP file plugins
*/
class plugininfo_rlipfile extends plugininfo_base {

/**
* Gathers and returns the information about all plugins of the given type
*
* @param string $type the name of the plugintype, eg. mod, auth or workshopform
* @param string $typerootdir full path to the location of the plugin dir
* @param string $typeclass the name of the actually called class
* @return array of plugintype classes, indexed by the plugin name
*/
static function get_plugins($plugintype, $plugintyperootdir, $plugintypeclass) {
global $CFG, $DB;

// track our method result
$result = array();
if (!$DB->get_manager()->table_exists('config_plugins')) {
return $result;
}

// obtain the list of all file plugins
$fileplugins = get_plugin_list('rlipfile');

foreach ($fileplugins as $pluginname => $pluginpath) {
if ($pluginname == 'phpunit') {
// phpunit directory is a false-positive
continue;
}

// set up the main plugin information
$instance = new $plugintypeclass();
$instance->type = $plugintype;
$instance->typerootdir = $plugintyperootdir;
$instance->name = 'rlipfile_'.$pluginname;
$instance->rootdir = $pluginpath;
$instance->displayname = get_string('pluginname', $instance->name);

// track the current database version
$versiondb = get_config($instance->name, 'version');
$instance->versiondb = ($versiondb !== false) ? $versiondb : NULL;

// track the proposed new version
$plugin = new stdClass;
include("{$instance->rootdir}/version.php");
$instance->versiondisk = $plugin->version;
$instance->init_is_standard(); //is this really needed?
// append to results
$result[$instance->name] = $instance;
}

return $result;
}
}

/**
* custom class that handles the versioning structure for RLIP import plugins
*/
class plugininfo_rlipimport extends plugininfo_base {

/**
* Gathers and returns the information about all plugins of the given type
*
* @param string $type the name of the plugintype, eg. mod, auth or workshopform
* @param string $typerootdir full path to the location of the plugin dir
* @param string $typeclass the name of the actually called class
* @return array of plugintype classes, indexed by the plugin name
*/
static function get_plugins($plugintype, $plugintyperootdir, $plugintypeclass) {
global $CFG, $DB;

// track our method result
$result = array();
if (!$DB->get_manager()->table_exists('config_plugins')) {
return $result;
}

// obtain the list of all file plugins
$fileplugins = get_plugin_list('rlipimport');

foreach ($fileplugins as $pluginname => $pluginpath) {
// error_log("rlipimport::subplugin: {$pluginname}");
if (!file_exists("{$pluginpath}/version.php")) {
// test/sample directories false-positive
continue;
}

// set up the main plugin information
$instance = new $plugintypeclass();
$instance->type = $plugintype;
$instance->typerootdir = $plugintyperootdir;
$instance->name = 'rlipimport_'.$pluginname;
$instance->rootdir = $pluginpath;
$instance->displayname = get_string('pluginname', $instance->name);

// track the current database version
$versiondb = get_config($instance->name, 'version');
$instance->versiondb = ($versiondb !== false) ? $versiondb : NULL;

// track the proposed new version
$plugin = new stdClass;
include("{$instance->rootdir}/version.php");
$instance->versiondisk = $plugin->version;
$instance->init_is_standard(); //is this really needed?
// append to results
$result[$instance->name] = $instance;
}

return $result;
}
}

123 changes: 0 additions & 123 deletions block_rlip.php

This file was deleted.

63 changes: 63 additions & 0 deletions classes/plugininfo/dhexport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php
/**
* ELIS(TM): Enterprise Learning Intelligence Suite
* Copyright (C) 2008-2013 Remote-Learner.net Inc (http://www.remote-learner.net)
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package local_datahub
* @author Remote-Learner.net Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright (C) 2008-2013 Remote Learner.net Inc (http://www.remote-learner.net)
*
*/

namespace local_datahub\plugininfo;

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

/**
* This class defines dhexport subplugininfo
*/
class dhexport extends \core\plugininfo\base {
/** @var string the plugintype name, eg. mod, auth or workshopform */
public $type = 'local';
/** @var string full path to the location of all the plugins of this type */
public $typerootdir = '/local/datahub/dhexport/';
/** @var string the plugin name, eg. assignment, ldap */
public $name = 'eliscore';
/** @var string the localized plugin name */
public $displayname = 'Datahub export subplugins';
/** @var string the plugin source, one of core_plugin_manager::PLUGIN_SOURCE_xxx constants */
public $source;
/** @var string fullpath to the location of this plugin */
public $rootdir;
/** @var int|string the version of the plugin's source code */
public $versiondisk;
/** @var int|string the version of the installed plugin */
public $versiondb;
/** @var int|float|string required version of Moodle core */
public $versionrequires;
/** @var mixed human-readable release information */
/** @var mixed human-readable release information */
public $release = '2.6.0.0';
/** @var array other plugins that this one depends on, lazy-loaded by {@link get_other_required_plugins()} */
public $dependencies;
/** @var int number of instances of the plugin - not supported yet */
public $instances;
/** @var int order of the plugin among other plugins of the same type - not supported yet */
public $sortorder;
/** @var array|null array of {@link \core\update\info} for this plugin */
public $availableupdates;
}
62 changes: 62 additions & 0 deletions classes/plugininfo/dhfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
/**
* ELIS(TM): Enterprise Learning Intelligence Suite
* Copyright (C) 2008-2013 Remote-Learner.net Inc (http://www.remote-learner.net)
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package local_datahub
* @author Remote-Learner.net Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright (C) 2008-2013 Remote Learner.net Inc (http://www.remote-learner.net)
*
*/

namespace local_datahub\plugininfo;

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

/**
* This class defines dhfile subplugininfo
*/
class dhfile extends \core\plugininfo\base {
/** @var string the plugintype name, eg. mod, auth or workshopform */
public $type = 'local';
/** @var string full path to the location of all the plugins of this type */
public $typerootdir = '/local/datahub/dhfile/';
/** @var string the plugin name, eg. assignment, ldap */
public $name = 'dhfile';
/** @var string the localized plugin name */
public $displayname = 'Datahub file subplugins';
/** @var string the plugin source, one of core_plugin_manager::PLUGIN_SOURCE_xxx constants */
public $source;
/** @var string fullpath to the location of this plugin */
public $rootdir;
/** @var int|string the version of the plugin's source code */
public $versiondisk;
/** @var int|string the version of the installed plugin */
public $versiondb;
/** @var int|float|string required version of Moodle core */
public $versionrequires;
/** @var mixed human-readable release information */
public $release = '2.6.0.0';
/** @var array other plugins that this one depends on, lazy-loaded by {@link get_other_required_plugins()} */
public $dependencies;
/** @var int number of instances of the plugin - not supported yet */
public $instances;
/** @var int order of the plugin among other plugins of the same type - not supported yet */
public $sortorder;
/** @var array|null array of {@link \core\update\info} for this plugin */
public $availableupdates;
}
Loading

0 comments on commit deb3120

Please sign in to comment.