Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
tool_httpsreplace\url_finder Class Reference

Examines DB for non-https src or data links. More...

Public Member Functions

 http_link_stats ($progress=null)
 Returns a hash of what hosts are referred to over http and would need to be changed.
 
 upgrade_http_links ($progress=null)
 Changes all resources referred to over http to https.
 

Protected Member Functions

 check_domain_availability ($url)
 Check if url is available (GET request returns 200)
 
 domain_swap ($table, $column, $domain, $search)
 Replace http domains with https equivalent, with two types of exceptions for less straightforward swaps.
 
 get_select_search_in_column ($columnname)
 Returns SQL to be used to match embedded http links in the given column.
 
 process ($replacing=false, $progress=null)
 Originally forked from core function db_search().
 

Detailed Description

Examines DB for non-https src or data links.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ check_domain_availability()

tool_httpsreplace\url_finder::check_domain_availability ( $url)
protected

Check if url is available (GET request returns 200)

Parameters
string$url
Return values
bool

◆ domain_swap()

tool_httpsreplace\url_finder::domain_swap ( $table,
$column,
$domain,
$search )
protected

Replace http domains with https equivalent, with two types of exceptions for less straightforward swaps.

Parameters
string$table
database_column_info$column
string$domain
string$searchsearch string that has prefix, protocol, domain name and one extra character, example1: src="http://host.com/ example2: DATA="HTTP://MYDOMAIN.EDU" example3: src="HTTP://hello.world?
Return values
void

◆ get_select_search_in_column()

tool_httpsreplace\url_finder::get_select_search_in_column ( $columnname)
protected

Returns SQL to be used to match embedded http links in the given column.

Parameters
string$columnnamename of the column (ready to be used in the SQL query)
Return values
array

◆ http_link_stats()

tool_httpsreplace\url_finder::http_link_stats ( $progress = null)

Returns a hash of what hosts are referred to over http and would need to be changed.

Parameters
progress_bar$progressProgress bar keeping track of this process.
Return values
arrayHash of domains with number of references as the value.

◆ process()

tool_httpsreplace\url_finder::process ( $replacing = false,
$progress = null )
protected

Originally forked from core function db_search().

Parameters
bool$replacingWhether or not to replace the found urls.
progress_bar$progressProgress bar keeping track of this process.
Return values
bool|arrayIf $replacing, return true on success. If not, return hash of http urls to number of times used.

◆ upgrade_http_links()

tool_httpsreplace\url_finder::upgrade_http_links ( $progress = null)

Changes all resources referred to over http to https.

Parameters
progress_bar$progressProgress bar keeping track of this process.
Return values
boolTrue upon success

The documentation for this class was generated from the following file: