From 72fd103adde5710e4e06eb99323fbdf388520a57 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Fri, 10 Mar 2017 15:44:19 +0800 Subject: [PATCH] MDL-58219 cibot: Fixes Fixes for cibot warnings. Part of MDL-58220 --- auth/oauth2/classes/api.php | 1 - auth/oauth2/classes/auth.php | 8 ++- auth/oauth2/classes/linked_login.php | 3 +- auth/oauth2/db/access.php | 3 + auth/oauth2/db/upgrade.php | 2 + auth/oauth2/lib.php | 35 +++++++++++- auth/oauth2/version.php | 6 +- calendar/classes/export_form.php | 2 +- lib/classes/oauth2/api.php | 2 +- lib/classes/oauth2/client.php | 2 +- lib/classes/oauth2/endpoint.php | 3 +- lib/classes/oauth2/issuer.php | 3 +- .../oauth2/refresh_system_tokens_task.php | 8 ++- lib/classes/oauth2/rest.php | 1 + lib/classes/oauth2/system_account.php | 5 +- lib/classes/oauth2/user_field_mapping.php | 3 +- lib/filelib.php | 4 +- lib/form/editor.php | 2 +- lib/oauthlib.php | 16 +++--- mod/assign/assignmentplugin.php | 2 +- mod/wiki/filesedit.php | 2 +- repository/googledocs/db/caches.php | 2 + repository/googledocs/lib.php | 57 ++++++++++--------- 23 files changed, 109 insertions(+), 63 deletions(-) diff --git a/auth/oauth2/classes/api.php b/auth/oauth2/classes/api.php index ce02ce39c89..a7090bdf95b 100644 --- a/auth/oauth2/classes/api.php +++ b/auth/oauth2/classes/api.php @@ -109,7 +109,6 @@ class api { $context = context_user::instance($userid); require_capability('auth/oauth2:managelinkedlogins', $context); - $record = new stdClass(); $record->issuerid = $issuer->get('id'); $record->username = $userinfo['username']; diff --git a/auth/oauth2/classes/auth.php b/auth/oauth2/classes/auth.php index 677ec630b2e..b82124e317b 100644 --- a/auth/oauth2/classes/auth.php +++ b/auth/oauth2/classes/auth.php @@ -164,7 +164,7 @@ class auth extends \auth_plugin_base { /** * Return the userinfo from the oauth handshake. Will only be valid * for the logged in user. - * @param $string username + * @param string $username */ public function get_userinfo($username) { $cached = $this->get_static_user_info(); @@ -306,8 +306,12 @@ class auth extends \auth_plugin_base { return true; } + /** + * Process the config after the form is saved. + * @param stdClass $config + */ public function process_config($config) { - // Set to defaults if undefined + // Set to defaults if undefined. if (!isset($config->allowlinkedlogins)) { $config->allowlinkedlogins = false; } diff --git a/auth/oauth2/classes/linked_login.php b/auth/oauth2/classes/linked_login.php index 93dfd5702cf..7098e4ece5c 100644 --- a/auth/oauth2/classes/linked_login.php +++ b/auth/oauth2/classes/linked_login.php @@ -17,7 +17,7 @@ /** * Class for loading/storing issuers from the DB. * - * @package core_oauth2 + * @package auth_oauth2 * @copyright 2017 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -35,7 +35,6 @@ use core\persistent; */ class linked_login extends persistent { - /** @const TABLE */ const TABLE = 'auth_oauth2_linked_login'; /** diff --git a/auth/oauth2/db/access.php b/auth/oauth2/db/access.php index 53864726cd9..3b1f0b88639 100644 --- a/auth/oauth2/db/access.php +++ b/auth/oauth2/db/access.php @@ -21,6 +21,9 @@ * @copyright 2017 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + +defined('MOODLE_INTERNAL') || die(); + $capabilities = [ 'auth/oauth2:managelinkedlogins' => array( diff --git a/auth/oauth2/db/upgrade.php b/auth/oauth2/db/upgrade.php index e117395fec2..ca1bd5851a7 100644 --- a/auth/oauth2/db/upgrade.php +++ b/auth/oauth2/db/upgrade.php @@ -25,6 +25,8 @@ defined('MOODLE_INTERNAL') || die(); /** + * Upgrade function + * * @param int $oldversion the version we are upgrading from * @return bool result */ diff --git a/auth/oauth2/lib.php b/auth/oauth2/lib.php index 17040112bd3..e0835ad3b95 100644 --- a/auth/oauth2/lib.php +++ b/auth/oauth2/lib.php @@ -1,5 +1,38 @@ . +/** + * Callbacks for auth_oauth2 + * + * @package auth_oauth2 + * @copyright 2017 Damyon Wiese + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +/** + * Navigation hook to add to preferences page. + * + * @param navigation_node $useraccount + * @param stdClass $user + * @param context_user $context + * @param stdClass $course + * @param context_course $coursecontext + */ function auth_oauth2_extend_navigation_user_settings(navigation_node $useraccount, stdClass $user, context_user $context, @@ -11,7 +44,7 @@ function auth_oauth2_extend_navigation_user_settings(navigation_node $useraccoun if (get_config('auth_oauth2', 'allowlinkedlogins')) { $parent = $useraccount->parent->find('useraccount', navigation_node::TYPE_CONTAINER); - $thingnode = $parent->add(get_string('linkedlogins', 'auth_oauth2'), new moodle_url('/auth/oauth2/linkedlogins.php')); + $parent->add(get_string('linkedlogins', 'auth_oauth2'), new moodle_url('/auth/oauth2/linkedlogins.php')); } } } diff --git a/auth/oauth2/version.php b/auth/oauth2/version.php index 82fb444a534..0a014690f25 100644 --- a/auth/oauth2/version.php +++ b/auth/oauth2/version.php @@ -24,6 +24,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2017031000; // The current plugin version (Date: YYYYMMDDXX) -$plugin->requires = 2016112900; // Requires this Moodle version -$plugin->component = 'auth_oauth2'; // Full name of the plugin (used for diagnostics) +$plugin->version = 2017031000; // The current plugin version (Date: YYYYMMDDXX). +$plugin->requires = 2016112900; // Requires this Moodle version. +$plugin->component = 'auth_oauth2'; // Full name of the plugin (used for diagnostics). diff --git a/calendar/classes/export_form.php b/calendar/classes/export_form.php index 6789a8a68df..cced8fccb45 100644 --- a/calendar/classes/export_form.php +++ b/calendar/classes/export_form.php @@ -45,7 +45,7 @@ class core_calendar_export_form extends moodleform { global $CFG, $OUTPUT; $mform = $this->_form; - $mform->addElement('html', '

' . $OUTPUT->doc_link('calendar/export', get_string('exporthelp', 'calendar'), true) . '

'); + $mform->addElement('html', $OUTPUT->doc_link('calendar/export', get_string('exporthelp', 'calendar'), true)); $export = array(); $export[] = $mform->createElement('radio', 'exportevents', '', get_string('eventsall', 'calendar'), 'all'); diff --git a/lib/classes/oauth2/api.php b/lib/classes/oauth2/api.php index 436e1cc983e..3ca18ce7034 100644 --- a/lib/classes/oauth2/api.php +++ b/lib/classes/oauth2/api.php @@ -242,7 +242,7 @@ class api { * Get the system account for an installed OAuth service. * Never ever ever expose this to a webservice because it contains the refresh token which grants API access. * - * @param \core\oauth2\issuer $id + * @param \core\oauth2\issuer $issuer * @return \core\oauth2\client */ public static function get_system_account(issuer $issuer) { diff --git a/lib/classes/oauth2/client.php b/lib/classes/oauth2/client.php index e216e92c316..1ef887a12c7 100644 --- a/lib/classes/oauth2/client.php +++ b/lib/classes/oauth2/client.php @@ -17,7 +17,7 @@ /** * Configurable oauth2 client class. * - * @package core\oauth2 + * @package core * @copyright 2017 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/lib/classes/oauth2/endpoint.php b/lib/classes/oauth2/endpoint.php index 9832bc0ef9a..921f9a0e8da 100644 --- a/lib/classes/oauth2/endpoint.php +++ b/lib/classes/oauth2/endpoint.php @@ -17,7 +17,7 @@ /** * Class for loading/storing oauth2 endpoints from the DB. * - * @package core_oauth2 + * @package core * @copyright 2017 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -36,7 +36,6 @@ use lang_string; */ class endpoint extends persistent { - /** @const TABLE */ const TABLE = 'oauth2_endpoint'; /** diff --git a/lib/classes/oauth2/issuer.php b/lib/classes/oauth2/issuer.php index 1ff6cef8384..756d36ba804 100644 --- a/lib/classes/oauth2/issuer.php +++ b/lib/classes/oauth2/issuer.php @@ -17,7 +17,7 @@ /** * Class for loading/storing issuers from the DB. * - * @package core_oauth2 + * @package core * @copyright 2017 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -35,7 +35,6 @@ use core\persistent; */ class issuer extends persistent { - /** @const TABLE */ const TABLE = 'oauth2_issuer'; /** diff --git a/lib/classes/oauth2/refresh_system_tokens_task.php b/lib/classes/oauth2/refresh_system_tokens_task.php index c6e3db8fc08..22cb45ce610 100644 --- a/lib/classes/oauth2/refresh_system_tokens_task.php +++ b/lib/classes/oauth2/refresh_system_tokens_task.php @@ -21,12 +21,18 @@ * @copyright 2017 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + namespace core\oauth2; use \core\task\scheduled_task; +defined('MOODLE_INTERNAL') || die(); + /** * Simple task to delete old messaging records. + * @package core + * @copyright 2017 Damyon Wiese + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class refresh_system_tokens_task extends scheduled_task { @@ -47,7 +53,7 @@ class refresh_system_tokens_task extends scheduled_task { $admins = get_admins(); if (empty($admins)) { - return; + return; } foreach ($admins as $admin) { $strparams = ['siteurl' => $CFG->wwwroot, 'issuer' => $issuer->get('name')]; diff --git a/lib/classes/oauth2/rest.php b/lib/classes/oauth2/rest.php index 4a405f234a7..f7049e6f54c 100644 --- a/lib/classes/oauth2/rest.php +++ b/lib/classes/oauth2/rest.php @@ -63,6 +63,7 @@ abstract class rest { * * @param string $functionname * @param array $functionargs + * @param string $rawpost Optional param to include in the body of a post. */ public function call($functionname, $functionargs, $rawpost = false) { $functions = $this->get_api_functions(); diff --git a/lib/classes/oauth2/system_account.php b/lib/classes/oauth2/system_account.php index c30b0d02fea..74aa5c81611 100644 --- a/lib/classes/oauth2/system_account.php +++ b/lib/classes/oauth2/system_account.php @@ -16,10 +16,8 @@ /** * When using OAuth sometimes it makes sense to authenticate as a system user, and not the current user. - * In this case we use a refresh token to get an access token and the system admin must manually authorize the - * system account. * - * @package core_oauth2 + * @package core * @copyright 2017 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -37,7 +35,6 @@ use core\persistent; */ class system_account extends persistent { - /** @const TABLE */ const TABLE = 'oauth2_system_account'; /** diff --git a/lib/classes/oauth2/user_field_mapping.php b/lib/classes/oauth2/user_field_mapping.php index a67a089247e..9751bc9009a 100644 --- a/lib/classes/oauth2/user_field_mapping.php +++ b/lib/classes/oauth2/user_field_mapping.php @@ -17,7 +17,7 @@ /** * Class for loading/storing oauth2 endpoints from the DB. * - * @package core_oauth2 + * @package core * @copyright 2017 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -35,7 +35,6 @@ use core\persistent; */ class user_field_mapping extends persistent { - /** @const TABLE */ const TABLE = 'oauth2_user_field_mapping'; /** @var array $userfields - List of standard Moodle userfields. */ diff --git a/lib/filelib.php b/lib/filelib.php index e2bda31f674..df71196dbba 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -260,7 +260,7 @@ function file_postupdate_standard_editor($data, $field, array $options, $context * For all files in this file area - walk the file list and copy each to a system owned account, making them read-only. * * @category files - * @param stdClass $context context - must already exist + * @param int $contextid context id - must already exist * @param string $component * @param string $filearea file area name * @param int $itemid @@ -3495,7 +3495,7 @@ class curl { $options['CURLOPT_POSTFIELDS'] = $this->_tmp_file_post_params; unset($this->_tmp_file_post_params); } else { - // $params is the raw post data + // The variable $params is the raw post data. $options['CURLOPT_POSTFIELDS'] = $params; } return $this->request($url, $options); diff --git a/lib/form/editor.php b/lib/form/editor.php index e391a734508..69a78127219 100644 --- a/lib/form/editor.php +++ b/lib/form/editor.php @@ -59,7 +59,7 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element implements templatab protected $_options = array('subdirs' => 0, 'maxbytes' => 0, 'maxfiles' => 0, 'changeformat' => 0, 'areamaxbytes' => FILE_AREA_MAX_BYTES_UNLIMITED, 'context' => null, 'noclean' => 0, 'trusttext' => 0, 'return_types' => 15, 'enable_filemanagement' => true); - // $_options['return_types'] = FILE_INTERNAL | FILE_EXTERNAL | FILE_REFERENCE | FILE_CONTROLLED_LINK + // 15 is $_options['return_types'] = FILE_INTERNAL | FILE_EXTERNAL | FILE_REFERENCE | FILE_CONTROLLED_LINK. /** @var array values for editor */ protected $_values = array('text'=>null, 'format'=>null, 'itemid'=>null); diff --git a/lib/oauthlib.php b/lib/oauthlib.php index e77ce051cad..cf62393b61d 100644 --- a/lib/oauthlib.php +++ b/lib/oauthlib.php @@ -383,21 +383,21 @@ class oauth_helper { * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class oauth2_client extends curl { - /** var string client identifier issued to the client */ + /** @var string $clientid client identifier issued to the client */ private $clientid = ''; - /** var string The client secret. */ + /** @var string $clientsecret The client secret. */ private $clientsecret = ''; - /** var moodle_url URL to return to after authenticating */ + /** @var moodle_url $returnurl URL to return to after authenticating */ private $returnurl = null; - /** var string scope of the authentication request */ + /** @var string $scope of the authentication request */ protected $scope = ''; - /** var stdClass access token object */ + /** @var stdClass $accesstoken access token object */ private $accesstoken = null; - /** var stdClass refresh token string */ + /** @var string $refreshtoken refresh token string */ private $refreshtoken = ''; - /** var string mocknextresponse string */ + /** @var string $mocknextresponse string */ private $mocknextresponse = ''; - /** var array $upgradedcodes list of upgraded codes in this request */ + /** @var array $upgradedcodes list of upgraded codes in this request */ private static $upgradedcodes = []; /** diff --git a/mod/assign/assignmentplugin.php b/mod/assign/assignmentplugin.php index 91c62f1840c..83b8dfa8b39 100644 --- a/mod/assign/assignmentplugin.php +++ b/mod/assign/assignmentplugin.php @@ -585,7 +585,7 @@ abstract class assign_plugin { if ($this->get_subtype() == 'assignsubmission') { if ($itemid) { - $record = $DB->get_record('assign_submission', array('id'=>$itemid), 'userid,groupid', IGNORE_MISSING); + $record = $DB->get_record('assign_submission', array('id' => $itemid), 'userid,groupid', IGNORE_MISSING); if (!$record) { return null; } diff --git a/mod/wiki/filesedit.php b/mod/wiki/filesedit.php index 08378821386..91ed22e61a2 100644 --- a/mod/wiki/filesedit.php +++ b/mod/wiki/filesedit.php @@ -84,7 +84,7 @@ $data->returnurl = $returnurl; $data->subwikiid = $subwiki->id; $maxbytes = get_max_upload_file_size($CFG->maxbytes, $COURSE->maxbytes); $types = FILE_INTERNAL | FILE_REFERENCE | FILE_CONTROLLED_LINK; -$options = array('subdirs'=>0, 'maxbytes'=>$maxbytes, 'maxfiles'=>-1, 'accepted_types'=>'*', 'return_types'=>$types); +$options = array('subdirs' => 0, 'maxbytes' => $maxbytes, 'maxfiles' => -1, 'accepted_types' => '*', 'return_types' => $types); file_prepare_standard_filemanager($data, 'files', $options, $context, 'mod_wiki', 'attachments', $subwiki->id); $mform = new mod_wiki_filesedit_form(null, array('data'=>$data, 'options'=>$options)); diff --git a/repository/googledocs/db/caches.php b/repository/googledocs/db/caches.php index 0f554b62631..a751ed9b8cd 100644 --- a/repository/googledocs/db/caches.php +++ b/repository/googledocs/db/caches.php @@ -25,6 +25,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + $definitions = array( // Used to store file ids for folders. diff --git a/repository/googledocs/lib.php b/repository/googledocs/lib.php index ad2f1219ee2..f482046561f 100644 --- a/repository/googledocs/lib.php +++ b/repository/googledocs/lib.php @@ -73,7 +73,7 @@ class repository_googledocs extends repository { /** * Get a cached user authenticated oauth client. * - * @param moodle_url $usecurrenturl - Use this url instead of the repo callback. + * @param moodle_url $overrideurl - Use this url instead of the repo callback. * @return \core\oauth2\client */ protected function get_user_oauth_client($overrideurl = false) { @@ -668,9 +668,9 @@ class repository_googledocs extends repository { /** * List the permissions on a file. - * @param \core\oauth2\client $client Authenticated client. - * @param string $fileid The id of the file. * + * @param \repository_googledocs\rest $client Authenticated client. + * @param string $fileid The id of the file. * @return array */ protected function list_file_permissions(\repository_googledocs\rest $client, $fileid) { @@ -681,10 +681,9 @@ class repository_googledocs extends repository { /** * See if a folder exists within a folder * - * @param \core\oauth2\client $client Authenticated client. + * @param \repository_googledocs\rest $client Authenticated client. * @param string $foldername The folder we are looking for. * @param string $parentid The parent folder we are looking in. - * * @return string|boolean The file id if it exists or false. */ protected function folder_exists_in_folder(\repository_googledocs\rest $client, $foldername, $parentid) { @@ -704,7 +703,7 @@ class repository_googledocs extends repository { /** * Create a folder within a folder * - * @param \core\oauth2\client $client Authenticated client. + * @param \repository_googledocs\rest $client Authenticated client. * @param string $foldername The folder we are creating. * @param string $parentid The parent folder we are creating in. * @@ -725,7 +724,7 @@ class repository_googledocs extends repository { /** * Get capabilities for a file. * - * @param \core\oauth2\client $client Authenticated client. + * @param \repository_googledocs\rest $client Authenticated client. * @param string $fileid The file we are checking. * * @return stdClass The file info with capabilities. @@ -742,7 +741,7 @@ class repository_googledocs extends repository { /** * Get simple file info for humans. * - * @param \core\oauth2\client $client Authenticated client. + * @param \repository_googledocs\rest $client Authenticated client. * @param string $fileid The file we are querying. * * @return stdClass @@ -759,8 +758,9 @@ class repository_googledocs extends repository { /** * Update file owner. * - * @param \core\oauth2\client $client Authenticated client. + * @param \repository_googledocs\rest $client Authenticated client. * @param string $fileid The file we are updating. + * @param string $owneremail * * @return boolean Did it work? */ @@ -783,7 +783,7 @@ class repository_googledocs extends repository { * Copy a file and return the new file details. A side effect of the copy * is that the owner will be the account authenticated with this oauth client. * - * @param \core\oauth2\client $client Authenticated client. + * @param \repository_googledocs\rest $client Authenticated client. * @param string $fileid The file we are copying. * @param string $name The original filename (don't change it). * @@ -811,14 +811,13 @@ class repository_googledocs extends repository { /** * Delete a file (for the current user). * - * @param \core\oauth2\client $client Authenticated client. + * @param \repository_googledocs\rest $client Authenticated client. * @param string $fileid The file we are deleting. * @return boolean */ - protected function delete_file($client, $fileid) { + protected function delete_file(\repository_googledocs\rest $client, $fileid) { $params = ['fileid' => $fileid]; $response = $client->call('delete', $params, ' '); - var_dump($response); if (empty($response->id)) { $details = 'Cannot delete file: ' . $fileid; throw new repository_exception('errorwhilecommunicatingwith', 'repository', '', $details); @@ -829,12 +828,12 @@ class repository_googledocs extends repository { /** * Add a writer to the permissions on the file (temporary). * - * @param \core\oauth2\client $client Authenticated client. + * @param \repository_googledocs\rest $client Authenticated client. * @param string $fileid The file we are updating. * @param string $email The email of the writer account to add. * @return boolean */ - protected function add_temp_writer_to_file($client, $fileid, $email) { + protected function add_temp_writer_to_file(\repository_googledocs\rest $client, $fileid, $email) { // Expires in 7 days. $expires = new DateTime(); $expires->add(new DateInterval("P7D")); @@ -858,12 +857,12 @@ class repository_googledocs extends repository { /** * Add a writer to the permissions on the file. * - * @param \core\oauth2\client $client Authenticated client. + * @param \repository_googledocs\rest $client Authenticated client. * @param string $fileid The file we are updating. * @param string $email The email of the writer account to add. * @return boolean */ - protected function add_writer_to_file($client, $fileid, $email) { + protected function add_writer_to_file(\repository_googledocs\rest $client, $fileid, $email) { $updateeditor = [ 'emailAddress' => $email, 'role' => 'writer', @@ -881,12 +880,12 @@ class repository_googledocs extends repository { /** * Move from root to folder * - * @param \core\oauth2\client $client Authenticated client. + * @param \repository_googledocs\rest $client Authenticated client. * @param string $fileid The file we are updating. * @param string $folderid The id of the folder we are moving to * @return boolean */ - protected function move_file_from_root_to_folder($client, $fileid, $folderid) { + protected function move_file_from_root_to_folder(\repository_googledocs\rest $client, $fileid, $folderid) { // Set the parent. $params = [ 'fileid' => $fileid, 'addParents' => $folderid, 'removeParents' => 'root' @@ -902,12 +901,12 @@ class repository_googledocs extends repository { /** * Remove parent * - * @param \core\oauth2\client $client Authenticated client. + * @param \repository_googledocs\rest $client Authenticated client. * @param string $fileid The file we are updating. * @param string $folderid The id of the folder we are removing * @return boolean */ - protected function remove_file_parent($client, $fileid, $folderid) { + protected function remove_file_parent(\repository_googledocs\rest $client, $fileid, $folderid) { // Set the parent. $params = [ 'fileid' => $fileid, 'removeParents' => $folderid @@ -923,11 +922,11 @@ class repository_googledocs extends repository { /** * Prevent writers from sharing. * - * @param \core\oauth2\client $client Authenticated client. + * @param \repository_googledocs\rest $client Authenticated client. * @param string $fileid The file we are updating. * @return boolean */ - protected function prevent_writers_from_sharing_file($client, $fileid) { + protected function prevent_writers_from_sharing_file(\repository_googledocs\rest $client, $fileid) { // We don't want anyone but Moodle to change the sharing settings. $params = [ 'fileid' => $fileid @@ -946,11 +945,11 @@ class repository_googledocs extends repository { /** * Allow anyone with the link to read the file. * - * @param \core\oauth2\client $client Authenticated client. + * @param \repository_googledocs\rest $client Authenticated client. * @param string $fileid The file we are updating. * @return boolean */ - protected function set_file_sharing_anyone_with_link_can_read($client, $fileid) { + protected function set_file_sharing_anyone_with_link_can_read(\repository_googledocs\rest $client, $fileid) { $updateread = [ 'type' => 'anyone', 'role' => 'reader', @@ -1030,7 +1029,7 @@ class repository_googledocs extends repository { $foldername = $context->get_context_name(); $fullpath .= '/' . $foldername; - $folderid = $cache->get('fullpath'); + $folderid = $cache->get('fullpath'); if (empty($folderid)) { $folderid = $this->folder_exists_in_folder($systemservice, $foldername, $parentid); } @@ -1179,7 +1178,11 @@ class repository_googledocs extends repository { } } -// Icon from: http://www.iconspedia.com/icon/google-2706.html. +/** + * Callback to get the required scopes for system account. + * + * @return string + */ function repository_googledocs_oauth2_system_scopes() { return 'https://www.googleapis.com/auth/drive'; }