From ba06999e48b1dc021a22aa4dacb8e53b91937aa8 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Tue, 10 Aug 2021 16:41:35 +0200 Subject: [PATCH 1/3] MDL-58939 portfolio: Remove picasa portfolio Picasa is discontinued since 2016 so portfolio_picasa has been removed from core Moodle. --- lib/classes/plugin_manager.php | 3 +- lib/db/upgrade.php | 24 +++ .../lang/en/portfolio_googledocs.php | 2 +- portfolio/picasa/classes/privacy/provider.php | 80 ---------- portfolio/picasa/db/upgrade.php | 39 ----- portfolio/picasa/lang/en/portfolio_picasa.php | 34 ---- portfolio/picasa/lib.php | 145 ------------------ .../picasa/tests/privacy_provider_test.php | 46 ------ portfolio/picasa/version.php | 30 ---- portfolio/upgrade.txt | 4 + version.php | 2 +- 11 files changed, 32 insertions(+), 377 deletions(-) delete mode 100644 portfolio/picasa/classes/privacy/provider.php delete mode 100644 portfolio/picasa/db/upgrade.php delete mode 100644 portfolio/picasa/lang/en/portfolio_picasa.php delete mode 100644 portfolio/picasa/lib.php delete mode 100644 portfolio/picasa/tests/privacy_provider_test.php delete mode 100644 portfolio/picasa/version.php diff --git a/lib/classes/plugin_manager.php b/lib/classes/plugin_manager.php index be2741a4fef..132bbe40071 100644 --- a/lib/classes/plugin_manager.php +++ b/lib/classes/plugin_manager.php @@ -1725,6 +1725,7 @@ class core_plugin_manager { 'block' => array('course_overview', 'messages', 'community', 'participants'), 'cachestore' => array('memcache'), 'enrol' => array('authorize'), + 'portfolio' => array('picasa'), 'qformat' => array('webct'), 'message' => array('jabber'), 'quizaccess' => array('safebrowser'), @@ -1933,7 +1934,7 @@ class core_plugin_manager { ), 'portfolio' => array( - 'boxnet', 'download', 'flickr', 'googledocs', 'mahara', 'picasa' + 'boxnet', 'download', 'flickr', 'googledocs', 'mahara' ), 'profilefield' => array( diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 96e0dead125..230cecd3516 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2778,5 +2778,29 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2021091100.02); } + if ($oldversion < 2021091700.01) { + // If portfolio_picasa is no longer present, remove it. + if (!file_exists($CFG->dirroot . '/portfolio/picasa/version.php')) { + $instance = $DB->get_record('portfolio_instance', ['plugin' => 'picasa']); + 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_picasa'); + } + + upgrade_main_savepoint(true, 2021091700.01); + } + return true; } diff --git a/portfolio/googledocs/lang/en/portfolio_googledocs.php b/portfolio/googledocs/lang/en/portfolio_googledocs.php index 27183702fc9..f2ee1757b38 100644 --- a/portfolio/googledocs/lang/en/portfolio_googledocs.php +++ b/portfolio/googledocs/lang/en/portfolio_googledocs.php @@ -27,7 +27,7 @@ $string['noauthtoken'] = 'An authentication token has not been received from Goo $string['nooauthcredentials'] = 'OAuth credentials required.'; $string['nooauthcredentials_help'] = 'To use the Google Drive portfolio plugin you must configure OAuth credentials in the portfolio settings.'; $string['nosessiontoken'] = 'A session token does not exist preventing export to google.'; -$string['oauthinfo'] = '

To use this plugin, you must register your site with Google, as described in the documentation Google OAuth 2.0 setup.

As part of the registration process, you will need to enter the following URL as \'Authorized Redirect URIs\':

{$a->callbackurl}

Once registered, you will be provided with a client ID and secret which can be used to configure all Google Drive and Picasa plugins.

'; +$string['oauthinfo'] = '

To use this plugin, you must register your site with Google, as described in the documentation Google OAuth 2.0 setup.

As part of the registration process, you will need to enter the following URL as \'Authorized Redirect URIs\':

{$a->callbackurl}

Once registered, you will be provided with a client ID and secret which can be used to configure all Google Drive plugins.

'; $string['pluginname'] = 'Google Drive'; $string['privacy:metadata'] = 'This plugin sends data externally to a linked Google account. It does not store data locally.'; $string['privacy:metadata:data'] = 'Personal data passed through from the portfolio subsystem.'; diff --git a/portfolio/picasa/classes/privacy/provider.php b/portfolio/picasa/classes/privacy/provider.php deleted file mode 100644 index 4f2fafe2d78..00000000000 --- a/portfolio/picasa/classes/privacy/provider.php +++ /dev/null @@ -1,80 +0,0 @@ -. - -/** - * Privacy class for requesting user data. - * - * @package portfolio_picasa - * @copyright 2018 Jake Dallimore - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -namespace portfolio_picasa\privacy; - -defined('MOODLE_INTERNAL') || die(); - -use core_privacy\local\metadata\collection; - -/** - * Provider for the portfolio_picasa 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('picasa.google.com', ['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/picasa/db/upgrade.php b/portfolio/picasa/db/upgrade.php deleted file mode 100644 index 430343b57eb..00000000000 --- a/portfolio/picasa/db/upgrade.php +++ /dev/null @@ -1,39 +0,0 @@ -. - -defined('MOODLE_INTERNAL') || die(); - -/** - * @param int $oldversion the version we are upgrading from - * @return bool result - */ -function xmldb_portfolio_picasa_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/picasa/lang/en/portfolio_picasa.php b/portfolio/picasa/lang/en/portfolio_picasa.php deleted file mode 100644 index d447c94329e..00000000000 --- a/portfolio/picasa/lang/en/portfolio_picasa.php +++ /dev/null @@ -1,34 +0,0 @@ -. - -/** - * Strings for component 'portfolio_picasa', language 'en', branch 'MOODLE_20_STABLE' - * - * @package portfolio_picasa - * @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['noauthtoken'] = 'An authentication token has not been received from Google. Please ensure you are allowing Moodle to access your Google account.'; -$string['nooauthcredentials'] = 'OAuth credentials required.'; -$string['nooauthcredentials_help'] = 'To use the Picasa portfolio plugin you must configure OAuth credentials in the portfolio settings.'; -$string['oauthinfo'] = '

To use this plugin, you must register your site with Google, as described in the documentation Google OAuth 2.0 setup.

As part of the registration process, you will need to enter the following URL as \'Authorized Redirect URIs\':

{$a->callbackurl}

Once registered, you will be provided with a client ID and secret which can be used to configure all Google Drive and Picasa plugins.

'; -$string['pluginname'] = 'Picasa'; -$string['privacy:metadata'] = 'This plugin sends data externally to a linked Picasa account. It does not store data locally.'; -$string['privacy:metadata:data'] = 'Personal data passed through from the portfolio subsystem.'; -$string['sendfailed'] = 'The file {$a} failed to transfer to Picasa'; -$string['secret'] = 'Secret'; diff --git a/portfolio/picasa/lib.php b/portfolio/picasa/lib.php deleted file mode 100644 index d760b127d66..00000000000 --- a/portfolio/picasa/lib.php +++ /dev/null @@ -1,145 +0,0 @@ -. - -/** - * Picasa Portfolio Plugin - * - * @author Dan Poltawski - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - */ -require_once($CFG->libdir.'/portfolio/plugin.php'); -require_once($CFG->libdir.'/googleapi.php'); - -class portfolio_plugin_picasa extends portfolio_plugin_push_base { - private $googleoauth = null; - - public function supported_formats() { - return array(PORTFOLIO_FORMAT_IMAGE, PORTFOLIO_FORMAT_VIDEO); - } - - public static function get_name() { - return get_string('pluginname', 'portfolio_picasa'); - } - - public function prepare_package() { - // We send the files as they are, no prep required. - return true; - } - - public function get_interactive_continue_url() { - return 'http://picasaweb.google.com/'; - } - - 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 function send_package() { - if (!$this->googleoauth) { - throw new portfolio_plugin_exception('noauthtoken', 'portfolio_picasa'); - } - - $picasa = new google_picasa($this->googleoauth); - foreach ($this->exporter->get_tempfiles() as $file) { - - if (!$picasa->send_file($file)) { - throw new portfolio_plugin_exception('sendfailed', 'portfolio_picasa', $file->get_filename()); - } - } - } - - public function steal_control($stage) { - if ($stage != PORTFOLIO_STAGE_CONFIG) { - return false; - } - - $this->initialize_oauth(); - - if ($this->googleoauth->is_logged_in()) { - return false; - } else { - return $this->googleoauth->get_login_url(); - } - } - - public function post_control($stage, $params) { - if ($stage != PORTFOLIO_STAGE_CONFIG) { - return; - } - - $this->initialize_oauth(); - if ($this->googleoauth->is_logged_in()) { - return false; - } else { - return $this->googleoauth->get_login_url(); - } - } - - public static function has_admin_config() { - return true; - } - - public static function allows_multiple_instances() { - return false; - } - - public static function get_allowed_config() { - return array('clientid', 'secret'); - } - - public static function admin_config_form(&$mform) { - $a = new stdClass; - $a->docsurl = get_docs_url('Google_OAuth_2.0_setup'); - $a->callbackurl = google_oauth::callback_url()->out(false); - - $mform->addElement('static', null, '', get_string('oauthinfo', 'portfolio_picasa', $a)); - - $mform->addElement('text', 'clientid', get_string('clientid', 'portfolio_picasa')); - $mform->setType('clientid', PARAM_RAW_TRIMMED); - $mform->addElement('text', 'secret', get_string('secret', 'portfolio_picasa')); - $mform->setType('secret', PARAM_RAW_TRIMMED); - - $strrequired = get_string('required'); - $mform->addRule('clientid', $strrequired, 'required', null, 'client'); - $mform->addRule('secret', $strrequired, 'required', null, 'client'); - } - - private function initialize_oauth() { - $returnurl = new moodle_url('/portfolio/add.php'); - $returnurl->param('postcontrol', 1); - $returnurl->param('id', $this->exporter->get('id')); - $returnurl->param('sesskey', sesskey()); - - $clientid = $this->get_config('clientid'); - $secret = $this->get_config('secret'); - - $this->googleoauth = new google_oauth($clientid, $secret, $returnurl, google_picasa::REALM); - } - - public function instance_sanity_check() { - $clientid = $this->get_config('clientid'); - $secret = $this->get_config('secret'); - - // If there is no oauth config (e.g. plugins upgraded from < 2.3 then - // there will be no config and this plugin should be disabled. - if (empty($clientid) or empty($secret)) { - return 'nooauthcredentials'; - } - return 0; - } -} diff --git a/portfolio/picasa/tests/privacy_provider_test.php b/portfolio/picasa/tests/privacy_provider_test.php deleted file mode 100644 index 8cd8d7118a4..00000000000 --- a/portfolio/picasa/tests/privacy_provider_test.php +++ /dev/null @@ -1,46 +0,0 @@ -. - -/** - * Privacy provider tests. - * - * @package portfolio_picasa - * @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_picasa_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_picasa'); - $collection = \portfolio_picasa\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/picasa/version.php b/portfolio/picasa/version.php deleted file mode 100644 index a7775921092..00000000000 --- a/portfolio/picasa/version.php +++ /dev/null @@ -1,30 +0,0 @@ -. - -/** - * Version details - * - * @package portfolio - * @subpackage picasa - * @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_picasa'; // Full name of the plugin (used for diagnostics). -$plugin->cron = 0; diff --git a/portfolio/upgrade.txt b/portfolio/upgrade.txt index eda575d1465..95828802969 100644 --- a/portfolio/upgrade.txt +++ b/portfolio/upgrade.txt @@ -1,6 +1,10 @@ This files describes API changes in /portfolio/ portfolio system, information provided here is intended especially for developers. +=== 4.0 === + +* The portfolio_picasa has been completely removed (Picasa is discontinued since 2016). + === 3.7 === * The portfolio_cron() function has been removed. Please use portfolio_cron_task scheduled task instead. diff --git a/version.php b/version.php index 4135a3e9e6b..502ae758dab 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2021091700.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2021091700.01; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '4.0dev (Build: 20210917)'; // Human-friendly version name From 128ebcc4b0fad8f030cbb79b29e40979dc7cfcf1 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Tue, 10 Aug 2021 17:37:59 +0200 Subject: [PATCH 2/3] MDL-58939 repository: Remove picasa repository Picasa is discontinued since 2016 so repository_picasa has been removed from core Moodle. --- lib/classes/plugin_manager.php | 4 +- lib/db/upgrade.php | 23 +++ .../picasa/classes/privacy/provider.php | 114 --------------- repository/picasa/db/access.php | 37 ----- repository/picasa/db/upgrade.php | 39 ------ .../picasa/lang/en/repository_picasa.php | 32 ----- repository/picasa/lib.php | 132 ------------------ repository/picasa/pix/icon.png | Bin 4880 -> 0 bytes repository/picasa/tests/generator/lib.php | 53 ------- repository/picasa/version.php | 31 ---- repository/tests/generator_test.php | 2 +- repository/upgrade.txt | 3 + version.php | 2 +- 13 files changed, 30 insertions(+), 442 deletions(-) delete mode 100644 repository/picasa/classes/privacy/provider.php delete mode 100644 repository/picasa/db/access.php delete mode 100644 repository/picasa/db/upgrade.php delete mode 100644 repository/picasa/lang/en/repository_picasa.php delete mode 100644 repository/picasa/lib.php delete mode 100644 repository/picasa/pix/icon.png delete mode 100644 repository/picasa/tests/generator/lib.php delete mode 100644 repository/picasa/version.php diff --git a/lib/classes/plugin_manager.php b/lib/classes/plugin_manager.php index 132bbe40071..cbb3adfe804 100644 --- a/lib/classes/plugin_manager.php +++ b/lib/classes/plugin_manager.php @@ -1730,7 +1730,7 @@ class core_plugin_manager { 'message' => array('jabber'), 'quizaccess' => array('safebrowser'), 'report' => array('search'), - 'repository' => array('alfresco'), + 'repository' => array('alfresco', 'picasa'), 'tinymce' => array('dragmath'), 'tool' => array('bloglevelupgrade', 'qeupgradehelper', 'timezoneimport', 'assignmentupgrade'), 'theme' => array('bootstrapbase', 'clean', 'more', 'afterburner', 'anomaly', 'arialist', 'base', @@ -1995,7 +1995,7 @@ class core_plugin_manager { 'repository' => array( 'areafiles', 'boxnet', 'contentbank', 'coursefiles', 'dropbox', 'equella', 'filesystem', 'flickr', 'flickr_public', 'googledocs', 'local', 'merlot', 'nextcloud', - 'onedrive', 'picasa', 'recent', 'skydrive', 's3', 'upload', 'url', 'user', 'webdav', + 'onedrive', 'recent', 'skydrive', 's3', 'upload', 'url', 'user', 'webdav', 'wikimedia', 'youtube' ), diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 230cecd3516..a9c875821bc 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2802,5 +2802,28 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2021091700.01); } + if ($oldversion < 2021091700.02) { + // If repository_picasa is no longer present, remove it. + if (!file_exists($CFG->dirroot . '/repository/picasa/version.php')) { + $instance = $DB->get_record('repository', ['type' => 'picasa']); + 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('picasa'); + + // Remove orphaned files. + upgrade_delete_orphaned_file_records(); + } + + upgrade_main_savepoint(true, 2021091700.02); + } + return true; } diff --git a/repository/picasa/classes/privacy/provider.php b/repository/picasa/classes/privacy/provider.php deleted file mode 100644 index 885e6f92571..00000000000 --- a/repository/picasa/classes/privacy/provider.php +++ /dev/null @@ -1,114 +0,0 @@ -. - -/** - * Privacy Subsystem implementation for repository_picasa. - * - * @package repository_picasa - * @copyright 2018 Zig Tan - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -namespace repository_picasa\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_picasa 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( - 'picasa.google.com', - [ - 'search_text' => 'privacy:metadata:repository_picasa:searchtext' - ], - 'privacy:metadata:repository_picasa' - ); - - 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/picasa/db/access.php b/repository/picasa/db/access.php deleted file mode 100644 index 16a7c5bb17d..00000000000 --- a/repository/picasa/db/access.php +++ /dev/null @@ -1,37 +0,0 @@ -. - -/** - * Plugin capabilities. - * - * @package repository_picasa - * @copyright 2009 Dan Poltawski - * @author Dan Poltawski - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -$capabilities = array( - - 'repository/picasa:view' => array( - 'captype' => 'read', - 'contextlevel' => CONTEXT_MODULE, - 'archetypes' => array( - 'user' => CAP_ALLOW - ) - ) -); diff --git a/repository/picasa/db/upgrade.php b/repository/picasa/db/upgrade.php deleted file mode 100644 index b0d2f7e70ae..00000000000 --- a/repository/picasa/db/upgrade.php +++ /dev/null @@ -1,39 +0,0 @@ -. - -defined('MOODLE_INTERNAL') || die(); - -/** - * @param int $oldversion the version we are upgrading from - * @return bool result - */ -function xmldb_repository_picasa_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/picasa/lang/en/repository_picasa.php b/repository/picasa/lang/en/repository_picasa.php deleted file mode 100644 index 598f8a18a61..00000000000 --- a/repository/picasa/lang/en/repository_picasa.php +++ /dev/null @@ -1,32 +0,0 @@ -. - -/** - * Strings for component 'repository_picasa', language 'en', branch 'MOODLE_20_STABLE' - * - * @package repository_picasa - * @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['configplugin'] = 'Picasa repository configuration'; -$string['oauthinfo'] = '

To use this plugin, you must register your site with Google, as described in the documentation Google OAuth 2.0 setup.

As part of the registration process, you will need to enter the following URL as \'Authorized Redirect URIs\':

{$a->callbackurl}

Once registered, you will be provided with a client ID and secret which can be used to configure all Google Drive and Picasa plugins.

'; -$string['picasa:view'] = 'View picasa repository'; -$string['pluginname'] = 'Picasa web album'; -$string['secret'] = 'Secret'; -$string['privacy:metadata:repository_picasa'] = 'The Picasa web album repository plugin does not store any personal data, but does transmit user data from Moodle to the remote system.'; -$string['privacy:metadata:repository_picasa:searchtext'] = 'The Picasa repository user search text query.'; diff --git a/repository/picasa/lib.php b/repository/picasa/lib.php deleted file mode 100644 index 362289bf1f1..00000000000 --- a/repository/picasa/lib.php +++ /dev/null @@ -1,132 +0,0 @@ -. - -/** - * This plugin is used to access picasa pictures - * - * @since Moodle 2.0 - * @package repository_picasa - * @copyright 2009 Dan Poltawski - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -require_once($CFG->dirroot . '/repository/lib.php'); -require_once($CFG->libdir.'/googleapi.php'); - -/** - * Picasa Repository Plugin - * - * @since Moodle 2.0 - * @package repository - * @subpackage picasa - * @copyright 2009 Dan Poltawski - * @author Dan Poltawski - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class repository_picasa extends repository { - private $googleoauth = null; - - public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) { - parent::__construct($repositoryid, $context, $options); - - $returnurl = new moodle_url('/repository/repository_callback.php'); - $returnurl->param('callback', 'yes'); - $returnurl->param('repo_id', $this->id); - $returnurl->param('sesskey', sesskey()); - - $clientid = get_config('picasa', 'clientid'); - $secret = get_config('picasa', 'secret'); - $this->googleoauth = new google_oauth($clientid, $secret, $returnurl, google_picasa::REALM); - - $this->check_login(); - } - - public function check_login() { - return $this->googleoauth->is_logged_in(); - } - - public function print_login() { - $url = $this->googleoauth->get_login_url(); - - if ($this->options['ajax']) { - $popup = new stdClass(); - $popup->type = 'popup'; - $popup->url = $url->out(false); - return array('login' => array($popup)); - } else { - echo ''.get_string('login', 'repository').''; - } - } - - public function get_listing($path='', $page = '') { - $picasa = new google_picasa($this->googleoauth); - - $ret = array(); - $ret['dynload'] = true; - $ret['manage'] = google_picasa::MANAGE_URL; - $ret['list'] = $picasa->get_file_list($path); - $ret['path'] = array((object)array('name'=>get_string('home'), 'path' => '')); - if ($path) { - $ret['path'][] = (object)array('name'=>$picasa->get_last_album_name(), 'path' => $path); - } - return $ret; - } - - public function search($search_text, $page = 0) { - $picasa = new google_picasa($this->googleoauth); - - $ret = array(); - $ret['manage'] = google_picasa::MANAGE_URL; - $ret['list'] = $picasa->do_photo_search($search_text); - return $ret; - } - - public function logout() { - $this->googleoauth->log_out(); - return parent::logout(); - } - - public function supported_filetypes() { - return array('web_image'); - } - public function supported_returntypes() { - return (FILE_INTERNAL | FILE_EXTERNAL); - } - - public static function get_type_option_names() { - return array('clientid', 'secret', 'pluginname'); - } - - public static function type_config_form($mform, $classname = 'repository') { - $a = new stdClass; - $a->docsurl = get_docs_url('Google_OAuth_2.0_setup'); - $a->callbackurl = google_oauth::callback_url()->out(false); - - $mform->addElement('static', null, '', get_string('oauthinfo', 'repository_picasa', $a)); - - parent::type_config_form($mform); - $mform->addElement('text', 'clientid', get_string('clientid', 'repository_picasa')); - $mform->setType('clientid', PARAM_RAW_TRIMMED); - $mform->addElement('text', 'secret', get_string('secret', 'repository_picasa')); - $mform->setType('secret', PARAM_RAW_TRIMMED); - - $strrequired = get_string('required'); - $mform->addRule('clientid', $strrequired, 'required', null, 'client'); - $mform->addRule('secret', $strrequired, 'required', null, 'client'); - } -} - -// Icon for this plugin retrieved from http://www.iconspedia.com/icon/picasa-2711.html -// Where the license is said documented to be Free. diff --git a/repository/picasa/pix/icon.png b/repository/picasa/pix/icon.png deleted file mode 100644 index a8ec4105f81999178d5f3f4f2c53630e39676a45..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4880 zcmV+r6YuPaP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4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+h@Vq%S?*kYB(OA6pkDtGL zrRl(UOz}I%kFsl-S@7UP#QLeWd^}?kgBz1sa5D1xX;S% z%6c#?K8&;F+2%(dd~~&Gn;pFhDC!%Ue*XN!w{N^?pO_q!(M}?1s=dQ?U2s68L}~9v zXFFX#7z>7lhjEd15ud;N`Hl5W^}nzk20O8I#p;)&e4BG7Ona&}?q-;_i}XByFn5QU z?TFmP^(a(1Rh;CUl>F+0uWnkldf7{T`d`r2(YdgGssL8szYucf5iC9TXI_Rm$RID zt)5s~%&)HD;{gujI60JfCG5+-sz7l0{N=CI%&mFEah*yQ3H4{aKmqD(ZOJ*W78gGv;U$=JMSE=RxFp*5u_U+GU-_dikb1MS_ z1EU7y4JgS-&lmt;T4q;QxU0T1)VVeqkM7am^Zy55R@oey4hJ&;0000. - -/** - * Picasa repository data generator - * - * @package repository_picasa - * @category test - * @copyright 2013 Frédéric Massart - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * Picasa repository data generator class - * - * @package repository_picasa - * @category test - * @copyright 2013 Frédéric Massart - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class repository_picasa_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['secret'])) { - $record['secret'] = 'secret'; - } - return $record; - } - -} diff --git a/repository/picasa/version.php b/repository/picasa/version.php deleted file mode 100644 index f8440981cad..00000000000 --- a/repository/picasa/version.php +++ /dev/null @@ -1,31 +0,0 @@ -. - -/** - * Version details - * - * @package repository - * @subpackage picasa - * @copyright 2009 Dan Poltawski - * @author Dan Poltawski - * @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_picasa'; // Full name of the plugin (used for diagnostics). diff --git a/repository/tests/generator_test.php b/repository/tests/generator_test.php index a94ef34bf8e..3405817eacb 100644 --- a/repository/tests/generator_test.php +++ b/repository/tests/generator_test.php @@ -46,7 +46,7 @@ class core_repository_generator_testcase extends advanced_testcase { // All the repository types. $all = array('boxnet', 'coursefiles', 'dropbox', 'equella', 'filesystem', 'flickr', - 'flickr_public', 'googledocs', 'local', 'nextcloud', 'merlot', 'picasa', 'recent', 's3', 'upload', 'url', + 'flickr_public', 'googledocs', 'local', 'nextcloud', 'merlot', 'recent', 's3', 'upload', 'url', 'user', 'webdav', 'wikimedia', 'youtube'); // The ones enabled during installation. diff --git a/repository/upgrade.txt b/repository/upgrade.txt index 339d05e1200..c9e32b8d04f 100644 --- a/repository/upgrade.txt +++ b/repository/upgrade.txt @@ -3,6 +3,9 @@ information provided here is intended especially for developers. Full details of the repository API are available on Moodle docs: http://docs.moodle.org/dev/Repository_API +=== 4.0 === +* The repository_picasa has been completely removed (Picasa is discontinued since 2016). + === 3.11 === * The Google Drive repository now includes a new rest API function 'shared_drives_list', which can be used to fetch a list of existing shared drives. diff --git a/version.php b/version.php index 502ae758dab..a345b126a1e 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2021091700.01; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2021091700.02; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '4.0dev (Build: 20210917)'; // Human-friendly version name From 0cc61bbfc63529c62f11f9f2f8e9aa07027a4694 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Tue, 10 Aug 2021 17:48:20 +0200 Subject: [PATCH 3/3] MDL-58939 lib_google: Remove google_picasa class Picasa is discontinued since 2016 so google_picasa class has been removed from core Moodle (it makes no sense to deprecate it because it's not working properly).. --- lib/googleapi.php | 206 ---------------------------------------------- 1 file changed, 206 deletions(-) diff --git a/lib/googleapi.php b/lib/googleapi.php index 5c198cca7eb..9d03ccf6a21 100644 --- a/lib/googleapi.php +++ b/lib/googleapi.php @@ -211,212 +211,6 @@ class google_docs { } } -/** - * Class for manipulating picasa through the google data api. - * - * Docs for this can be found here: - * {@link http://code.google.com/apis/picasaweb/developers_guide_protocol.html} - * - * @package core - * @copyright Dan Poltawski - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class google_picasa { - /** @var string Realm for authentication */ - const REALM = 'http://picasaweb.google.com/data/'; - /** @var string Upload url */ - const UPLOAD_LOCATION = 'https://picasaweb.google.com/data/feed/api/user/default/albumid/default'; - /** @var string photo list url */ - const ALBUM_PHOTO_LIST = 'https://picasaweb.google.com/data/feed/api/user/default/albumid/'; - /** @var string search url */ - const PHOTO_SEARCH_URL = 'https://picasaweb.google.com/data/feed/api/user/default?kind=photo&q='; - /** @var string album list url */ - const LIST_ALBUMS_URL = 'https://picasaweb.google.com/data/feed/api/user/default'; - /** @var string manage files url */ - const MANAGE_URL = 'http://picasaweb.google.com/'; - - /** @var google_oauth oauth curl class for making authenticated requests */ - private $googleoauth = null; - /** @var string Last album name retrievied */ - private $lastalbumname = null; - - /** - * Constructor. - * - * @param google_oauth $googleoauth oauth curl class for making authenticated requests - */ - public function __construct(google_oauth $googleoauth) { - $this->googleoauth = $googleoauth; - $this->googleoauth->setHeader('GData-Version: 2'); - } - - /** - * Sends a file object to picasaweb - * - * @param object $file File object - * @return boolean True on success - */ - public function send_file($file) { - $this->googleoauth->setHeader("Content-Length: ". $file->get_filesize()); - $this->googleoauth->setHeader("Content-Type: ". $file->get_mimetype()); - $this->googleoauth->setHeader("Slug: ". $file->get_filename()); - - $this->googleoauth->post(self::UPLOAD_LOCATION, $file->get_content()); - - if ($this->googleoauth->info['http_code'] === 201) { - return true; - } else { - return false; - } - } - - /** - * Returns list of photos for file picker. - * If top level then returns list of albums, otherwise - * photos within an album. - * - * @param string $path The path to files (assumed to be albumid) - * @return mixed $files A list of files for the file picker - */ - public function get_file_list($path = '') { - if (!$path) { - return $this->get_albums(); - } else { - return $this->get_album_photos($path); - } - } - - /** - * Returns list of photos in album specified - * - * @param int $albumid Photo album to list photos from - * @return mixed $files A list of files for the file picker - */ - public function get_album_photos($albumid) { - $albumcontent = $this->googleoauth->get(self::ALBUM_PHOTO_LIST.$albumid); - - return $this->get_photo_details($albumcontent); - } - - /** - * Returns the name of the album for which get_photo_details was called last time. - * - * @return string - */ - public function get_last_album_name() { - return $this->lastalbumname; - } - - /** - * Does text search on the users photos and returns - * matches in format for picasa api - * - * @param string $query Search terms - * @return mixed $files A list of files for the file picker - */ - public function do_photo_search($query) { - $content = $this->googleoauth->get(self::PHOTO_SEARCH_URL.htmlentities($query)); - - return $this->get_photo_details($content); - } - - /** - * Gets all the users albums and returns them as a list of folders - * for the file picker - * - * @return mixes $files Array in the format get_listing uses for folders - */ - public function get_albums() { - $files = array(); - $content = $this->googleoauth->get(self::LIST_ALBUMS_URL); - - try { - if (strpos($content, 'entry as $album) { - $gphoto = $album->children('http://schemas.google.com/photos/2007'); - - $mediainfo = $album->children('http://search.yahoo.com/mrss/'); - // Hacky... - $thumbnailinfo = $mediainfo->group->thumbnail[0]->attributes(); - - $files[] = array( 'title' => (string) $album->title, - 'date' => userdate($gphoto->timestamp), - 'size' => (int) $gphoto->bytesUsed, - 'path' => (string) $gphoto->id, - 'thumbnail' => (string) $thumbnailinfo['url'], - 'thumbnail_width' => 160, // 160 is the native maximum dimension. - 'thumbnail_height' => 160, - 'children' => array(), - ); - } - - return $files; - } - - /** - * Recieves XML from a picasa list of photos and returns - * array in format for file picker. - * - * @param string $rawxml XML from picasa api - * @return mixed $files A list of files for the file picker - */ - public function get_photo_details($rawxml) { - $files = array(); - - try { - if (strpos($rawxml, 'lastalbumname = (string)$xml->title; - - foreach ($xml->entry as $photo) { - $gphoto = $photo->children('http://schemas.google.com/photos/2007'); - - $mediainfo = $photo->children('http://search.yahoo.com/mrss/'); - $fullinfo = $mediainfo->group->content->attributes(); - // Hacky... - $thumbnailinfo = $mediainfo->group->thumbnail[0]->attributes(); - - // Derive the nicest file name we can. - if (!empty($mediainfo->group->description)) { - $title = shorten_text((string)$mediainfo->group->description, 20, false, ''); - $title = clean_filename($title).'.jpg'; - } else { - $title = (string)$mediainfo->group->title; - } - - $files[] = array( - 'title' => $title, - 'date' => userdate($gphoto->timestamp), - 'size' => (int) $gphoto->size, - 'path' => $gphoto->albumid.'/'.$gphoto->id, - 'thumbnail' => (string) $thumbnailinfo['url'], - 'thumbnail_width' => 72, // 72 is the native maximum dimension. - 'thumbnail_height' => 72, - 'source' => (string) $fullinfo['url'], - 'url' => (string) $fullinfo['url'] - ); - } - - return $files; - } -} - /** * OAuth 2.0 client for Google Services *