Skip to content

Commit

Permalink
MDL-61768 repository_googledocs: Deprecate unused methods
Browse files Browse the repository at this point in the history
Deprecates methods from the repository_googledocs class which are
no longer used.
  • Loading branch information
Mihail Geshoski committed Apr 15, 2021
1 parent 6528181 commit 5f4bdef
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions repository/googledocs/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,14 @@ public function print_login_popup($attr = null) {
/**
* Build the breadcrumb from a path.
*
* @deprecated since Moodle 3.11.
* @param string $path to create a breadcrumb from.
* @return array containing name and path of each crumb.
*/
protected function build_breadcrumb($path) {
debugging('The function build_breadcrumb() is deprecated, please use get_navigation() from the ' .
'googledocs repository content classes instead.', DEBUG_DEVELOPER);

$bread = explode('/', $path);
$crumbtrail = '';
foreach ($bread as $crumb) {
Expand All @@ -200,12 +204,16 @@ protected function build_breadcrumb($path) {
*
* Typically, a node will be id|Name of the node.
*
* @deprecated since Moodle 3.11.
* @param string $id of the node.
* @param string $name of the node, will be URL encoded.
* @param string $root to append the node on, must be a result of this function.
* @return string path to the node.
*/
protected function build_node_path($id, $name = '', $root = '') {
debugging('The function build_node_path() is deprecated, please use ' .
'\repository_googledocs\helper::build_node_path() instead.', DEBUG_DEVELOPER);

$path = $id;
if (!empty($name)) {
$path .= '|' . urlencode($name);
Expand All @@ -219,11 +227,15 @@ protected function build_node_path($id, $name = '', $root = '') {
/**
* Returns information about a node in a path.
*
* @deprecated since Moodle 3.11.
* @see self::build_node_path()
* @param string $node to extrat information from.
* @return array about the node.
*/
protected function explode_node_path($node) {
debugging('The function explode_node_path() is deprecated, please use ' .
'\repository_googledocs\helper::explode_node_path() instead.', DEBUG_DEVELOPER);

if (strpos($node, '|') !== false) {
list($id, $name) = explode('|', $node, 2);
$name = urldecode($name);
Expand Down Expand Up @@ -331,12 +343,16 @@ public function search($searchtext, $page = 0) {
* This returns a list of files and folders with their details as they should be
* formatted and returned by functions such as get_listing() or search().
*
* @deprecated since Moodle 3.11.
* @param string $q search query as expected by the Google API.
* @param string $path parent path of the current files, will not be used for the query.
* @param int $page page.
* @return array of files and folders.
*/
protected function query($q, $path = null, $page = 0) {
debugging('The function query() is deprecated, please use get_content_nodes() from the ' .
'googledocs repository content classes instead.', DEBUG_DEVELOPER);

global $OUTPUT;

$files = array();
Expand Down
8 changes: 8 additions & 0 deletions repository/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ http://docs.moodle.org/dev/Repository_API
* 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.
* The Google Drive repository now supports browsing and searching for content from shared drives.
* The method build_breadcrumb() in repository/googledocs/lib.php has been deprecated, please use get_navigation()
from the googledocs repository content classes instead.
* The method build_node_path() in repository/googledocs/lib.php has been deprecated, please use
\repository_googledocs\helper::build_node_path() instead.
* The method explode_node_path() in repository/googledocs/lib.php has been deprecated, please use
\repository_googledocs\helper::explode_node_path() instead.
* The function query() in repository/googledocs/lib.php is deprecated, please use get_content_nodes() from the
googledocs repository content classes instead.

=== 3.4 ===
Repositories should no longer directly call file_system#add_file_to_pool or file_system#add_string_to_pool
Expand Down

0 comments on commit 5f4bdef

Please sign in to comment.