diff --git a/repository/googledocs/db/upgrade.php b/repository/googledocs/db/upgrade.php index 76876a19ba2..893ed39dced 100644 --- a/repository/googledocs/db/upgrade.php +++ b/repository/googledocs/db/upgrade.php @@ -29,5 +29,42 @@ function xmldb_repository_googledocs_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2012051400, 'repository', 'googledocs'); } + if ($oldversion < 2012053000) { + require_once($CFG->dirroot.'/repository/lib.php'); + $existing = $DB->get_record('repository', array('type' => 'googledocs'), '*', IGNORE_MULTIPLE); + + if ($existing) { + $googledocsplugin = new repository_type('googledocs', array(), true); + $googledocsplugin->delete(); + repository_googledocs_admin_upgrade_notification(); + } + + upgrade_plugin_savepoint(true, 2012053000, 'repository', 'googledocs'); + } + return true; } + +function repository_googledocs_admin_upgrade_notification() { + $admins = get_admins(); + + if (empty($admins)) { + return; + } + $mainadmin = reset($admins); + + foreach ($admins as $admin) { + $message = new stdClass(); + $message->component = 'moodle'; + $message->name = 'notices'; + $message->userfrom = $mainadmin; + $message->userto = $admin; + $message->smallmessage = get_string('oauth2upgrade_message_small', 'repository_googledocs'); + $message->subject = get_string('oauth2upgrade_message_subject', 'repository_googledocs'); + $message->fullmessage = get_string('oauth2upgrade_message_content', 'repository_googledocs'); + $message->fullmessagehtml = get_string('oauth2upgrade_message_content', 'repository_googledocs'); + $message->fullmessageformat = FORMAT_PLAIN; + $message->notification = 1; + message_send($message); + } +} diff --git a/repository/googledocs/lang/en/repository_googledocs.php b/repository/googledocs/lang/en/repository_googledocs.php index 8e8cf8034e1..4f7faa7b324 100644 --- a/repository/googledocs/lang/en/repository_googledocs.php +++ b/repository/googledocs/lang/en/repository_googledocs.php @@ -26,6 +26,9 @@ $string['clientid'] = 'Client ID'; $string['configplugin'] = 'Configure Google Docs plugin'; $string['googledocs:view'] = 'View google docs repository'; $string['oauthinfo'] = '

To use the Google Docs repository you must be registered with Google. Instructions for registing your installation with Google are described in Moodle Docs. The redirect url should be set to:

{$a->callbackurl}

'; +$string['oauth2upgrade_message_subject'] = 'Important information regarding Google Docs repository plugin'; +$string['oauth2upgrade_message_content'] = 'As part of the upgrade to Moodle 2.3, the Google Docs repository plugin has been disabled due to changes in Googles API. To re-enable your plugin, you must add and reconfigure configure oauth credentials of this plugin.'; +$string['oauth2upgrade_message_small'] = 'The Google Docs repository plugin has been disabled until configured with OAuth2'; $string['pluginname'] = 'Google Docs'; $string['secret'] = 'Secret'; diff --git a/repository/googledocs/version.php b/repository/googledocs/version.php index 7269aa52195..2e03f6c9c43 100644 --- a/repository/googledocs/version.php +++ b/repository/googledocs/version.php @@ -25,6 +25,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2012051400; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2012053000; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2012051100; // Requires this Moodle version. $plugin->component = 'repository_googledocs'; // Full name of the plugin (used for diagnostics). diff --git a/repository/picasa/db/upgrade.php b/repository/picasa/db/upgrade.php index 545ce3b4fa5..082e5e3433f 100644 --- a/repository/picasa/db/upgrade.php +++ b/repository/picasa/db/upgrade.php @@ -29,5 +29,42 @@ function xmldb_repository_picasa_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2012051400, 'repository', 'picasa'); } + if ($oldversion < 2012053000) { + require_once($CFG->dirroot.'/repository/lib.php'); + $existing = $DB->get_record('repository', array('type' => 'picasa'), '*', IGNORE_MULTIPLE); + + if ($existing) { + $picasaplugin = new repository_type('picasa', array(), true); + $picasaplugin->delete(); + repository_picasa_admin_upgrade_notification(); + } + + upgrade_plugin_savepoint(true, 2012053000, 'repository', 'picasa'); + } + return true; } + +function repository_picasa_admin_upgrade_notification() { + $admins = get_admins(); + + if (empty($admins)) { + return; + } + $mainadmin = reset($admins); + + foreach ($admins as $admin) { + $message = new stdClass(); + $message->component = 'moodle'; + $message->name = 'notices'; + $message->userfrom = $mainadmin; + $message->userto = $admin; + $message->smallmessage = get_string('oauth2upgrade_message_small', 'repository_picasa'); + $message->subject = get_string('oauth2upgrade_message_subject', 'repository_picasa'); + $message->fullmessage = get_string('oauth2upgrade_message_content', 'repository_picasa'); + $message->fullmessagehtml = get_string('oauth2upgrade_message_content', 'repository_picasa'); + $message->fullmessageformat = FORMAT_PLAIN; + $message->notification = 1; + message_send($message); + } +} diff --git a/repository/picasa/lang/en/repository_picasa.php b/repository/picasa/lang/en/repository_picasa.php index 3c03022c12b..89d75a68079 100644 --- a/repository/picasa/lang/en/repository_picasa.php +++ b/repository/picasa/lang/en/repository_picasa.php @@ -25,6 +25,9 @@ $string['clientid'] = 'Client ID'; $string['configplugin'] = 'Picasa repository configuration'; $string['oauthinfo'] = '

To use the Picasa repository you must be registered with Google. Instructions for registing your installation with Google are described in Moodle Docs. The redirect url should be set to:

{$a->callbackurl}

'; +$string['oauth2upgrade_message_subject'] = 'Important information regarding Picasa repository plugin'; +$string['oauth2upgrade_message_content'] = 'As part of the upgrade to Moodle 2.3, the Picasa repository plugin has been disabled due to changes in Googles API. To re-enable your plugin, you must add and reconfigure configure oauth credentials of this plugin.'; +$string['oauth2upgrade_message_small'] = 'The Picasa repository plugin has been disabled until configured with OAuth2'; $string['picasa:view'] = 'View picasa repository'; $string['pluginname'] = 'Picasa web album'; $string['secret'] = 'Secret'; diff --git a/repository/picasa/version.php b/repository/picasa/version.php index 471007a4cac..c6dc0fc84ff 100644 --- a/repository/picasa/version.php +++ b/repository/picasa/version.php @@ -26,6 +26,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2012051400; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2012053000; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2012051100; // Requires this Moodle version. $plugin->component = 'repository_picasa'; // Full name of the plugin (used for diagnostics).