diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php index ef15049a11c..c84a68f290a 100644 --- a/backup/moodle2/restore_stepslib.php +++ b/backup/moodle2/restore_stepslib.php @@ -5378,7 +5378,7 @@ class restore_process_file_aliases_queue extends restore_execution_step { } } else { - // This is a reference to some external file such as in boxnet or dropbox. + // This is a reference to some external file such as dropbox. // If we are restoring to the same site, keep the reference untouched and // restore the alias as is. if ($this->task->is_samesite()) { diff --git a/lib/boxlib.php b/lib/boxlib.php deleted file mode 100644 index 5e03c41354b..00000000000 --- a/lib/boxlib.php +++ /dev/null @@ -1,268 +0,0 @@ -. - -/** - * Box.net client. - * - * @package core - * @author James Levy - * @link http://enabled.box.net - * @access public - * @version 1.0 - * @copyright copyright Box.net 2007 - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); -require_once($CFG->libdir . '/oauthlib.php'); - -/** - * Box.net client class. - * - * @package core - * @copyright 2013 Frédéric Massart - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class boxnet_client extends oauth2_client { - - /** @const API URL */ - const API = 'https://api.box.com/2.0'; - - /** @const UPLOAD_API URL */ - const UPLOAD_API = 'https://upload.box.com/api/2.0'; - - /** - * Return authorize URL. - * - * @return string - */ - protected function auth_url() { - return 'https://www.box.com/api/oauth2/authorize'; - } - - /** - * Create a folder. - * - * @param string $foldername The folder name. - * @param int $parentid The ID of the parent folder. - * @return array Information about the new folder. - */ - public function create_folder($foldername, $parentid = 0) { - $params = array('name' => $foldername, 'parent' => array('id' => (string) $parentid)); - $this->reset_state(); - $result = $this->post($this->make_url("/folders"), json_encode($params)); - $result = json_decode($result); - return $result; - } - - /** - * Download the file. - * - * @param int $fileid File ID. - * @param string $path Path to download the file to. - * @return bool Success or not. - */ - public function download_file($fileid, $path) { - $this->reset_state(); - $result = $this->download_one($this->make_url("/files/$fileid/content"), array(), - array('filepath' => $path, 'CURLOPT_FOLLOWLOCATION' => true)); - return ($result === true && $this->info['http_code'] === 200); - } - - /** - * Get info of a file. - * - * @param int $fileid File ID. - * @return object - */ - public function get_file_info($fileid) { - $this->reset_state(); - $result = $this->request($this->make_url("/files/$fileid")); - return json_decode($result); - } - - /** - * Get a folder content. - * - * @param int $folderid Folder ID. - * @return object - */ - public function get_folder_items($folderid = 0) { - $this->reset_state(); - $result = $this->request($this->make_url("/folders/$folderid/items", - array('fields' => 'id,name,type,modified_at,size,owned_by'))); - return json_decode($result); - } - - /** - * Log out. - * - * @return void - */ - public function log_out() { - if ($accesstoken = $this->get_accesstoken()) { - $params = array( - 'client_id' => $this->get_clientid(), - 'client_secret' => $this->get_clientsecret(), - 'token' => $accesstoken->token - ); - $this->reset_state(); - $this->post($this->revoke_url(), $params); - } - parent::log_out(); - } - - /** - * Build a request URL. - * - * @param string $uri The URI to request. - * @param array $params Query string parameters. - * @param bool $uploadapi Whether this works with the upload API or not. - * @return string - */ - protected function make_url($uri, $params = array(), $uploadapi = false) { - $api = $uploadapi ? self::UPLOAD_API : self::API; - $url = new moodle_url($api . '/' . ltrim($uri, '/'), $params); - return $url->out(false); - } - - /** - * Rename a file. - * - * @param int $fileid The file ID. - * @param string $newname The new file name. - * @return object Box.net file object. - */ - public function rename_file($fileid, $newname) { - // This requires a PUT request with data within it. We cannot use - // the standard PUT request 'CURLOPT_PUT' because it expects a file. - $data = array('name' => $newname); - $options = array( - 'CURLOPT_CUSTOMREQUEST' => 'PUT', - 'CURLOPT_POSTFIELDS' => json_encode($data) - ); - $url = $this->make_url("/files/$fileid"); - $this->reset_state(); - $result = $this->request($url, $options); - $result = json_decode($result); - return $result; - } - - /** - * Resets curl for multiple requests. - * - * @return void - */ - public function reset_state() { - $this->cleanopt(); - $this->resetHeader(); - } - - /** - * Return the revoke URL. - * - * @return string - */ - protected function revoke_url() { - return 'https://www.box.com/api/oauth2/revoke'; - } - - /** - * Share a file and return the link to it. - * - * @param string $fileid The file ID. - * @param bool $businesscheck Whether or not to check if the user can share files, has a business account. - * @return object - */ - public function share_file($fileid, $businesscheck = true) { - // Sharing the file, this requires a PUT request with data within it. We cannot use - // the standard PUT request 'CURLOPT_PUT' because it expects a file. - $data = array('shared_link' => array('access' => 'open', 'permissions' => - array('can_download' => true, 'can_preview' => true))); - $options = array( - 'CURLOPT_CUSTOMREQUEST' => 'PUT', - 'CURLOPT_POSTFIELDS' => json_encode($data) - ); - $this->reset_state(); - $result = $this->request($this->make_url("/files/$fileid"), $options); - $result = json_decode($result); - - if ($businesscheck) { - // Checks that the user has the right to share the file. If not, throw an exception. - $this->reset_state(); - $this->head($result->shared_link->download_url); - $info = $this->get_info(); - if ($info['http_code'] == 403) { - throw new moodle_exception('No permission to share the file'); - } - } - - return $result->shared_link; - } - - /** - * Search. - * - * @return object - */ - public function search($query) { - $this->reset_state(); - $result = $this->request($this->make_url('/search', array('query' => $query, 'limit' => 50, 'offset' => 0))); - return json_decode($result); - } - - /** - * Return token URL. - * - * @return string - */ - protected function token_url() { - return 'https://www.box.com/api/oauth2/token'; - } - - /** - * Upload a file. - * - * Please note that the file is named on Box.net using the path we are providing, and so - * the file has the name of the stored_file hash. - * - * @param stored_file $storedfile A stored_file. - * @param integer $parentid The ID of the parent folder. - * @return object Box.net file object. - */ - public function upload_file(stored_file $storedfile, $parentid = 0) { - $url = $this->make_url('/files/content', array(), true); - $options = array( - 'filename' => $storedfile, - 'parent_id' => $parentid - ); - $this->reset_state(); - $result = $this->post($url, $options); - $result = json_decode($result); - return $result; - } - -} - -/** - * @deprecated since 2.6, 2.5.3, 2.4.7 - */ -class boxclient { - public function __construct() { - throw new coding_exception(__CLASS__ . ' has been removed. Please update your code to use boxnet_client.', - DEBUG_DEVELOPER); - } -} diff --git a/lib/classes/plugin_manager.php b/lib/classes/plugin_manager.php index 6ea59bc189e..1c48fbf7a92 100644 --- a/lib/classes/plugin_manager.php +++ b/lib/classes/plugin_manager.php @@ -1733,12 +1733,12 @@ class core_plugin_manager { 'enrol' => array('authorize'), 'filter' => array('censor'), 'media' => array('swf'), - 'portfolio' => array('picasa'), + 'portfolio' => array('picasa', 'boxnet'), 'qformat' => array('webct'), 'message' => array('jabber'), 'quizaccess' => array('safebrowser'), 'report' => array('search'), - 'repository' => array('alfresco', 'picasa', 'skydrive'), + 'repository' => array('alfresco', 'picasa', 'skydrive', 'boxnet'), 'tinymce' => array('dragmath'), 'tool' => array('bloglevelupgrade', 'qeupgradehelper', 'timezoneimport', 'assignmentupgrade', 'health'), 'theme' => array('bootstrapbase', 'clean', 'more', 'afterburner', 'anomaly', 'arialist', 'base', @@ -1942,7 +1942,7 @@ class core_plugin_manager { ), 'portfolio' => array( - 'boxnet', 'download', 'flickr', 'googledocs', 'mahara' + 'download', 'flickr', 'googledocs', 'mahara' ), 'profilefield' => array( @@ -2002,7 +2002,7 @@ class core_plugin_manager { ), 'repository' => array( - 'areafiles', 'boxnet', 'contentbank', 'coursefiles', 'dropbox', 'equella', 'filesystem', + 'areafiles', 'contentbank', 'coursefiles', 'dropbox', 'equella', 'filesystem', 'flickr', 'flickr_public', 'googledocs', 'local', 'merlot', 'nextcloud', 'onedrive', 'recent', 's3', 'upload', 'url', 'user', 'webdav', 'wikimedia', 'youtube' diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index e3126338c6a..0f430c7ac27 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -3040,5 +3040,48 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2021102600.01); } + if ($oldversion < 2021102900.00) { + // If portfolio_boxnet is no longer present, remove it. + if (!file_exists($CFG->dirroot . '/portfolio/boxnet/version.php')) { + $instance = $DB->get_record('portfolio_instance', ['plugin' => 'boxnet']); + if (!empty($instance)) { + // Remove all records from portfolio_instance_config. + $DB->delete_records('portfolio_instance_config', ['instance' => $instance->id]); + // Remove all records from portfolio_instance_user. + $DB->delete_records('portfolio_instance_user', ['instance' => $instance->id]); + // Remove all records from portfolio_log. + $DB->delete_records('portfolio_log', ['portfolio' => $instance->id]); + // Remove all records from portfolio_tempdata. + $DB->delete_records('portfolio_tempdata', ['instance' => $instance->id]); + // Remove the record from the portfolio_instance table. + $DB->delete_records('portfolio_instance', ['id' => $instance->id]); + } + + // Clean config. + unset_all_config_for_plugin('portfolio_boxnet'); + } + + // If repository_boxnet is no longer present, remove it. + if (!file_exists($CFG->dirroot . '/repository/boxnet/version.php')) { + $instance = $DB->get_record('repository', ['type' => 'boxnet']); + if (!empty($instance)) { + // Remove all records from repository_instance_config table. + $DB->delete_records('repository_instance_config', ['instanceid' => $instance->id]); + // Remove all records from repository_instances table. + $DB->delete_records('repository_instances', ['typeid' => $instance->id]); + // Remove the record from the repository table. + $DB->delete_records('repository', ['id' => $instance->id]); + } + + // Clean config. + unset_all_config_for_plugin('repository_boxnet'); + + // Remove orphaned files. + upgrade_delete_orphaned_file_records(); + } + + upgrade_main_savepoint(true, 2021102900.00); + } + return true; } diff --git a/lib/portfolio/plugin.php b/lib/portfolio/plugin.php index 18572f1e98e..9b25f3e5c45 100644 --- a/lib/portfolio/plugin.php +++ b/lib/portfolio/plugin.php @@ -208,7 +208,7 @@ abstract class portfolio_plugin_base { * Eg: things that your subclasses want to keep in state * across the export. * Keys must be in get_allowed_export_config - * This is deliberately not final (see boxnet plugin) + * This is deliberately not final (see googledocs plugin) * @see get_allowed_export_config * * @param array $config named array of config items to set. @@ -402,7 +402,7 @@ abstract class portfolio_plugin_base { * and the request (get and post but not cookie) parameters. * This is useful for external systems that need to redirect the user back * with some extra data in the url (like auth tokens etc) - * for an example implementation, see boxnet portfolio plugin. + * for an example implementation, see googledocs portfolio plugin. * * @param int $stage the stage before control was stolen * @param array $params a merge of $_GET and $_POST diff --git a/lib/upgrade.txt b/lib/upgrade.txt index af52a327023..989373f5a9e 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -2,6 +2,7 @@ This files describes API changes in core libraries and APIs, information provided here is intended especially for developers. === 4.0 === +* Since Boxnet has been remove from core then boxnet_client() class has been removed from core too. * New navigation classes to mimic the new navigation project. The existing navigation callbacks are still available and will be called. The following behaviour will be the new standard for nodes added via callbacks: - Module nodes added will be appended to the end and will appear within the hamburger option. diff --git a/portfolio/boxnet/classes/privacy/provider.php b/portfolio/boxnet/classes/privacy/provider.php deleted file mode 100644 index 354bff812bb..00000000000 --- a/portfolio/boxnet/classes/privacy/provider.php +++ /dev/null @@ -1,80 +0,0 @@ -. - -/** - * Privacy class for requesting user data. - * - * @package portfolio_boxnet - * @copyright 2018 Jake Dallimore - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -namespace portfolio_boxnet\privacy; - -defined('MOODLE_INTERNAL') || die(); - -use core_privacy\local\metadata\collection; - -/** - * Provider for the portfolio_boxnet plugin. - * - * @copyright 2018 Jake Dallimore - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class provider implements - // This portfolio plugin does not store any data itself. - // It has no database tables, and it purely acts as a conduit, sending data externally. - \core_privacy\local\metadata\provider, - \core_portfolio\privacy\portfolio_provider { - - /** - * Returns meta data about this system. - * - * @param collection $collection The initialised collection to add items to. - * @return collection A listing of user data stored through this system. - */ - public static function get_metadata(collection $collection) : collection { - return $collection->add_external_location_link('box.net', ['data' => 'privacy:metadata:data'], - 'privacy:metadata'); - } - - /** - * Export all portfolio data from each portfolio plugin for the specified userid and context. - * - * @param int $userid The user to export. - * @param \context $context The context to export. - * @param array $subcontext The subcontext within the context to export this information to. - * @param array $linkarray The weird and wonderful link array used to display information for a specific item - */ - public static function export_portfolio_user_data(int $userid, \context $context, array $subcontext, array $linkarray) { - } - - /** - * Delete all user information for the provided context. - * - * @param \context $context The context to delete user data for. - */ - public static function delete_portfolio_for_context(\context $context) { - } - - /** - * Delete all user information for the provided user and context. - * - * @param int $userid The user to delete - * @param \context $context The context to refine the deletion. - */ - public static function delete_portfolio_for_user(int $userid, \context $context) { - } -} diff --git a/portfolio/boxnet/db/upgrade.php b/portfolio/boxnet/db/upgrade.php deleted file mode 100644 index 695ed646393..00000000000 --- a/portfolio/boxnet/db/upgrade.php +++ /dev/null @@ -1,49 +0,0 @@ -. - -/** - * Upgrade. - * - * @package portfolio_boxnet - * @copyright 2013 Frédéric Massart - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -/** - * Upgrade function. - * - * @param int $oldversion the version we are upgrading from. - * @return bool result - */ -function xmldb_portfolio_boxnet_upgrade($oldversion) { - global $CFG; - - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.9.0 release upgrade line. - // Put any upgrade step following this. - - return true; -} diff --git a/portfolio/boxnet/lang/en/portfolio_boxnet.php b/portfolio/boxnet/lang/en/portfolio_boxnet.php deleted file mode 100644 index 93fae8433f8..00000000000 --- a/portfolio/boxnet/lang/en/portfolio_boxnet.php +++ /dev/null @@ -1,53 +0,0 @@ -. - -/** - * Strings for component 'portfolio_boxnet', language 'en', branch 'MOODLE_20_STABLE' - * - * @package portfolio_boxnet - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -$string['clientid'] = 'Client ID'; -$string['clientsecret'] = 'Client secret'; -$string['existingfolder'] = 'Existing folder to put file(s) into'; -$string['folderclash'] = 'The folder you asked to create already exists!'; -$string['foldercreatefailed'] = 'Failed to create your target folder on Box'; -$string['folderlistfailed'] = 'Failed to retrieve a folder listing from Box'; -$string['missinghttps'] = 'HTTPS required'; -$string['missinghttps_help'] = 'Box will only work with an HTTPS enabled website.'; -$string['missingoauthkeys'] = 'Missing client ID and secret'; -$string['missingoauthkeys_help'] = 'There is no client ID or secret configured for this plugin. You can get one of these from Box development page.'; -$string['newfolder'] = 'New folder to put file(s) into'; -$string['noauthtoken'] = 'Could not retrieve an authentication token for use in this session'; -$string['notarget'] = 'You must specify either an existing folder or a new folder to upload into'; -$string['noticket'] = 'Could not retrieve a ticket from Box to begin the authentication session'; -$string['password'] = 'Your Box password (will not be stored)'; -$string['pluginname'] = 'Box'; -$string['privacy:metadata'] = 'This plugin sends data externally to a linked Box account. It does not store data locally.'; -$string['privacy:metadata:data'] = 'Personal data passed through from the portfolio subsystem.'; -$string['sendfailed'] = 'Failed to send content to Box: {$a}'; -$string['setupinfo'] = 'Setup instructions'; -$string['setupinfodetails'] = 'To obtain a client ID and secret, log in to Box and visit the Box developers page. Follow \'Create new application\' and create a new application for your Moodle site. The client ID and secret are displayed in the \'OAuth2 parameters\' section of the application edit form. Optionally, you can also provide other information about your Moodle site.'; -$string['sharedfolder'] = 'Shared'; -$string['sharefile'] = 'Share this file?'; -$string['sharefolder'] = 'Share this new folder?'; -$string['targetfolder'] = 'Target folder'; -$string['tobecreated'] = 'To be created'; -$string['username'] = 'Your Box username (will not be stored)'; -$string['warninghttps'] = 'Box requires your website to be using HTTPS in order for the portfolio to work.'; diff --git a/portfolio/boxnet/lib.php b/portfolio/boxnet/lib.php deleted file mode 100644 index 7b10968f6ef..00000000000 --- a/portfolio/boxnet/lib.php +++ /dev/null @@ -1,230 +0,0 @@ -libdir.'/portfolio/plugin.php'); -require_once($CFG->libdir.'/filelib.php'); -require_once($CFG->libdir.'/boxlib.php'); - -class portfolio_plugin_boxnet extends portfolio_plugin_push_base { - - public $boxclient; - private $ticket; - private $authtoken; - private $folders; - private $accounttree; - - public static function get_name() { - return get_string('pluginname', 'portfolio_boxnet'); - } - - public function prepare_package() { - // don't do anything for this plugin, we want to send all files as they are. - } - - public function send_package() { - // if we need to create the folder, do it now - if ($newfolder = $this->get_export_config('newfolder')) { - $created = $this->boxclient->create_folder($newfolder); - if (empty($created->id)) { - throw new portfolio_plugin_exception('foldercreatefailed', 'portfolio_boxnet'); - } - $this->folders[$created->id] = $created->name; - $this->set_export_config(array('folder' => $created->id)); - } - foreach ($this->exporter->get_tempfiles() as $file) { - $return = $this->boxclient->upload_file($file, $this->get_export_config('folder')); - if (!empty($result->type) && $result->type == 'error') { - throw new portfolio_plugin_exception('sendfailed', 'portfolio_boxnet', $result->message); - } - $createdfile = reset($return->entries); - if (!empty($createdfile->id)) { - $result = $this->rename_file($createdfile->id, $file->get_filename()); - // If this fails, the file was sent but not renamed. - } - } - } - - public function get_export_summary() { - $allfolders = $this->get_folder_list(); - if ($newfolder = $this->get_export_config('newfolder')) { - $foldername = $newfolder . ' (' . get_string('tobecreated', 'portfolio_boxnet') . ')'; - } else if ($this->get_export_config('folder')) { - $foldername = $allfolders[$this->get_export_config('folder')]; - } else { - $foldername = '/'; - } - return array( - get_string('targetfolder', 'portfolio_boxnet') => s($foldername) - ); - } - - public function get_interactive_continue_url() { - return 'https://app.box.net/files/0/f/' . $this->get_export_config('folder') . '/'; - } - - public function expected_time($callertime) { - // We're forcing this to be run 'interactively' because the plugin - // does not support running in cron. - return PORTFOLIO_TIME_LOW; - } - - public static function has_admin_config() { - return true; - } - - public static function get_allowed_config() { - return array('clientid', 'clientsecret'); - } - - public function has_export_config() { - return true; - } - - public function get_allowed_export_config() { - return array('folder', 'newfolder'); - } - - public function export_config_form(&$mform) { - $folders = $this->get_folder_list(); - $mform->addElement('text', 'plugin_newfolder', get_string('newfolder', 'portfolio_boxnet')); - $mform->setType('plugin_newfolder', PARAM_RAW); - $folders[0] = '/'; - ksort($folders); - $mform->addElement('select', 'plugin_folder', get_string('existingfolder', 'portfolio_boxnet'), $folders); - } - - public function export_config_validation(array $data) { - $allfolders = $this->get_folder_list(); - if (in_array($data['plugin_newfolder'], $allfolders)) { - return array('plugin_newfolder' => get_string('folderclash', 'portfolio_boxnet')); - } - } - - public static function admin_config_form(&$mform) { - global $CFG; - - $mform->addElement('text', 'clientid', get_string('clientid', 'portfolio_boxnet')); - $mform->addRule('clientid', get_string('required'), 'required', null, 'client'); - $mform->setType('clientid', PARAM_RAW_TRIMMED); - - $mform->addElement('text', 'clientsecret', get_string('clientsecret', 'portfolio_boxnet')); - $mform->addRule('clientsecret', get_string('required'), 'required', null, 'client'); - $mform->setType('clientsecret', PARAM_RAW_TRIMMED); - - $a = new stdClass(); - $a->servicesurl = 'https://app.box.com/developers/services'; - $mform->addElement('static', 'setupinfo', get_string('setupinfo', 'portfolio_boxnet'), - get_string('setupinfodetails', 'portfolio_boxnet', $a)); - - if (!is_https()) { - $mform->addElement('static', 'warninghttps', '', get_string('warninghttps', 'portfolio_boxnet')); - } - } - - public function steal_control($stage) { - if ($stage != PORTFOLIO_STAGE_CONFIG) { - return false; - } - if (empty($this->boxclient)) { - $returnurl = new moodle_url('/portfolio/add.php', array('postcontrol' => 1, 'type' => 'boxnet', - 'sesskey' => sesskey())); - $this->boxclient = new boxnet_client($this->get_config('clientid'), $this->get_config('clientsecret'), $returnurl, ''); - } - if ($this->boxclient->is_logged_in()) { - return false; - } - return $this->boxclient->get_login_url(); - } - - public function post_control($stage, $params) { - if ($stage != PORTFOLIO_STAGE_CONFIG) { - return; - } - if (!$this->boxclient->is_logged_in()) { - throw new portfolio_plugin_exception('noauthtoken', 'portfolio_boxnet'); - } - } - - /** - * Get the folder list. - * - * This is limited to the folders in the root folder. - * - * @return array of folders. - */ - protected function get_folder_list() { - if (empty($this->folders)) { - $folders = array(); - $result = $this->boxclient->get_folder_items(); - foreach ($result->entries as $item) { - if ($item->type != 'folder') { - continue; - } - $folders[$item->id] = $item->name; - if (!empty($item->shared)) { - $folders[$item->id] .= ' (' . get_string('sharedfolder', 'portfolio_boxnet') . ')'; - } - } - $this->folders = $folders; - } - return $this->folders; - } - - /** - * Rename a file. - * - * If the name is already taken, we append the current date to the file - * to prevent name conflicts. - * - * @param int $fileid The file ID. - * @param string $newname The new name. - * @return bool Whether it succeeded or not. - */ - protected function rename_file($fileid, $newname) { - $result = $this->boxclient->rename_file($fileid, $newname); - if (!empty($result->type) && $result->type == 'error') { - $bits = explode('.', $newname); - $suffix = ''; - if (count($bits) == 1) { - $prefix = $newname; - } else { - $suffix = '.' . array_pop($bits); - $prefix = implode('.', $bits); - } - $newname = $prefix . ' (' . date('Y-m-d H-i-s') . ')' . $suffix; - $result = $this->boxclient->rename_file($fileid, $newname); - if (empty($result->type) || $result->type != 'error') { - return true; - } else { - // We could not rename the file for some reason... - debugging('Error while renaming the file on Box.net', DEBUG_DEVELOPER); - } - } else { - return true; - } - return false; - } - - public function instance_sanity_check() { - global $CFG; - if (!$this->get_config('clientid') || !$this->get_config('clientsecret')) { - return 'missingoauthkeys'; - } else if (!is_https()) { - return 'missinghttps'; - } - } - - public static function allows_multiple_instances() { - return false; - } - - public function supported_formats() { - return array(PORTFOLIO_FORMAT_FILE, PORTFOLIO_FORMAT_RICHHTML); - } - - /* - * for now , boxnet doesn't support this, - * because we can't dynamically construct return urls. - */ - public static function allows_multiple_exports() { - return false; - } -} diff --git a/portfolio/boxnet/tests/privacy_provider_test.php b/portfolio/boxnet/tests/privacy_provider_test.php deleted file mode 100644 index efbd3549d56..00000000000 --- a/portfolio/boxnet/tests/privacy_provider_test.php +++ /dev/null @@ -1,46 +0,0 @@ -. - -/** - * Privacy provider tests. - * - * @package portfolio_boxnet - * @copyright 2018 Jake Dallimore - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -/** - * Privacy provider tests class. - * - * @copyright 2018 Jake Dallimore - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class portfolio_boxnet_privacy_provider_test extends \core_privacy\tests\provider_testcase { - - /** - * Verify that a collection of metadata is returned for this component and that it just links to an external location. - */ - public function test_get_metadata() { - $collection = new \core_privacy\local\metadata\collection('portfolio_boxnet'); - $collection = \portfolio_boxnet\privacy\provider::get_metadata($collection); - $this->assertNotEmpty($collection); - $items = $collection->get_collection(); - $this->assertEquals(1, count($items)); - $this->assertInstanceOf(\core_privacy\local\metadata\types\external_location::class, $items[0]); - } -} diff --git a/portfolio/boxnet/version.php b/portfolio/boxnet/version.php deleted file mode 100644 index b90568cffac..00000000000 --- a/portfolio/boxnet/version.php +++ /dev/null @@ -1,30 +0,0 @@ -. - -/** - * Version details - * - * @package portfolio - * @subpackage boxnet - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX). -$plugin->requires = 2021052500; // Requires this Moodle version. -$plugin->component = 'portfolio_boxnet'; // Full name of the plugin (used for diagnostics) -$plugin->cron = 0; diff --git a/portfolio/upgrade.txt b/portfolio/upgrade.txt index 95828802969..582a9c0d4d0 100644 --- a/portfolio/upgrade.txt +++ b/portfolio/upgrade.txt @@ -3,6 +3,7 @@ information provided here is intended especially for developers. === 4.0 === +* The portfolio_boxnet has been completely removed. * The portfolio_picasa has been completely removed (Picasa is discontinued since 2016). === 3.7 === diff --git a/repository/boxnet/classes/privacy/provider.php b/repository/boxnet/classes/privacy/provider.php deleted file mode 100644 index e75b9a4a83c..00000000000 --- a/repository/boxnet/classes/privacy/provider.php +++ /dev/null @@ -1,114 +0,0 @@ -. - -/** - * Privacy Subsystem implementation for repository_boxnet. - * - * @package repository_boxnet - * @copyright 2018 Zig Tan - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -namespace repository_boxnet\privacy; - -use core_privacy\local\metadata\collection; -use core_privacy\local\request\approved_contextlist; -use core_privacy\local\request\approved_userlist; -use core_privacy\local\request\context; -use core_privacy\local\request\contextlist; -use core_privacy\local\request\userlist; - -defined('MOODLE_INTERNAL') || die(); - -/** - * Privacy Subsystem for repository_boxnet implementing metadata and plugin providers. - * - * @copyright 2018 Zig Tan - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class provider implements - \core_privacy\local\metadata\provider, - \core_privacy\local\request\core_userlist_provider, - \core_privacy\local\request\plugin\provider { - - /** - * Returns meta data about this system. - * - * @param collection $collection The initialised collection to add items to. - * @return collection A listing of user data stored through this system. - */ - public static function get_metadata(collection $collection) : collection { - $collection->add_external_location_link( - 'box.com', - [ - 'query' => 'privacy:metadata:repository_boxnet:query' - ], - 'privacy:metadata:repository_boxnet' - ); - - return $collection; - } - - /** - * Get the list of contexts that contain user information for the specified user. - * - * @param int $userid The user to search. - * @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin. - */ - public static function get_contexts_for_userid(int $userid) : contextlist { - return new contextlist(); - } - - /** - * Get the list of users who have data within a context. - * - * @param userlist $userlist The userlist containing the list of users who have data in this context/plugin combination. - */ - public static function get_users_in_context(userlist $userlist) { - } - - /** - * Export all user data for the specified user, in the specified contexts. - * - * @param approved_contextlist $contextlist The approved contexts to export information for. - */ - public static function export_user_data(approved_contextlist $contextlist) { - } - - /** - * Delete all data for all users in the specified context. - * - * @param context $context The specific context to delete data for. - */ - public static function delete_data_for_all_users_in_context(\context $context) { - } - - /** - * Delete all user data for the specified user, in the specified contexts. - * - * @param approved_contextlist $contextlist The approved contexts and user information to delete information for. - */ - public static function delete_data_for_user(approved_contextlist $contextlist) { - } - - /** - * Delete multiple users within a single context. - * - * @param approved_userlist $userlist The approved context and user information to delete information for. - */ - public static function delete_data_for_users(approved_userlist $userlist) { - } -} diff --git a/repository/boxnet/db/access.php b/repository/boxnet/db/access.php deleted file mode 100644 index 52cbaad208a..00000000000 --- a/repository/boxnet/db/access.php +++ /dev/null @@ -1,37 +0,0 @@ -. - -/** - * Plugin capabilities. - * - * @package repository_boxnet - * @copyright 2009 Dongsheng Cai - * @author Dongsheng Cai - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -$capabilities = array( - - 'repository/boxnet:view' => array( - 'captype' => 'read', - 'contextlevel' => CONTEXT_MODULE, - 'archetypes' => array( - 'user' => CAP_ALLOW - ) - ) -); diff --git a/repository/boxnet/db/upgrade.php b/repository/boxnet/db/upgrade.php deleted file mode 100644 index eed26f959fe..00000000000 --- a/repository/boxnet/db/upgrade.php +++ /dev/null @@ -1,49 +0,0 @@ -. - -/** - * Upgrade. - * - * @package repository_boxnet - * @copyright 2013 Frédéric Massart - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -/** - * Upgrade function. - * - * @param int $oldversion the version we are upgrading from. - * @return bool result - */ -function xmldb_repository_boxnet_upgrade($oldversion) { - global $CFG; - - // Automatically generated Moodle v3.6.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.7.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.8.0 release upgrade line. - // Put any upgrade step following this. - - // Automatically generated Moodle v3.9.0 release upgrade line. - // Put any upgrade step following this. - - return true; -} diff --git a/repository/boxnet/lang/en/repository_boxnet.php b/repository/boxnet/lang/en/repository_boxnet.php deleted file mode 100644 index 85f085bc058..00000000000 --- a/repository/boxnet/lang/en/repository_boxnet.php +++ /dev/null @@ -1,44 +0,0 @@ -. - -/** - * Strings for component 'repository_boxnet', language 'en', branch 'MOODLE_20_STABLE' - * - * @package repository_boxnet - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -$string['apikey'] = 'API key'; -$string['boxnet:view'] = 'View Box repository'; -$string['cannotcreatereference'] = 'Cannot create a reference, not enough permissions to share the file on Box.'; -$string['clientid'] = 'Client ID'; -$string['clientsecret'] = 'Client secret'; -$string['configplugin'] = 'Box configuration'; -$string['filesourceinfo'] = 'Box ({$a->fullname}): {$a->filename}'; -$string['information'] = 'Get a client ID and secret from the Box developer page for your Moodle site.'; -$string['invalidpassword'] = 'Invalid password'; -$string['nullfilelist'] = 'There are no files in this repository'; -$string['password'] = 'Password'; -$string['pluginname_help'] = 'Repository on Box'; -$string['pluginname'] = 'Box'; -$string['saved'] = 'Box data saved'; -$string['shareurl'] = 'Share URL'; -$string['username'] = 'Username for Box'; -$string['warninghttps'] = 'Box requires your website to be using HTTPS in order for the repository to work.'; -$string['privacy:metadata:repository_boxnet'] = 'The Box repository plugin does not store any personal data, but does transmit user data from Moodle to the remote system.'; -$string['privacy:metadata:repository_boxnet:query'] = 'The Box repository user search text query.'; diff --git a/repository/boxnet/lib.php b/repository/boxnet/lib.php deleted file mode 100644 index 88b8b58598f..00000000000 --- a/repository/boxnet/lib.php +++ /dev/null @@ -1,493 +0,0 @@ -. - -/** - * This plugin is used to access box.net repository - * - * @since Moodle 2.0 - * @package repository_boxnet - * @copyright 2010 Dongsheng Cai {@link http://dongsheng.org} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -require_once($CFG->dirroot . '/repository/lib.php'); -require_once($CFG->libdir . '/boxlib.php'); - -/** - * repository_boxnet class implements box.net client - * - * @since Moodle 2.0 - * @package repository_boxnet - * @copyright 2010 Dongsheng Cai {@link http://dongsheng.org} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class repository_boxnet extends repository { - - /** @const MANAGE_URL Manage URL. */ - const MANAGE_URL = 'https://app.box.com/files'; - - /** @const SESSION_PREFIX Key used to store information in the session. */ - const SESSION_PREFIX = 'repository_boxnet'; - - /** @var string Client ID */ - protected $clientid; - - /** @var string Client secret */ - protected $clientsecret; - - /** @var string Access token */ - protected $accesstoken; - - /** @var object Box.net object */ - protected $boxnetclient; - - /** - * Constructor - * - * @param int $repositoryid - * @param stdClass $context - * @param array $options - */ - public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) { - parent::__construct($repositoryid, $context, $options); - - $clientid = get_config('boxnet', 'clientid'); - $clientsecret = get_config('boxnet', 'clientsecret'); - $returnurl = new moodle_url('/repository/repository_callback.php'); - $returnurl->param('callback', 'yes'); - $returnurl->param('repo_id', $this->id); - $returnurl->param('sesskey', sesskey()); - - $this->boxnetclient = new boxnet_client($clientid, $clientsecret, $returnurl, ''); - } - - /** - * Construct a breadcrumb from a path. - * - * @param string $fullpath Path containing multiple parts separated by slashes. - * @return array Array expected to be generated in {@link self::get_listing()}. - */ - protected function build_breadcrumb($fullpath) { - $breadcrumb = array(array( - 'name' => get_string('pluginname', 'repository_boxnet'), - 'path' => '' - )); - $breadcrumbpath = ''; - $crumbs = explode('/', $fullpath); - foreach ($crumbs as $crumb) { - if (empty($crumb)) { - // That is probably the root crumb, we've already added it. - continue; - } - list($unused, $tosplit) = explode(':', $crumb, 2); - if (strpos($tosplit, '|') !== false) { - list($id, $crumbname) = explode('|', $tosplit, 2); - } else { - $crumbname = $tosplit; - } - $breadcrumbpath .= '/' . $crumb; - $breadcrumb[] = array( - 'name' => urldecode($crumbname), - 'path' => $breadcrumbpath - ); - } - return $breadcrumb; - } - - /** - * Build a part of the path. - * - * This is used to construct the path that the user is currently browsing. - * It must contain a 'type', and a 'value'. Then it can also contain a - * 'name' which is very useful to prevent extra queries to get the name only. - * - * See {@link self::split_part} to extra the information from a part. - * - * @param string $type Type of part, typically 'folder' or 'search'. - * @param string $value The value of the part, eg. a folder ID or search terms. - * @param string $name The name of the part. - * @return string type:value or type:value|name - */ - protected function build_part($type, $value, $name = '') { - $return = $type . ':' . urlencode($value); - if ($name !== '') { - $return .= '|' . urlencode($name); - } - return $return; - } - - /** - * Extract information from a part of path. - * - * @param string $part value generated from {@link self::build_parth()}. - * @return array containing type, value and name. - */ - protected function split_part($part) { - list($type, $tosplit) = explode(':', $part); - $name = ''; - if (strpos($tosplit, '|') !== false) { - list($value, $name) = explode('|', $tosplit, 2); - } else { - $value = $tosplit; - } - return array($type, urldecode($value), urldecode($name)); - } - - /** - * check if user logged - * - * @return boolean - */ - public function check_login() { - return $this->boxnetclient->is_logged_in(); - } - - /** - * reset auth token - * - * @return string - */ - public function logout() { - if ($this->check_login()) { - $this->boxnetclient->log_out(); - } - return $this->print_login(); - } - - /** - * Search files from box.net - * - * @param string $search_text - * @return mixed - */ - public function search($search_text, $page = 0) { - return $this->get_listing($this->build_part('search', $search_text)); - } - - /** - * Downloads a repository file and saves to a path. - * - * @param string $ref reference to the file - * @param string $filename to save file as - * @return array - */ - public function get_file($ref, $filename = '') { - global $CFG; - - $ref = unserialize(self::convert_to_valid_reference($ref)); - $path = $this->prepare_file($filename); - if (!empty($ref->downloadurl)) { - $c = new curl(); - $result = $c->download_one($ref->downloadurl, null, array('filepath' => $filename, - 'timeout' => $CFG->repositorygetfiletimeout, 'followlocation' => true)); - $info = $c->get_info(); - if ($result !== true || !isset($info['http_code']) || $info['http_code'] != 200) { - throw new moodle_exception('errorwhiledownload', 'repository', '', $result); - } - } else { - if (!$this->boxnetclient->download_file($ref->fileid, $path)) { - throw new moodle_exception('cannotdownload', 'repository'); - } - } - return array('path' => $path); - } - - /** - * Get file listing - * - * @param string $path - * @param string $page - * @return mixed - */ - public function get_listing($fullpath = '', $page = ''){ - global $OUTPUT; - - $ret = array(); - $ret['list'] = array(); - $ret['manage'] = self::MANAGE_URL; - $ret['dynload'] = true; - - $crumbs = explode('/', $fullpath); - $path = array_pop($crumbs); - - if (empty($path)) { - $type = 'folder'; - $pathid = 0; - $pathname = get_string('pluginname', 'repository_boxnet'); - } else { - list($type, $pathid, $pathname) = $this->split_part($path); - } - - $ret['path'] = $this->build_breadcrumb($fullpath); - $folders = array(); - $files = array(); - - if ($type == 'search') { - $result = $this->boxnetclient->search($pathname); - } else { - $result = $this->boxnetclient->get_folder_items($pathid); - } - foreach ($result->entries as $item) { - if ($item->type == 'folder') { - $folders[$item->name . ':' . $item->id] = array( - 'title' => $item->name, - 'path' => $fullpath . '/' . $this->build_part('folder', $item->id, $item->name), - 'date' => strtotime($item->modified_at), - 'thumbnail' => $OUTPUT->image_url(file_folder_icon(64))->out(false), - 'thumbnail_height' => 64, - 'thumbnail_width' => 64, - 'children' => array(), - 'size' => $item->size, - ); - } else { - $files[$item->name . ':' . $item->id] = array( - 'title' => $item->name, - 'source' => $this->build_part('file', $item->id, $item->name), - 'size' => $item->size, - 'date' => strtotime($item->modified_at), - 'thumbnail' => $OUTPUT->image_url(file_extension_icon($item->name, 64))->out(false), - 'thumbnail_height' => 64, - 'thumbnail_width' => 64, - 'author' => $item->owned_by->name, - ); - } - } - - core_collator::ksort($folders, core_collator::SORT_NATURAL); - core_collator::ksort($files, core_collator::SORT_NATURAL); - $ret['list'] = array_merge($folders, $files); - $ret['list'] = array_filter($ret['list'], array($this, 'filter')); - - return $ret; - } - - /** - * Return login form - * - * @return array - */ - public function print_login(){ - $url = $this->boxnetclient->get_login_url(); - if ($this->options['ajax']) { - $ret = array(); - $popup_btn = new stdClass(); - $popup_btn->type = 'popup'; - $popup_btn->url = $url->out(false); - $ret['login'] = array($popup_btn); - return $ret; - } else { - echo html_writer::link($url, get_string('login', 'repository'), array('target' => '_blank')); - } - } - - /** - * Names of the plugin settings - * - * @return array - */ - public static function get_type_option_names() { - return array('clientid', 'clientsecret', 'pluginname'); - } - - /** - * Catch the request token. - */ - public function callback() { - $this->boxnetclient->is_logged_in(); - } - - /** - * Add Plugin settings input to Moodle form - * - * @param moodleform $mform - * @param string $classname - */ - public static function type_config_form($mform, $classname = 'repository') { - global $CFG; - parent::type_config_form($mform); - - $clientid = get_config('boxnet', 'clientid'); - $clientsecret = get_config('boxnet', 'clientsecret'); - $strrequired = get_string('required'); - - $mform->addElement('text', 'clientid', get_string('clientid', 'repository_boxnet'), - array('value' => $clientid, 'size' => '40')); - $mform->addRule('clientid', $strrequired, 'required', null, 'client'); - $mform->setType('clientid', PARAM_RAW_TRIMMED); - - $mform->addElement('text', 'clientsecret', get_string('clientsecret', 'repository_boxnet'), - array('value' => $clientsecret, 'size' => '40')); - $mform->addRule('clientsecret', $strrequired, 'required', null, 'client'); - $mform->setType('clientsecret', PARAM_RAW_TRIMMED); - - $mform->addElement('static', null, '', get_string('information', 'repository_boxnet')); - - if (!is_https()) { - $mform->addElement('static', null, '', get_string('warninghttps', 'repository_boxnet')); - } - } - - /** - * Box.net supports copied and links. - * - * Theoretically this API is ready for references, though it only works for - * Box.net Business accounts, but it is not enabled because we are not supporting it. - * - * @return int - */ - public function supported_returntypes() { - return FILE_INTERNAL | FILE_EXTERNAL; - } - - /** - * Convert a reference to the new reference style. - * - * While converting Box.net to APIv2 we introduced a new format for - * file references, see {@link self::get_file_reference()}. This function - * ensures that the format is always the same regardless of the whether - * the reference was from APIv1 or v2. - * - * @param mixed $reference File reference. - * @return stdClass Valid file reference. - */ - public static function convert_to_valid_reference($reference) { - if (strpos($reference, 'http') === 0) { - // It is faster to check if the reference is a URL rather than trying to unserialize it. - $reference = serialize((object) array('downloadurl' => $reference, 'fileid' => '', 'filename' => '', 'userid' => '')); - } - return $reference; - } - - /** - * Prepare file reference information - * - * @param string $source - * @return string file referece - */ - public function get_file_reference($source) { - global $USER; - list($type, $fileid, $filename) = $this->split_part($source); - $reference = new stdClass(); - $reference->fileid = $fileid; - $reference->filename = $filename; - $reference->userid = $USER->id; - $reference->downloadurl = ''; - if (optional_param('usefilereference', false, PARAM_BOOL)) { - try { - $shareinfo = $this->boxnetclient->share_file($reference->fileid); - } catch (moodle_exception $e) { - throw new repository_exception('cannotcreatereference', 'repository_boxnet'); - } - $reference->downloadurl = $shareinfo->download_url; - } - return serialize($reference); - } - - /** - * Get a link to the file. - * - * This returns the URL of the web view of the file. To generate this link the - * file must be shared. - * - * @param stdClass $reference Reference. - * @return string URL. - */ - public function get_link($reference) { - $reference = unserialize(self::convert_to_valid_reference($reference)); - $shareinfo = $this->boxnetclient->share_file($reference->fileid, false); - return $shareinfo->url; - } - - /** - * Synchronize the references. - * - * @param stored_file $file Stored file. - * @return boolean - */ - public function sync_reference(stored_file $file) { - global $CFG; - if ($file->get_referencelastsync() + DAYSECS > time()) { - // Synchronise not more often than once a day. - return false; - } - $c = new curl(); - $reference = unserialize(self::convert_to_valid_reference($file->get_reference())); - $url = $reference->downloadurl; - if (file_extension_in_typegroup($file->get_filename(), 'web_image')) { - $path = $this->prepare_file(''); - $result = $c->download_one($url, null, array('filepath' => $path, 'timeout' => $CFG->repositorysyncimagetimeout)); - $info = $c->get_info(); - if ($result === true && isset($info['http_code']) && $info['http_code'] == 200) { - $file->set_synchronised_content_from_file($path); - return true; - } - } - $c->get($url, null, array('timeout' => $CFG->repositorysyncimagetimeout, 'followlocation' => true, 'nobody' => true)); - $info = $c->get_info(); - if (isset($info['http_code']) && $info['http_code'] == 200 && - array_key_exists('download_content_length', $info) && - $info['download_content_length'] >= 0) { - $filesize = (int)$info['download_content_length']; - $file->set_synchronized(null, $filesize); - return true; - } - $file->set_missingsource(); - return true; - } - - /** - * Return human readable reference information - * {@link stored_file::get_reference()} - * - * @param string $reference - * @param int $filestatus status of the file, 0 - ok, 666 - source missing - * @return string - */ - public function get_reference_details($reference, $filestatus = 0) { - // Indicate it's from box.net repository. - $reference = unserialize(self::convert_to_valid_reference($reference)); - if (!$filestatus) { - return $this->get_name() . ': ' . $reference->filename; - } else { - return get_string('lostsource', 'repository', $reference->filename); - } - } - - /** - * Return the source information. - * - * @param string $source Not the reference, just the source. - * @return string|null - */ - public function get_file_source_info($source) { - global $USER; - list($type, $fileid, $filename) = $this->split_part($source); - return 'Box ('. fullname($USER) . '): ' . $filename; - } - - /** - * Repository method to serve the referenced file - * - * @param stored_file $storedfile the file that contains the reference - * @param int $lifetime Number of seconds before the file should expire from caches (null means $CFG->filelifetime) - * @param int $filter 0 (default)=no filtering, 1=all files, 2=html files only - * @param bool $forcedownload If true (default false), forces download of file rather than view in browser/plugin - * @param array $options additional options affecting the file serving - */ - public function send_file($storedfile, $lifetime=null , $filter=0, $forcedownload=false, array $options = null) { - $ref = unserialize(self::convert_to_valid_reference($storedfile->get_reference())); - header('Location: ' . $ref->downloadurl); - } -} diff --git a/repository/boxnet/locallib.php b/repository/boxnet/locallib.php deleted file mode 100644 index 9216cbd3664..00000000000 --- a/repository/boxnet/locallib.php +++ /dev/null @@ -1,24 +0,0 @@ -. - -/** - * Box.net locallib. - * - * @package repository_boxnet - * @copyright 2013 Frédéric Massart - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - diff --git a/repository/boxnet/pix/icon.png b/repository/boxnet/pix/icon.png deleted file mode 100644 index 6199244123f..00000000000 Binary files a/repository/boxnet/pix/icon.png and /dev/null differ diff --git a/repository/boxnet/tests/generator/lib.php b/repository/boxnet/tests/generator/lib.php deleted file mode 100644 index 6c45fe0a5df..00000000000 --- a/repository/boxnet/tests/generator/lib.php +++ /dev/null @@ -1,53 +0,0 @@ -. - -/** - * Box.net repository data generator - * - * @package repository_boxnet - * @category test - * @copyright 2013 Frédéric Massart - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * Box.net repository data generator class - * - * @package repository_boxnet - * @category test - * @copyright 2013 Frédéric Massart - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class repository_boxnet_generator extends testing_repository_generator { - - /** - * Fill in type record defaults. - * - * @param array $record - * @return array - */ - protected function prepare_type_record(array $record) { - $record = parent::prepare_type_record($record); - if (!isset($record['clientid'])) { - $record['clientid'] = 'clientid'; - } - if (!isset($record['clientsecret'])) { - $record['clientsecret'] = 'clientsecret'; - } - return $record; - } - -} diff --git a/repository/boxnet/version.php b/repository/boxnet/version.php deleted file mode 100644 index 944f4fffce4..00000000000 --- a/repository/boxnet/version.php +++ /dev/null @@ -1,31 +0,0 @@ -. - -/** - * Version details - * - * @package repository - * @subpackage boxnet - * @copyright 2009 Dongsheng Cai - * @author Dongsheng Cai - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX). -$plugin->requires = 2021052500; // Requires this Moodle version. -$plugin->component = 'repository_boxnet'; // Full name of the plugin (used for diagnostics) diff --git a/repository/lib.php b/repository/lib.php index a73792bd039..47c424c6f8f 100644 --- a/repository/lib.php +++ b/repository/lib.php @@ -488,7 +488,7 @@ class repository_type implements cacheable_object { * This is the base class of the repository class. * * To create repository plugin, see: {@link http://docs.moodle.org/dev/Repository_plugins} - * See an example: {@link repository_boxnet} + * See an example: repository_dropbox * * @package core_repository * @copyright 2009 Dongsheng Cai {@link http://dongsheng.org} diff --git a/repository/tests/generator_test.php b/repository/tests/generator_test.php index 3405817eacb..ba40bc990cf 100644 --- a/repository/tests/generator_test.php +++ b/repository/tests/generator_test.php @@ -45,7 +45,7 @@ class core_repository_generator_testcase extends advanced_testcase { $this->resetAfterTest(true); // All the repository types. - $all = array('boxnet', 'coursefiles', 'dropbox', 'equella', 'filesystem', 'flickr', + $all = array('coursefiles', 'dropbox', 'equella', 'filesystem', 'flickr', 'flickr_public', 'googledocs', 'local', 'nextcloud', 'merlot', 'recent', 's3', 'upload', 'url', 'user', 'webdav', 'wikimedia', 'youtube'); diff --git a/repository/tests/repositorylib_test.php b/repository/tests/repositorylib_test.php index d618ae6ee36..523287da7af 100644 --- a/repository/tests/repositorylib_test.php +++ b/repository/tests/repositorylib_test.php @@ -41,7 +41,7 @@ class core_repositorylib_testcase extends advanced_testcase { $this->resetAfterTest(true); $syscontext = context_system::instance(); - $repositorypluginname = 'boxnet'; + $repositorypluginname = 'dropbox'; // override repository permission $capability = 'repository/' . $repositorypluginname . ':view'; $guestroleid = $DB->get_field('role', 'id', array('shortname' => 'guest')); diff --git a/repository/upgrade.txt b/repository/upgrade.txt index 197c2271810..19695c4bcb4 100644 --- a/repository/upgrade.txt +++ b/repository/upgrade.txt @@ -4,6 +4,7 @@ details of the repository API are available on Moodle docs: http://docs.moodle.org/dev/Repository_API === 4.0 === +* The repository_boxnet has been completely removed. * The repository_picasa has been completely removed (Picasa is discontinued since 2016). * The skydrive repository has been completely removed from core. It has been moved to the plugins database repository, so it can still be installed as a third-party plugin. diff --git a/version.php b/version.php index ef1f2da6da2..131e587709a 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2021102600.01; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2021102900.00; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '4.0dev+ (Build: 20211026)'; // Human-friendly version name