id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
216,300 | moodle/moodle | dataformat/excel/classes/writer.php | writer.set_sheettitle | public function set_sheettitle($title) {
if (!$title) {
return;
}
// Replace any characters in the name that Excel cannot cope with.
$title = strtr(trim($title, "'"), '[]*/\?:', ' ');
// Shorten the title if necessary.
$title = \core_text::substr($title... | php | public function set_sheettitle($title) {
if (!$title) {
return;
}
// Replace any characters in the name that Excel cannot cope with.
$title = strtr(trim($title, "'"), '[]*/\?:', ' ');
// Shorten the title if necessary.
$title = \core_text::substr($title... | [
"public",
"function",
"set_sheettitle",
"(",
"$",
"title",
")",
"{",
"if",
"(",
"!",
"$",
"title",
")",
"{",
"return",
";",
"}",
"// Replace any characters in the name that Excel cannot cope with.",
"$",
"title",
"=",
"strtr",
"(",
"trim",
"(",
"$",
"title",
"... | Set the title of the worksheet inside a spreadsheet
For some formats this will be ignored.
@param string $title | [
"Set",
"the",
"title",
"of",
"the",
"worksheet",
"inside",
"a",
"spreadsheet"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/dataformat/excel/classes/writer.php#L54-L67 |
216,301 | moodle/moodle | mod/quiz/accessrule/delaybetweenattempts/rule.php | quizaccess_delaybetweenattempts.compute_next_start_time | protected function compute_next_start_time($numprevattempts, $lastattempt) {
if ($numprevattempts == 0) {
return 0;
}
$lastattemptfinish = $lastattempt->timefinish;
if ($this->quiz->timelimit > 0) {
$lastattemptfinish = min($lastattemptfinish,
... | php | protected function compute_next_start_time($numprevattempts, $lastattempt) {
if ($numprevattempts == 0) {
return 0;
}
$lastattemptfinish = $lastattempt->timefinish;
if ($this->quiz->timelimit > 0) {
$lastattemptfinish = min($lastattemptfinish,
... | [
"protected",
"function",
"compute_next_start_time",
"(",
"$",
"numprevattempts",
",",
"$",
"lastattempt",
")",
"{",
"if",
"(",
"$",
"numprevattempts",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"$",
"lastattemptfinish",
"=",
"$",
"lastattempt",
"->",
"tim... | Compute the next time a student would be allowed to start an attempt,
according to this rule.
@param int $numprevattempts number of previous attempts.
@param object $lastattempt information about the previous attempt.
@return number the time. | [
"Compute",
"the",
"next",
"time",
"a",
"student",
"would",
"be",
"allowed",
"to",
"start",
"an",
"attempt",
"according",
"to",
"this",
"rule",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessrule/delaybetweenattempts/rule.php#L76-L93 |
216,302 | moodle/moodle | customfield/classes/event/category_created.php | category_created.create_from_object | public static function create_from_object(category_controller $category) : category_created {
$eventparams = [
'objectid' => $category->get('id'),
'context' => $category->get_handler()->get_configuration_context(),
'other' => ['name' => $category->get('name')]
];
... | php | public static function create_from_object(category_controller $category) : category_created {
$eventparams = [
'objectid' => $category->get('id'),
'context' => $category->get_handler()->get_configuration_context(),
'other' => ['name' => $category->get('name')]
];
... | [
"public",
"static",
"function",
"create_from_object",
"(",
"category_controller",
"$",
"category",
")",
":",
"category_created",
"{",
"$",
"eventparams",
"=",
"[",
"'objectid'",
"=>",
"$",
"category",
"->",
"get",
"(",
"'id'",
")",
",",
"'context'",
"=>",
"$",... | Creates an instance from a category controller object
@param category_controller $category
@return category_created | [
"Creates",
"an",
"instance",
"from",
"a",
"category",
"controller",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/event/category_created.php#L56-L65 |
216,303 | moodle/moodle | mnet/xmlrpc/xmlparser.php | mnet_encxml_parser.initialise | function initialise() {
$this->parser = xml_parser_create();
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, "start_element", "end_element");
xml_set_character_data_handler($this->parser, "discard_data");
$this->tag_number = 0; // Just a uniq... | php | function initialise() {
$this->parser = xml_parser_create();
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, "start_element", "end_element");
xml_set_character_data_handler($this->parser, "discard_data");
$this->tag_number = 0; // Just a uniq... | [
"function",
"initialise",
"(",
")",
"{",
"$",
"this",
"->",
"parser",
"=",
"xml_parser_create",
"(",
")",
";",
"xml_set_object",
"(",
"$",
"this",
"->",
"parser",
",",
"$",
"this",
")",
";",
"xml_set_element_handler",
"(",
"$",
"this",
"->",
"parser",
",... | Set default element handlers and initialise properties to empty.
@return bool True | [
"Set",
"default",
"element",
"handlers",
"and",
"initialise",
"properties",
"to",
"empty",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mnet/xmlrpc/xmlparser.php#L39-L59 |
216,304 | moodle/moodle | mnet/xmlrpc/xmlparser.php | mnet_encxml_parser.parse | function parse($data) {
$p = xml_parse($this->parser, $data);
if ($p == 0) {
// Parse failed
$errcode = xml_get_error_code($this->parser);
$errstring = xml_error_string($errcode);
$lineno = xml_get_current_line_number($this->parser);
if ($line... | php | function parse($data) {
$p = xml_parse($this->parser, $data);
if ($p == 0) {
// Parse failed
$errcode = xml_get_error_code($this->parser);
$errstring = xml_error_string($errcode);
$lineno = xml_get_current_line_number($this->parser);
if ($line... | [
"function",
"parse",
"(",
"$",
"data",
")",
"{",
"$",
"p",
"=",
"xml_parse",
"(",
"$",
"this",
"->",
"parser",
",",
"$",
"data",
")",
";",
"if",
"(",
"$",
"p",
"==",
"0",
")",
"{",
"// Parse failed",
"$",
"errcode",
"=",
"xml_get_error_code",
"(",
... | Parse a block of XML text
The XML Text will be an XML-RPC request which is wrapped in an XML doc
with a signature from the sender. This envelope may be encrypted and
delivered within another XML envelope with a symmetric key. The parser
should first decrypt this XML, and then place the XML-RPC request into
the data_ob... | [
"Parse",
"a",
"block",
"of",
"XML",
"text"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mnet/xmlrpc/xmlparser.php#L99-L135 |
216,305 | moodle/moodle | mnet/xmlrpc/xmlparser.php | mnet_encxml_parser.start_element | function start_element($parser, $name, $attrs) {
$this->tag_number++;
$handler = 'discard_data';
switch(strtoupper($name)) {
case 'DIGESTVALUE':
$handler = 'parse_digest';
break;
case 'SIGNATUREVALUE':
$handler = 'parse_sign... | php | function start_element($parser, $name, $attrs) {
$this->tag_number++;
$handler = 'discard_data';
switch(strtoupper($name)) {
case 'DIGESTVALUE':
$handler = 'parse_digest';
break;
case 'SIGNATUREVALUE':
$handler = 'parse_sign... | [
"function",
"start_element",
"(",
"$",
"parser",
",",
"$",
"name",
",",
"$",
"attrs",
")",
"{",
"$",
"this",
"->",
"tag_number",
"++",
";",
"$",
"handler",
"=",
"'discard_data'",
";",
"switch",
"(",
"strtoupper",
"(",
"$",
"name",
")",
")",
"{",
"cas... | Set the character-data handler to the right function for each element
For each tag (element) name, this function switches the character-data
handler to the function that handles that element. Note that character
data is referred to the handler in blocks of 1024 bytes.
@param mixed $parser The XML parser
@param ... | [
"Set",
"the",
"character",
"-",
"data",
"handler",
"to",
"the",
"right",
"function",
"for",
"each",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mnet/xmlrpc/xmlparser.php#L156-L189 |
216,306 | moodle/moodle | mnet/xmlrpc/xmlparser.php | mnet_encxml_parser.discard_data | function discard_data($parser, $data) {
if (!$this->errorstarted) {
// Not interested
return true;
}
$data = trim($data);
if (isset($this->errorstarted->faultstringstarted) && !empty($data)) {
$this->remoteerror .= ', message: ' . $data;
} else... | php | function discard_data($parser, $data) {
if (!$this->errorstarted) {
// Not interested
return true;
}
$data = trim($data);
if (isset($this->errorstarted->faultstringstarted) && !empty($data)) {
$this->remoteerror .= ', message: ' . $data;
} else... | [
"function",
"discard_data",
"(",
"$",
"parser",
",",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"errorstarted",
")",
"{",
"// Not interested",
"return",
"true",
";",
"}",
"$",
"data",
"=",
"trim",
"(",
"$",
"data",
")",
";",
"if",
"(... | Discard the next chunk of character data
This is used for tags that we're not interested in.
@param mixed $parser The XML parser
@param string $data The content of the current tag (1024 byte chunk)
@return bool True | [
"Discard",
"the",
"next",
"chunk",
"of",
"character",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mnet/xmlrpc/xmlparser.php#L281-L299 |
216,307 | moodle/moodle | mod/feedback/classes/observer.php | mod_feedback_observer.course_content_deleted | public static function course_content_deleted(\core\event\course_content_deleted $event) {
global $DB;
// Delete all templates of given course.
$DB->delete_records('feedback_template', array('course' => $event->objectid));
} | php | public static function course_content_deleted(\core\event\course_content_deleted $event) {
global $DB;
// Delete all templates of given course.
$DB->delete_records('feedback_template', array('course' => $event->objectid));
} | [
"public",
"static",
"function",
"course_content_deleted",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"course_content_deleted",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
";",
"// Delete all templates of given course.",
"$",
"DB",
"->",
"delete_records",
"(",
"'feedba... | Observer for the even course_content_deleted - delete all course templates.
@param \core\event\course_content_deleted $event | [
"Observer",
"for",
"the",
"even",
"course_content_deleted",
"-",
"delete",
"all",
"course",
"templates",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/observer.php#L41-L45 |
216,308 | moodle/moodle | filter/urltolink/filter.php | filter_urltolink.convert_urls_into_links | protected function convert_urls_into_links(&$text) {
//I've added img tags to this list of tags to ignore.
//See MDL-21168 for more info. A better way to ignore tags whether or not
//they are escaped partially or completely would be desirable. For example:
//<a href="blah">
//<... | php | protected function convert_urls_into_links(&$text) {
//I've added img tags to this list of tags to ignore.
//See MDL-21168 for more info. A better way to ignore tags whether or not
//they are escaped partially or completely would be desirable. For example:
//<a href="blah">
//<... | [
"protected",
"function",
"convert_urls_into_links",
"(",
"&",
"$",
"text",
")",
"{",
"//I've added img tags to this list of tags to ignore.",
"//See MDL-21168 for more info. A better way to ignore tags whether or not",
"//they are escaped partially or completely would be desirable. For example... | Given some text this function converts any URLs it finds into HTML links
@param string $text Passed in by reference. The string to be searched for urls. | [
"Given",
"some",
"text",
"this",
"function",
"converts",
"any",
"URLs",
"it",
"finds",
"into",
"HTML",
"links"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/filter/urltolink/filter.php#L69-L159 |
216,309 | moodle/moodle | grade/grading/form/rubric/renderer.php | gradingform_rubric_renderer.display_instances | public function display_instances($instances, $defaultcontent, $cangrade) {
$return = '';
if (sizeof($instances)) {
$return .= html_writer::start_tag('div', array('class' => 'advancedgrade'));
$idx = 0;
foreach ($instances as $instance) {
$return .= $t... | php | public function display_instances($instances, $defaultcontent, $cangrade) {
$return = '';
if (sizeof($instances)) {
$return .= html_writer::start_tag('div', array('class' => 'advancedgrade'));
$idx = 0;
foreach ($instances as $instance) {
$return .= $t... | [
"public",
"function",
"display_instances",
"(",
"$",
"instances",
",",
"$",
"defaultcontent",
",",
"$",
"cangrade",
")",
"{",
"$",
"return",
"=",
"''",
";",
"if",
"(",
"sizeof",
"(",
"$",
"instances",
")",
")",
"{",
"$",
"return",
".=",
"html_writer",
... | Displays for the student the list of instances or default content if no instances found
@param array $instances array of objects of type gradingform_rubric_instance
@param string $defaultcontent default string that would be displayed without advanced grading
@param boolean $cangrade whether current user has capability... | [
"Displays",
"for",
"the",
"student",
"the",
"list",
"of",
"instances",
"or",
"default",
"content",
"if",
"no",
"instances",
"found"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/rubric/renderer.php#L564-L575 |
216,310 | moodle/moodle | grade/grading/form/rubric/renderer.php | gradingform_rubric_renderer.display_rubric_mapping_explained | public function display_rubric_mapping_explained($scores) {
$html = '';
if (!$scores) {
return $html;
}
if ($scores['minscore'] <> 0) {
$html .= $this->output->notification(get_string('zerolevelsabsent', 'gradingform_rubric'), 'error');
}
$html .= ... | php | public function display_rubric_mapping_explained($scores) {
$html = '';
if (!$scores) {
return $html;
}
if ($scores['minscore'] <> 0) {
$html .= $this->output->notification(get_string('zerolevelsabsent', 'gradingform_rubric'), 'error');
}
$html .= ... | [
"public",
"function",
"display_rubric_mapping_explained",
"(",
"$",
"scores",
")",
"{",
"$",
"html",
"=",
"''",
";",
"if",
"(",
"!",
"$",
"scores",
")",
"{",
"return",
"$",
"html",
";",
"}",
"if",
"(",
"$",
"scores",
"[",
"'minscore'",
"]",
"<>",
"0"... | Generates and returns HTML code to display information box about how rubric score is converted to the grade
@param array $scores
@return string | [
"Generates",
"and",
"returns",
"HTML",
"code",
"to",
"display",
"information",
"box",
"about",
"how",
"rubric",
"score",
"is",
"converted",
"to",
"the",
"grade"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/form/rubric/renderer.php#L634-L644 |
216,311 | moodle/moodle | admin/tool/dataprivacy/classes/external.php | external.cancel_data_request | public static function cancel_data_request($requestid) {
global $USER;
$warnings = [];
$params = external_api::validate_parameters(self::cancel_data_request_parameters(), [
'requestid' => $requestid
]);
$requestid = $params['requestid'];
// Validate context ... | php | public static function cancel_data_request($requestid) {
global $USER;
$warnings = [];
$params = external_api::validate_parameters(self::cancel_data_request_parameters(), [
'requestid' => $requestid
]);
$requestid = $params['requestid'];
// Validate context ... | [
"public",
"static",
"function",
"cancel_data_request",
"(",
"$",
"requestid",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"warnings",
"=",
"[",
"]",
";",
"$",
"params",
"=",
"external_api",
"::",
"validate_parameters",
"(",
"self",
"::",
"cancel_data_request_pa... | Cancel a data request.
@since Moodle 3.5
@param int $requestid The request ID.
@return array
@throws invalid_persistent_exception
@throws coding_exception
@throws invalid_parameter_exception
@throws restricted_context_exception | [
"Cancel",
"a",
"data",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/external.php#L86-L133 |
216,312 | moodle/moodle | admin/tool/dataprivacy/classes/external.php | external.contact_dpo | public static function contact_dpo($message) {
global $USER;
$warnings = [];
$params = external_api::validate_parameters(self::contact_dpo_parameters(), [
'message' => $message
]);
$message = $params['message'];
// Validate context.
$userid = $USER->... | php | public static function contact_dpo($message) {
global $USER;
$warnings = [];
$params = external_api::validate_parameters(self::contact_dpo_parameters(), [
'message' => $message
]);
$message = $params['message'];
// Validate context.
$userid = $USER->... | [
"public",
"static",
"function",
"contact_dpo",
"(",
"$",
"message",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"warnings",
"=",
"[",
"]",
";",
"$",
"params",
"=",
"external_api",
"::",
"validate_parameters",
"(",
"self",
"::",
"contact_dpo_parameters",
"(",
... | Make a general enquiry to a DPO.
@since Moodle 3.5
@param string $message The message to be sent to the DPO.
@return array
@throws coding_exception
@throws invalid_parameter_exception
@throws invalid_persistent_exception
@throws restricted_context_exception
@throws dml_exception
@throws moodle_exception | [
"Make",
"a",
"general",
"enquiry",
"to",
"a",
"DPO",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/external.php#L173-L224 |
216,313 | moodle/moodle | admin/tool/dataprivacy/classes/external.php | external.mark_complete | public static function mark_complete($requestid) {
global $USER;
$warnings = [];
$params = external_api::validate_parameters(self::mark_complete_parameters(), [
'requestid' => $requestid,
]);
$requestid = $params['requestid'];
// Validate context and access ... | php | public static function mark_complete($requestid) {
global $USER;
$warnings = [];
$params = external_api::validate_parameters(self::mark_complete_parameters(), [
'requestid' => $requestid,
]);
$requestid = $params['requestid'];
// Validate context and access ... | [
"public",
"static",
"function",
"mark_complete",
"(",
"$",
"requestid",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"warnings",
"=",
"[",
"]",
";",
"$",
"params",
"=",
"external_api",
"::",
"validate_parameters",
"(",
"self",
"::",
"mark_complete_parameters",
... | Mark a user's general enquiry's status as complete.
@since Moodle 3.5.2
@param int $requestid The request ID of the general enquiry.
@return array
@throws coding_exception
@throws invalid_parameter_exception
@throws invalid_persistent_exception
@throws restricted_context_exception
@throws dml_exception
@throws moodle_... | [
"Mark",
"a",
"user",
"s",
"general",
"enquiry",
"s",
"status",
"as",
"complete",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/external.php#L264-L289 |
216,314 | moodle/moodle | admin/tool/dataprivacy/classes/external.php | external.deny_data_request | public static function deny_data_request($requestid) {
$warnings = [];
$params = external_api::validate_parameters(self::deny_data_request_parameters(), [
'requestid' => $requestid
]);
$requestid = $params['requestid'];
// Validate context.
$context = context... | php | public static function deny_data_request($requestid) {
$warnings = [];
$params = external_api::validate_parameters(self::deny_data_request_parameters(), [
'requestid' => $requestid
]);
$requestid = $params['requestid'];
// Validate context.
$context = context... | [
"public",
"static",
"function",
"deny_data_request",
"(",
"$",
"requestid",
")",
"{",
"$",
"warnings",
"=",
"[",
"]",
";",
"$",
"params",
"=",
"external_api",
"::",
"validate_parameters",
"(",
"self",
"::",
"deny_data_request_parameters",
"(",
")",
",",
"[",
... | Deny a data request.
@since Moodle 3.5
@param int $requestid The request ID.
@return array
@throws coding_exception
@throws dml_exception
@throws invalid_parameter_exception
@throws restricted_context_exception
@throws moodle_exception | [
"Deny",
"a",
"data",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/external.php#L541-L574 |
216,315 | moodle/moodle | admin/tool/dataprivacy/classes/external.php | external.bulk_deny_data_requests | public static function bulk_deny_data_requests($requestids) {
$warnings = [];
$result = false;
$params = external_api::validate_parameters(self::bulk_deny_data_requests_parameters(), [
'requestids' => $requestids
]);
$requestids = $params['requestids'];
// Va... | php | public static function bulk_deny_data_requests($requestids) {
$warnings = [];
$result = false;
$params = external_api::validate_parameters(self::bulk_deny_data_requests_parameters(), [
'requestids' => $requestids
]);
$requestids = $params['requestids'];
// Va... | [
"public",
"static",
"function",
"bulk_deny_data_requests",
"(",
"$",
"requestids",
")",
"{",
"$",
"warnings",
"=",
"[",
"]",
";",
"$",
"result",
"=",
"false",
";",
"$",
"params",
"=",
"external_api",
"::",
"validate_parameters",
"(",
"self",
"::",
"bulk_deny... | Bulk deny data requests.
@since Moodle 3.5
@param array $requestids Array consisting of request ID's.
@return array
@throws coding_exception
@throws dml_exception
@throws invalid_parameter_exception
@throws restricted_context_exception
@throws moodle_exception | [
"Bulk",
"deny",
"data",
"requests",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/external.php#L615-L653 |
216,316 | moodle/moodle | admin/tool/dataprivacy/classes/external.php | external.create_purpose_form | public static function create_purpose_form($jsonformdata) {
global $PAGE;
$warnings = [];
$params = external_api::validate_parameters(self::create_purpose_form_parameters(), [
'jsonformdata' => $jsonformdata
]);
// Validate context and access to manage the registry... | php | public static function create_purpose_form($jsonformdata) {
global $PAGE;
$warnings = [];
$params = external_api::validate_parameters(self::create_purpose_form_parameters(), [
'jsonformdata' => $jsonformdata
]);
// Validate context and access to manage the registry... | [
"public",
"static",
"function",
"create_purpose_form",
"(",
"$",
"jsonformdata",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"warnings",
"=",
"[",
"]",
";",
"$",
"params",
"=",
"external_api",
"::",
"validate_parameters",
"(",
"self",
"::",
"create_purpose_form... | Creates a data purpose from form data.
@since Moodle 3.5
@param string $jsonformdata
@return array | [
"Creates",
"a",
"data",
"purpose",
"from",
"form",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/external.php#L778-L812 |
216,317 | moodle/moodle | admin/tool/dataprivacy/classes/external.php | external.tree_extra_branches | public static function tree_extra_branches($contextid, $element) {
$params = external_api::validate_parameters(self::tree_extra_branches_parameters(), [
'contextid' => $contextid,
'element' => $element,
]);
$context = context_helper::instance_by_id($params['contextid'])... | php | public static function tree_extra_branches($contextid, $element) {
$params = external_api::validate_parameters(self::tree_extra_branches_parameters(), [
'contextid' => $contextid,
'element' => $element,
]);
$context = context_helper::instance_by_id($params['contextid'])... | [
"public",
"static",
"function",
"tree_extra_branches",
"(",
"$",
"contextid",
",",
"$",
"element",
")",
"{",
"$",
"params",
"=",
"external_api",
"::",
"validate_parameters",
"(",
"self",
"::",
"tree_extra_branches_parameters",
"(",
")",
",",
"[",
"'contextid'",
... | Returns tree extra branches.
@since Moodle 3.5
@param int $contextid
@param string $element
@return array | [
"Returns",
"tree",
"extra",
"branches",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/external.php#L1167-L1197 |
216,318 | moodle/moodle | admin/tool/dataprivacy/classes/external.php | external.confirm_contexts_for_deletion | public static function confirm_contexts_for_deletion($ids) {
$warnings = [];
$params = external_api::validate_parameters(self::confirm_contexts_for_deletion_parameters(), [
'ids' => $ids
]);
$ids = $params['ids'];
// Validate context and access to manage the registry... | php | public static function confirm_contexts_for_deletion($ids) {
$warnings = [];
$params = external_api::validate_parameters(self::confirm_contexts_for_deletion_parameters(), [
'ids' => $ids
]);
$ids = $params['ids'];
// Validate context and access to manage the registry... | [
"public",
"static",
"function",
"confirm_contexts_for_deletion",
"(",
"$",
"ids",
")",
"{",
"$",
"warnings",
"=",
"[",
"]",
";",
"$",
"params",
"=",
"external_api",
"::",
"validate_parameters",
"(",
"self",
"::",
"confirm_contexts_for_deletion_parameters",
"(",
")... | Confirm a given array of expired context record IDs
@since Moodle 3.5
@param int[] $ids Array of record IDs from the expired contexts table.
@return array
@throws coding_exception
@throws dml_exception
@throws invalid_parameter_exception
@throws restricted_context_exception | [
"Confirm",
"a",
"given",
"array",
"of",
"expired",
"context",
"record",
"IDs"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/external.php#L1238-L1309 |
216,319 | moodle/moodle | admin/tool/dataprivacy/classes/external.php | external.get_category_options | public static function get_category_options($includeinherit, $includenotset) {
$warnings = [];
$params = self::validate_parameters(self::get_category_options_parameters(), [
'includeinherit' => $includeinherit,
'includenotset' => $includenotset
]);
$includeinheri... | php | public static function get_category_options($includeinherit, $includenotset) {
$warnings = [];
$params = self::validate_parameters(self::get_category_options_parameters(), [
'includeinherit' => $includeinherit,
'includenotset' => $includenotset
]);
$includeinheri... | [
"public",
"static",
"function",
"get_category_options",
"(",
"$",
"includeinherit",
",",
"$",
"includenotset",
")",
"{",
"$",
"warnings",
"=",
"[",
"]",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_category_options_parame... | Fetches a list of data category options containing category IDs as keys and the category name for the value.
@param bool $includeinherit Whether to include the "Inherit" option.
@param bool $includenotset Whether to include the "Not set" option.
@return array | [
"Fetches",
"a",
"list",
"of",
"data",
"category",
"options",
"containing",
"category",
"IDs",
"as",
"keys",
"and",
"the",
"category",
"name",
"for",
"the",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/external.php#L1411-L1439 |
216,320 | moodle/moodle | admin/tool/dataprivacy/classes/external.php | external.get_purpose_options | public static function get_purpose_options($includeinherit, $includenotset) {
$warnings = [];
$params = self::validate_parameters(self::get_category_options_parameters(), [
'includeinherit' => $includeinherit,
'includenotset' => $includenotset
]);
$includeinherit... | php | public static function get_purpose_options($includeinherit, $includenotset) {
$warnings = [];
$params = self::validate_parameters(self::get_category_options_parameters(), [
'includeinherit' => $includeinherit,
'includenotset' => $includenotset
]);
$includeinherit... | [
"public",
"static",
"function",
"get_purpose_options",
"(",
"$",
"includeinherit",
",",
"$",
"includenotset",
")",
"{",
"$",
"warnings",
"=",
"[",
"]",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_category_options_paramet... | Fetches a list of data storage purposes containing purpose IDs as keys and the purpose name for the value.
@param bool $includeinherit Whether to include the "Inherit" option.
@param bool $includenotset Whether to include the "Not set" option.
@return array | [
"Fetches",
"a",
"list",
"of",
"data",
"storage",
"purposes",
"containing",
"purpose",
"IDs",
"as",
"keys",
"and",
"the",
"purpose",
"name",
"for",
"the",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/external.php#L1479-L1506 |
216,321 | moodle/moodle | admin/tool/dataprivacy/classes/external.php | external.get_activity_options | public static function get_activity_options($nodefaults) {
$warnings = [];
$params = self::validate_parameters(self::get_activity_options_parameters(), [
'nodefaults' => $nodefaults,
]);
$nodefaults = $params['nodefaults'];
$context = context_system::instance();
... | php | public static function get_activity_options($nodefaults) {
$warnings = [];
$params = self::validate_parameters(self::get_activity_options_parameters(), [
'nodefaults' => $nodefaults,
]);
$nodefaults = $params['nodefaults'];
$context = context_system::instance();
... | [
"public",
"static",
"function",
"get_activity_options",
"(",
"$",
"nodefaults",
")",
"{",
"$",
"warnings",
"=",
"[",
"]",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_activity_options_parameters",
"(",
")",
",",
"[",
... | Fetches a list of activity options for setting data registry defaults.
@param boolean $nodefaults If false, it will fetch all of the activities. Otherwise, it will only fetch the activities
that don't have defaults yet (e.g. when adding a new activity module defaults).
@return array | [
"Fetches",
"a",
"list",
"of",
"activity",
"options",
"for",
"setting",
"data",
"registry",
"defaults",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/external.php#L1546-L1586 |
216,322 | moodle/moodle | lib/spout/src/Spout/Writer/ODS/Internal/Workbook.php | Workbook.close | public function close($finalFilePointer)
{
/** @var Worksheet[] $worksheets */
$worksheets = $this->worksheets;
$numWorksheets = count($worksheets);
foreach ($worksheets as $worksheet) {
$worksheet->close();
}
// Finish creating all the necessary files b... | php | public function close($finalFilePointer)
{
/** @var Worksheet[] $worksheets */
$worksheets = $this->worksheets;
$numWorksheets = count($worksheets);
foreach ($worksheets as $worksheet) {
$worksheet->close();
}
// Finish creating all the necessary files b... | [
"public",
"function",
"close",
"(",
"$",
"finalFilePointer",
")",
"{",
"/** @var Worksheet[] $worksheets */",
"$",
"worksheets",
"=",
"$",
"this",
"->",
"worksheets",
";",
"$",
"numWorksheets",
"=",
"count",
"(",
"$",
"worksheets",
")",
";",
"foreach",
"(",
"$... | Closes the workbook and all its associated sheets.
All the necessary files are written to disk and zipped together to create the ODS file.
All the temporary files are then deleted.
@param resource $finalFilePointer Pointer to the ODS that will be created
@return void | [
"Closes",
"the",
"workbook",
"and",
"all",
"its",
"associated",
"sheets",
".",
"All",
"the",
"necessary",
"files",
"are",
"written",
"to",
"disk",
"and",
"zipped",
"together",
"to",
"create",
"the",
"ODS",
"file",
".",
"All",
"the",
"temporary",
"files",
"... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/ODS/Internal/Workbook.php#L89-L107 |
216,323 | moodle/moodle | mod/forum/classes/local/data_mappers/legacy/author.php | author.to_legacy_objects | public function to_legacy_objects(array $authors) : array {
return array_map(function(author_entity $author) {
return (object) [
'id' => $author->get_id(),
'picture' => $author->get_picture_item_id(),
'firstname' => $author->get_first_name(),
... | php | public function to_legacy_objects(array $authors) : array {
return array_map(function(author_entity $author) {
return (object) [
'id' => $author->get_id(),
'picture' => $author->get_picture_item_id(),
'firstname' => $author->get_first_name(),
... | [
"public",
"function",
"to_legacy_objects",
"(",
"array",
"$",
"authors",
")",
":",
"array",
"{",
"return",
"array_map",
"(",
"function",
"(",
"author_entity",
"$",
"author",
")",
"{",
"return",
"(",
"object",
")",
"[",
"'id'",
"=>",
"$",
"author",
"->",
... | Convert a list of author entities into stdClasses.
@param author_entity[] $authors The authors to convert.
@return stdClass[] | [
"Convert",
"a",
"list",
"of",
"author",
"entities",
"into",
"stdClasses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/data_mappers/legacy/author.php#L45-L61 |
216,324 | moodle/moodle | cache/stores/file/lib.php | cachestore_file.prescan_keys | protected function prescan_keys() {
$files = glob($this->glob_keys_pattern(), GLOB_MARK | GLOB_NOSORT);
if (is_array($files)) {
foreach ($files as $filename) {
$this->keys[basename($filename)] = filemtime($filename);
}
}
} | php | protected function prescan_keys() {
$files = glob($this->glob_keys_pattern(), GLOB_MARK | GLOB_NOSORT);
if (is_array($files)) {
foreach ($files as $filename) {
$this->keys[basename($filename)] = filemtime($filename);
}
}
} | [
"protected",
"function",
"prescan_keys",
"(",
")",
"{",
"$",
"files",
"=",
"glob",
"(",
"$",
"this",
"->",
"glob_keys_pattern",
"(",
")",
",",
"GLOB_MARK",
"|",
"GLOB_NOSORT",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"files",
")",
")",
"{",
"foreach"... | Pre-scan the cache to see which keys are present. | [
"Pre",
"-",
"scan",
"the",
"cache",
"to",
"see",
"which",
"keys",
"are",
"present",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/file/lib.php#L282-L289 |
216,325 | moodle/moodle | cache/stores/file/lib.php | cachestore_file.glob_keys_pattern | protected function glob_keys_pattern($prefix = '') {
if ($this->singledirectory) {
return $this->path . '/'.$prefix.'*.cache';
} else {
return $this->path . '/*/'.$prefix.'*.cache';
}
} | php | protected function glob_keys_pattern($prefix = '') {
if ($this->singledirectory) {
return $this->path . '/'.$prefix.'*.cache';
} else {
return $this->path . '/*/'.$prefix.'*.cache';
}
} | [
"protected",
"function",
"glob_keys_pattern",
"(",
"$",
"prefix",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"singledirectory",
")",
"{",
"return",
"$",
"this",
"->",
"path",
".",
"'/'",
".",
"$",
"prefix",
".",
"'*.cache'",
";",
"}",
"else",
... | Gets a pattern suitable for use with glob to find all keys in the cache.
@param string $prefix A prefix to use.
@return string The pattern. | [
"Gets",
"a",
"pattern",
"suitable",
"for",
"use",
"with",
"glob",
"to",
"find",
"all",
"keys",
"in",
"the",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/file/lib.php#L297-L303 |
216,326 | moodle/moodle | cache/stores/file/lib.php | cachestore_file.file_path_for_key | protected function file_path_for_key($key, $create = false) {
if ($this->singledirectory) {
// Its a single directory, easy, just the store instances path + the file name.
return $this->path . '/' . $key . '.cache';
} else {
// We are using a single subdirectory to ac... | php | protected function file_path_for_key($key, $create = false) {
if ($this->singledirectory) {
// Its a single directory, easy, just the store instances path + the file name.
return $this->path . '/' . $key . '.cache';
} else {
// We are using a single subdirectory to ac... | [
"protected",
"function",
"file_path_for_key",
"(",
"$",
"key",
",",
"$",
"create",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"singledirectory",
")",
"{",
"// Its a single directory, easy, just the store instances path + the file name.",
"return",
"$",
"thi... | Returns the file path to use for the given key.
@param string $key The key to generate a file path for.
@param bool $create If set to the true the directory structure the key requires will be created.
@return string The full path to the file that stores a particular cache key. | [
"Returns",
"the",
"file",
"path",
"to",
"use",
"for",
"the",
"given",
"key",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/file/lib.php#L312-L328 |
216,327 | moodle/moodle | cache/stores/file/lib.php | cachestore_file.purge | public function purge() {
if ($this->isready) {
$files = glob($this->glob_keys_pattern(), GLOB_MARK | GLOB_NOSORT);
if (is_array($files)) {
foreach ($files as $filename) {
@unlink($filename);
}
}
$this->keys = ar... | php | public function purge() {
if ($this->isready) {
$files = glob($this->glob_keys_pattern(), GLOB_MARK | GLOB_NOSORT);
if (is_array($files)) {
foreach ($files as $filename) {
@unlink($filename);
}
}
$this->keys = ar... | [
"public",
"function",
"purge",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isready",
")",
"{",
"$",
"files",
"=",
"glob",
"(",
"$",
"this",
"->",
"glob_keys_pattern",
"(",
")",
",",
"GLOB_MARK",
"|",
"GLOB_NOSORT",
")",
";",
"if",
"(",
"is_array",
... | Purges the cache definition deleting all the items within it.
@return boolean True on success. False otherwise. | [
"Purges",
"the",
"cache",
"definition",
"deleting",
"all",
"the",
"items",
"within",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/file/lib.php#L544-L555 |
216,328 | moodle/moodle | cache/stores/file/lib.php | cachestore_file.purge_all_definitions | protected function purge_all_definitions() {
// Warning: limit the deletion to what file store is actually able
// to create using the internal {@link purge()} providing the
// {@link $path} with a wildcard to perform a purge action over all the definitions.
$currpath = $this->path;
... | php | protected function purge_all_definitions() {
// Warning: limit the deletion to what file store is actually able
// to create using the internal {@link purge()} providing the
// {@link $path} with a wildcard to perform a purge action over all the definitions.
$currpath = $this->path;
... | [
"protected",
"function",
"purge_all_definitions",
"(",
")",
"{",
"// Warning: limit the deletion to what file store is actually able",
"// to create using the internal {@link purge()} providing the",
"// {@link $path} with a wildcard to perform a purge action over all the definitions.",
"$",
"cu... | Purges all the cache definitions deleting all items within them.
@return boolean True on success. False otherwise. | [
"Purges",
"all",
"the",
"cache",
"definitions",
"deleting",
"all",
"items",
"within",
"them",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/file/lib.php#L562-L571 |
216,329 | moodle/moodle | cache/stores/file/lib.php | cachestore_file.ensure_path_exists | protected function ensure_path_exists() {
global $CFG;
if (!is_writable($this->path)) {
if ($this->custompath && !$this->autocreate) {
throw new coding_exception('File store path does not exist. It must exist and be writable by the web server.');
}
$cr... | php | protected function ensure_path_exists() {
global $CFG;
if (!is_writable($this->path)) {
if ($this->custompath && !$this->autocreate) {
throw new coding_exception('File store path does not exist. It must exist and be writable by the web server.');
}
$cr... | [
"protected",
"function",
"ensure_path_exists",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"is_writable",
"(",
"$",
"this",
"->",
"path",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"custompath",
"&&",
"!",
"$",
"this",
"->",
"autocrea... | Checks to make sure that the path for the file cache exists.
@return bool
@throws coding_exception | [
"Checks",
"to",
"make",
"sure",
"that",
"the",
"path",
"for",
"the",
"file",
"cache",
"exists",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/file/lib.php#L627-L651 |
216,330 | moodle/moodle | cache/stores/file/lib.php | cachestore_file.write_file | protected function write_file($file, $content) {
// Generate a temp file that is going to be unique. We'll rename it at the end to the desired file name.
// in this way we avoid partial writes.
$path = dirname($file);
while (true) {
$tempfile = $path.'/'.uniqid(sesskey().'.',... | php | protected function write_file($file, $content) {
// Generate a temp file that is going to be unique. We'll rename it at the end to the desired file name.
// in this way we avoid partial writes.
$path = dirname($file);
while (true) {
$tempfile = $path.'/'.uniqid(sesskey().'.',... | [
"protected",
"function",
"write_file",
"(",
"$",
"file",
",",
"$",
"content",
")",
"{",
"// Generate a temp file that is going to be unique. We'll rename it at the end to the desired file name.",
"// in this way we avoid partial writes.",
"$",
"path",
"=",
"dirname",
"(",
"$",
... | Writes your madness to a file.
There are several things going on in this function to try to ensure what we don't end up with partial writes etc.
1. Files for writing are opened with the mode xb, the file must be created and can not already exist.
2. Renaming, data is written to a temporary file, where it can be verifi... | [
"Writes",
"your",
"madness",
"to",
"a",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/file/lib.php#L702-L740 |
216,331 | moodle/moodle | cache/stores/file/lib.php | cachestore_file.find_all | public function find_all() {
$this->ensure_path_exists();
$files = glob($this->glob_keys_pattern(), GLOB_MARK | GLOB_NOSORT);
$return = array();
if ($files === false) {
return $return;
}
foreach ($files as $file) {
$return[] = substr(basename($file... | php | public function find_all() {
$this->ensure_path_exists();
$files = glob($this->glob_keys_pattern(), GLOB_MARK | GLOB_NOSORT);
$return = array();
if ($files === false) {
return $return;
}
foreach ($files as $file) {
$return[] = substr(basename($file... | [
"public",
"function",
"find_all",
"(",
")",
"{",
"$",
"this",
"->",
"ensure_path_exists",
"(",
")",
";",
"$",
"files",
"=",
"glob",
"(",
"$",
"this",
"->",
"glob_keys_pattern",
"(",
")",
",",
"GLOB_MARK",
"|",
"GLOB_NOSORT",
")",
";",
"$",
"return",
"=... | Finds all of the keys being used by this cache store instance.
@return array | [
"Finds",
"all",
"of",
"the",
"keys",
"being",
"used",
"by",
"this",
"cache",
"store",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/file/lib.php#L755-L766 |
216,332 | moodle/moodle | question/type/calculated/question.php | qtype_calculated_dataset_loader.get_values | public function get_values($itemnumber) {
if ($itemnumber <= 0 || $itemnumber > $this->get_number_of_items()) {
$a = new stdClass();
$a->id = $this->questionid;
$a->item = $itemnumber;
throw new moodle_exception('cannotgetdsfordependent', 'question', '', $a);
... | php | public function get_values($itemnumber) {
if ($itemnumber <= 0 || $itemnumber > $this->get_number_of_items()) {
$a = new stdClass();
$a->id = $this->questionid;
$a->item = $itemnumber;
throw new moodle_exception('cannotgetdsfordependent', 'question', '', $a);
... | [
"public",
"function",
"get_values",
"(",
"$",
"itemnumber",
")",
"{",
"if",
"(",
"$",
"itemnumber",
"<=",
"0",
"||",
"$",
"itemnumber",
">",
"$",
"this",
"->",
"get_number_of_items",
"(",
")",
")",
"{",
"$",
"a",
"=",
"new",
"stdClass",
"(",
")",
";"... | Load a particular set of values for each dataset used by this question.
@param int $itemnumber which set of values to load.
0 < $itemnumber <= {@link get_number_of_items()}.
@return array name => value. | [
"Load",
"a",
"particular",
"set",
"of",
"values",
"for",
"each",
"dataset",
"used",
"by",
"this",
"question",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/question.php#L242-L251 |
216,333 | moodle/moodle | question/type/calculated/question.php | qtype_calculated_variable_substituter.format_float | public function format_float($x, $length = null, $format = null) {
if (!is_null($length) && !is_null($format)) {
if ($format == '1' ) { // Answer is to have $length decimals.
// Decimal places.
$x = sprintf('%.' . $length . 'F', $x);
} else if ($x) { // S... | php | public function format_float($x, $length = null, $format = null) {
if (!is_null($length) && !is_null($format)) {
if ($format == '1' ) { // Answer is to have $length decimals.
// Decimal places.
$x = sprintf('%.' . $length . 'F', $x);
} else if ($x) { // S... | [
"public",
"function",
"format_float",
"(",
"$",
"x",
",",
"$",
"length",
"=",
"null",
",",
"$",
"format",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"length",
")",
"&&",
"!",
"is_null",
"(",
"$",
"format",
")",
")",
"{",
"if",
... | Display a float properly formatted with a certain number of decimal places.
@param number $x the number to format
@param int $length restrict to this many decimal places or significant
figures. If null, the number is not rounded.
@param int format 1 => decimalformat, 2 => significantfigures.
@return string formtted num... | [
"Display",
"a",
"float",
"properly",
"formatted",
"with",
"a",
"certain",
"number",
"of",
"decimal",
"places",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/question.php#L337-L406 |
216,334 | moodle/moodle | question/type/calculated/question.php | qtype_calculated_variable_substituter.calculate | public function calculate($expression) {
// Make sure no malicious code is present in the expression. Refer MDL-46148 for details.
if ($error = qtype_calculated_find_formula_errors($expression)) {
throw new moodle_exception('illegalformulasyntax', 'qtype_calculated', '', $error);
}
... | php | public function calculate($expression) {
// Make sure no malicious code is present in the expression. Refer MDL-46148 for details.
if ($error = qtype_calculated_find_formula_errors($expression)) {
throw new moodle_exception('illegalformulasyntax', 'qtype_calculated', '', $error);
}
... | [
"public",
"function",
"calculate",
"(",
"$",
"expression",
")",
"{",
"// Make sure no malicious code is present in the expression. Refer MDL-46148 for details.",
"if",
"(",
"$",
"error",
"=",
"qtype_calculated_find_formula_errors",
"(",
"$",
"expression",
")",
")",
"{",
"th... | Evaluate an expression using the variable values.
@param string $expression the expression. A PHP expression with placeholders
like {a} for where the variables need to go.
@return float the computed result. | [
"Evaluate",
"an",
"expression",
"using",
"the",
"variable",
"values",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/question.php#L422-L434 |
216,335 | moodle/moodle | question/type/calculated/question.php | qtype_calculated_variable_substituter.calculate_raw | protected function calculate_raw($expression) {
try {
// In older PHP versions this this is a way to validate code passed to eval.
// The trick came from http://php.net/manual/en/function.eval.php.
if (@eval('return true; $result = ' . $expression . ';')) {
re... | php | protected function calculate_raw($expression) {
try {
// In older PHP versions this this is a way to validate code passed to eval.
// The trick came from http://php.net/manual/en/function.eval.php.
if (@eval('return true; $result = ' . $expression . ';')) {
re... | [
"protected",
"function",
"calculate_raw",
"(",
"$",
"expression",
")",
"{",
"try",
"{",
"// In older PHP versions this this is a way to validate code passed to eval.",
"// The trick came from http://php.net/manual/en/function.eval.php.",
"if",
"(",
"@",
"eval",
"(",
"'return true; ... | Evaluate an expression after the variable values have been substituted.
@param string $expression the expression. A PHP expression with placeholders
like {a} for where the variables need to go.
@return float the computed result. | [
"Evaluate",
"an",
"expression",
"after",
"the",
"variable",
"values",
"have",
"been",
"substituted",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/question.php#L442-L455 |
216,336 | moodle/moodle | cache/lib.php | cacheable_object_array.prepare_to_cache | final public function prepare_to_cache() {
$result = array();
foreach ($this as $key => $value) {
if ($value instanceof cacheable_object) {
$value = new cache_cached_object($value);
} else {
throw new coding_exception('Only cacheable_object instanc... | php | final public function prepare_to_cache() {
$result = array();
foreach ($this as $key => $value) {
if ($value instanceof cacheable_object) {
$value = new cache_cached_object($value);
} else {
throw new coding_exception('Only cacheable_object instanc... | [
"final",
"public",
"function",
"prepare_to_cache",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"cacheable_object",
")",
... | Returns the data to cache for this object.
@return array An array of cache_cached_object instances.
@throws coding_exception | [
"Returns",
"the",
"data",
"to",
"cache",
"for",
"this",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/lib.php#L197-L208 |
216,337 | moodle/moodle | cache/lib.php | cacheable_object_array.wake_from_cache | final static public function wake_from_cache($data) {
if (!is_array($data)) {
throw new coding_exception('Invalid data type when reviving cacheable_array data');
}
$result = array();
foreach ($data as $key => $value) {
$result[$key] = $value->restore_object();
... | php | final static public function wake_from_cache($data) {
if (!is_array($data)) {
throw new coding_exception('Invalid data type when reviving cacheable_array data');
}
$result = array();
foreach ($data as $key => $value) {
$result[$key] = $value->restore_object();
... | [
"final",
"static",
"public",
"function",
"wake_from_cache",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Invalid data type when reviving cacheable_array data'",
")",
";",
"}",... | Returns the cacheable_object_array that was originally sent to the cache.
@param array $data
@return cacheable_object_array
@throws coding_exception | [
"Returns",
"the",
"cacheable_object_array",
"that",
"was",
"originally",
"sent",
"to",
"the",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/lib.php#L217-L227 |
216,338 | moodle/moodle | question/format/blackboard_six/formatbase.php | qformat_blackboard_six_base.store_file_for_text_field | protected function store_file_for_text_field(&$text, $tempdir, $filepathinsidetempdir, $filename) {
global $USER;
$fs = get_file_storage();
if (empty($text['itemid'])) {
$text['itemid'] = file_get_unused_draft_itemid();
}
// As question file areas don't support subdir... | php | protected function store_file_for_text_field(&$text, $tempdir, $filepathinsidetempdir, $filename) {
global $USER;
$fs = get_file_storage();
if (empty($text['itemid'])) {
$text['itemid'] = file_get_unused_draft_itemid();
}
// As question file areas don't support subdir... | [
"protected",
"function",
"store_file_for_text_field",
"(",
"&",
"$",
"text",
",",
"$",
"tempdir",
",",
"$",
"filepathinsidetempdir",
",",
"$",
"filename",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"fs",
"=",
"get_file_storage",
"(",
")",
";",
"if",
"(",
... | Store an image file in a draft filearea
@param array $text, if itemid element don't exists it will be created
@param string $tempdir path to root of image tree
@param string $filepathinsidetempdir path to image in the tree
@param string $filename image's name
@return string new name of the image as it was stored | [
"Store",
"an",
"image",
"file",
"in",
"a",
"draft",
"filearea"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/format/blackboard_six/formatbase.php#L95-L115 |
216,339 | moodle/moodle | question/format/blackboard_six/formatbase.php | qformat_blackboard_six_base.text_field | public function text_field($text) {
$data = array();
// Step one, find all file refs then add to array.
preg_match_all('|<img[^>]+src="([^"]*)"|i', $text, $out); // Find all src refs.
$filepaths = array();
foreach ($out[1] as $path) {
$fullpath = $this->filebase . '/'... | php | public function text_field($text) {
$data = array();
// Step one, find all file refs then add to array.
preg_match_all('|<img[^>]+src="([^"]*)"|i', $text, $out); // Find all src refs.
$filepaths = array();
foreach ($out[1] as $path) {
$fullpath = $this->filebase . '/'... | [
"public",
"function",
"text_field",
"(",
"$",
"text",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"// Step one, find all file refs then add to array.",
"preg_match_all",
"(",
"'|<img[^>]+src=\"([^\"]*)\"|i'",
",",
"$",
"text",
",",
"$",
"out",
")",
";",
... | Given an HTML text with references to images files,
store all images in a draft filearea,
and return an array with all urls in text recoded,
format set to FORMAT_HTML, and itemid set to filearea itemid
@param string $text text to parse and recode
@return array with keys text, format, itemid. | [
"Given",
"an",
"HTML",
"text",
"with",
"references",
"to",
"images",
"files",
"store",
"all",
"images",
"in",
"a",
"draft",
"filearea",
"and",
"return",
"an",
"array",
"with",
"all",
"urls",
"in",
"text",
"recoded",
"format",
"set",
"to",
"FORMAT_HTML",
"a... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/format/blackboard_six/formatbase.php#L125-L145 |
216,340 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.flag_expired_contexts | public function flag_expired_contexts() : array {
$this->trace->output('Checking requirements');
if (!$this->check_requirements()) {
$this->trace->output('Requirements not met. Cannot process expired retentions.', 1);
return [0, 0];
}
// Clear old and stale recor... | php | public function flag_expired_contexts() : array {
$this->trace->output('Checking requirements');
if (!$this->check_requirements()) {
$this->trace->output('Requirements not met. Cannot process expired retentions.', 1);
return [0, 0];
}
// Clear old and stale recor... | [
"public",
"function",
"flag_expired_contexts",
"(",
")",
":",
"array",
"{",
"$",
"this",
"->",
"trace",
"->",
"output",
"(",
"'Checking requirements'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"check_requirements",
"(",
")",
")",
"{",
"$",
"this",
"-... | Flag expired contexts as expired.
@return int[] The number of contexts flagged as expired for courses, and users. | [
"Flag",
"expired",
"contexts",
"as",
"expired",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L71-L108 |
216,341 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.clear_old_records | protected static function clear_old_records() {
global $DB;
$sql = "SELECT dpctx.*
FROM {tool_dataprivacy_ctxexpired} dpctx
LEFT JOIN {context} ctx ON ctx.id = dpctx.contextid
WHERE ctx.id IS NULL";
$orphaned = $DB->get_recordset_sql($sql);
... | php | protected static function clear_old_records() {
global $DB;
$sql = "SELECT dpctx.*
FROM {tool_dataprivacy_ctxexpired} dpctx
LEFT JOIN {context} ctx ON ctx.id = dpctx.contextid
WHERE ctx.id IS NULL";
$orphaned = $DB->get_recordset_sql($sql);
... | [
"protected",
"static",
"function",
"clear_old_records",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT dpctx.*\n FROM {tool_dataprivacy_ctxexpired} dpctx\n LEFT JOIN {context} ctx ON ctx.id = dpctx.contextid\n WHERE ctx.id... | Clear old and stale records. | [
"Clear",
"old",
"and",
"stale",
"records",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L113-L146 |
216,342 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.get_nested_expiry_info | protected static function get_nested_expiry_info($contextpath = '') : array {
$coursepaths = self::get_nested_expiry_info_for_courses($contextpath);
$userpaths = self::get_nested_expiry_info_for_user($contextpath);
return array_merge($coursepaths, $userpaths);
} | php | protected static function get_nested_expiry_info($contextpath = '') : array {
$coursepaths = self::get_nested_expiry_info_for_courses($contextpath);
$userpaths = self::get_nested_expiry_info_for_user($contextpath);
return array_merge($coursepaths, $userpaths);
} | [
"protected",
"static",
"function",
"get_nested_expiry_info",
"(",
"$",
"contextpath",
"=",
"''",
")",
":",
"array",
"{",
"$",
"coursepaths",
"=",
"self",
"::",
"get_nested_expiry_info_for_courses",
"(",
"$",
"contextpath",
")",
";",
"$",
"userpaths",
"=",
"self"... | Get the full nested set of expiry data relating to all contexts.
@param string $contextpath A contexpath to restrict results to
@return \stdClass[] | [
"Get",
"the",
"full",
"nested",
"set",
"of",
"expiry",
"data",
"relating",
"to",
"all",
"contexts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L154-L159 |
216,343 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.get_nested_expiry_info_for_courses | protected static function get_nested_expiry_info_for_courses($contextpath = '') : array {
global $DB;
$contextfields = \context_helper::get_preload_record_columns_sql('ctx');
$expiredfields = expired_context::get_sql_fields('expiredctx', 'expiredctx');
$purposefields = 'dpctx.purposeid'... | php | protected static function get_nested_expiry_info_for_courses($contextpath = '') : array {
global $DB;
$contextfields = \context_helper::get_preload_record_columns_sql('ctx');
$expiredfields = expired_context::get_sql_fields('expiredctx', 'expiredctx');
$purposefields = 'dpctx.purposeid'... | [
"protected",
"static",
"function",
"get_nested_expiry_info_for_courses",
"(",
"$",
"contextpath",
"=",
"''",
")",
":",
"array",
"{",
"global",
"$",
"DB",
";",
"$",
"contextfields",
"=",
"\\",
"context_helper",
"::",
"get_preload_record_columns_sql",
"(",
"'ctx'",
... | Get the full nested set of expiry data relating to course-related contexts.
@param string $contextpath A contexpath to restrict results to
@return \stdClass[] | [
"Get",
"the",
"full",
"nested",
"set",
"of",
"expiry",
"data",
"relating",
"to",
"course",
"-",
"related",
"contexts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L167-L212 |
216,344 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.get_nested_expiry_info_for_user | protected static function get_nested_expiry_info_for_user($contextpath = '') : array {
global $DB;
$contextfields = \context_helper::get_preload_record_columns_sql('ctx');
$expiredfields = expired_context::get_sql_fields('expiredctx', 'expiredctx');
$purposefields = 'dpctx.purposeid';
... | php | protected static function get_nested_expiry_info_for_user($contextpath = '') : array {
global $DB;
$contextfields = \context_helper::get_preload_record_columns_sql('ctx');
$expiredfields = expired_context::get_sql_fields('expiredctx', 'expiredctx');
$purposefields = 'dpctx.purposeid';
... | [
"protected",
"static",
"function",
"get_nested_expiry_info_for_user",
"(",
"$",
"contextpath",
"=",
"''",
")",
":",
"array",
"{",
"global",
"$",
"DB",
";",
"$",
"contextfields",
"=",
"\\",
"context_helper",
"::",
"get_preload_record_columns_sql",
"(",
"'ctx'",
")"... | Get the full nested set of expiry data.
@param string $contextpath A contexpath to restrict results to
@return \stdClass[] | [
"Get",
"the",
"full",
"nested",
"set",
"of",
"expiry",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L220-L255 |
216,345 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.get_nested_expiry_info_from_sql | protected static function get_nested_expiry_info_from_sql(string $sql, array $params) : array {
global $DB;
$fulllist = $DB->get_recordset_sql($sql, $params);
$datalist = [];
$expiredcontents = [];
$pathstoskip = [];
$userpurpose = data_registry::get_effective_contextle... | php | protected static function get_nested_expiry_info_from_sql(string $sql, array $params) : array {
global $DB;
$fulllist = $DB->get_recordset_sql($sql, $params);
$datalist = [];
$expiredcontents = [];
$pathstoskip = [];
$userpurpose = data_registry::get_effective_contextle... | [
"protected",
"static",
"function",
"get_nested_expiry_info_from_sql",
"(",
"string",
"$",
"sql",
",",
"array",
"$",
"params",
")",
":",
"array",
"{",
"global",
"$",
"DB",
";",
"$",
"fulllist",
"=",
"$",
"DB",
"->",
"get_recordset_sql",
"(",
"$",
"sql",
","... | Get the full nested set of expiry data given appropriate SQL.
Only contexts which have expired will be included.
@param string $sql The SQL used to select the nested information.
@param array $params The params required by the SQL.
@return \stdClass[] | [
"Get",
"the",
"full",
"nested",
"set",
"of",
"expiry",
"data",
"given",
"appropriate",
"SQL",
".",
"Only",
"contexts",
"which",
"have",
"expired",
"will",
"be",
"included",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L265-L328 |
216,346 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.is_eligible_for_deletion | protected static function is_eligible_for_deletion(array &$pathstoskip, \context $context) : bool {
$shouldskip = false;
// Check whether any of the child contexts are ineligble.
$shouldskip = !empty(array_filter($pathstoskip, function($path) use ($context) {
// If any child context ... | php | protected static function is_eligible_for_deletion(array &$pathstoskip, \context $context) : bool {
$shouldskip = false;
// Check whether any of the child contexts are ineligble.
$shouldskip = !empty(array_filter($pathstoskip, function($path) use ($context) {
// If any child context ... | [
"protected",
"static",
"function",
"is_eligible_for_deletion",
"(",
"array",
"&",
"$",
"pathstoskip",
",",
"\\",
"context",
"$",
"context",
")",
":",
"bool",
"{",
"$",
"shouldskip",
"=",
"false",
";",
"// Check whether any of the child contexts are ineligble.",
"$",
... | Check whether the supplied context would be elible for deletion.
@param array $pathstoskip A set of paths which should be skipped
@param \context $context
@return bool | [
"Check",
"whether",
"the",
"supplied",
"context",
"would",
"be",
"elible",
"for",
"deletion",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L337-L357 |
216,347 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.process_approved_deletions | public function process_approved_deletions() : array {
$this->trace->output('Checking requirements');
if (!$this->check_requirements()) {
$this->trace->output('Requirements not met. Cannot process expired retentions.', 1);
return [0, 0];
}
$this->trace->output('F... | php | public function process_approved_deletions() : array {
$this->trace->output('Checking requirements');
if (!$this->check_requirements()) {
$this->trace->output('Requirements not met. Cannot process expired retentions.', 1);
return [0, 0];
}
$this->trace->output('F... | [
"public",
"function",
"process_approved_deletions",
"(",
")",
":",
"array",
"{",
"$",
"this",
"->",
"trace",
"->",
"output",
"(",
"'Checking requirements'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"check_requirements",
"(",
")",
")",
"{",
"$",
"this",... | Deletes the expired contexts.
@return int[] The number of deleted contexts. | [
"Deletes",
"the",
"expired",
"contexts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L364-L404 |
216,348 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.delete_expired_context | protected function delete_expired_context(expired_context $expiredctx) {
$context = \context::instance_by_id($expiredctx->get('contextid'));
$this->get_progress()->output("Deleting context {$context->id} - " . $context->get_context_name(true, true));
// Update the expired_context and verify th... | php | protected function delete_expired_context(expired_context $expiredctx) {
$context = \context::instance_by_id($expiredctx->get('contextid'));
$this->get_progress()->output("Deleting context {$context->id} - " . $context->get_context_name(true, true));
// Update the expired_context and verify th... | [
"protected",
"function",
"delete_expired_context",
"(",
"expired_context",
"$",
"expiredctx",
")",
"{",
"$",
"context",
"=",
"\\",
"context",
"::",
"instance_by_id",
"(",
"$",
"expiredctx",
"->",
"get",
"(",
"'contextid'",
")",
")",
";",
"$",
"this",
"->",
"... | Deletes user data from the provided context.
@param expired_context $expiredctx
@return \context|false | [
"Deletes",
"user",
"data",
"from",
"the",
"provided",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L412-L474 |
216,349 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.delete_expired_user_context | protected function delete_expired_user_context(expired_context $expiredctx) {
global $DB;
$contextid = $expiredctx->get('contextid');
$context = \context::instance_by_id($contextid);
$user = \core_user::get_user($context->instanceid, '*', MUST_EXIST);
$privacymanager = $this->g... | php | protected function delete_expired_user_context(expired_context $expiredctx) {
global $DB;
$contextid = $expiredctx->get('contextid');
$context = \context::instance_by_id($contextid);
$user = \core_user::get_user($context->instanceid, '*', MUST_EXIST);
$privacymanager = $this->g... | [
"protected",
"function",
"delete_expired_user_context",
"(",
"expired_context",
"$",
"expiredctx",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"contextid",
"=",
"$",
"expiredctx",
"->",
"get",
"(",
"'contextid'",
")",
";",
"$",
"context",
"=",
"\\",
"context",
... | Deletes user data from the provided user context.
@param expired_context $expiredctx | [
"Deletes",
"user",
"data",
"from",
"the",
"provided",
"user",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L481-L534 |
216,350 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.has_expired | protected static function has_expired(string $period, int $comparisondate) : bool {
$dt = new \DateTime();
$dt->setTimestamp($comparisondate);
$dt->add(new \DateInterval($period));
return (time() >= $dt->getTimestamp());
} | php | protected static function has_expired(string $period, int $comparisondate) : bool {
$dt = new \DateTime();
$dt->setTimestamp($comparisondate);
$dt->add(new \DateInterval($period));
return (time() >= $dt->getTimestamp());
} | [
"protected",
"static",
"function",
"has_expired",
"(",
"string",
"$",
"period",
",",
"int",
"$",
"comparisondate",
")",
":",
"bool",
"{",
"$",
"dt",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"dt",
"->",
"setTimestamp",
"(",
"$",
"comparisondate",... | Check whether a date is beyond the specified period.
@param string $period The Expiry Period
@param int $comparisondate The date for comparison
@return bool | [
"Check",
"whether",
"a",
"date",
"is",
"beyond",
"the",
"specified",
"period",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L566-L572 |
216,351 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.get_expiry_info | protected static function get_expiry_info(purpose $purpose, int $comparisondate = 0) : expiry_info {
$overrides = $purpose->get_purpose_overrides();
$expiredroles = $unexpiredroles = [];
if (empty($overrides)) {
// There are no overrides for this purpose.
if (empty($compa... | php | protected static function get_expiry_info(purpose $purpose, int $comparisondate = 0) : expiry_info {
$overrides = $purpose->get_purpose_overrides();
$expiredroles = $unexpiredroles = [];
if (empty($overrides)) {
// There are no overrides for this purpose.
if (empty($compa... | [
"protected",
"static",
"function",
"get_expiry_info",
"(",
"purpose",
"$",
"purpose",
",",
"int",
"$",
"comparisondate",
"=",
"0",
")",
":",
"expiry_info",
"{",
"$",
"overrides",
"=",
"$",
"purpose",
"->",
"get_purpose_overrides",
"(",
")",
";",
"$",
"expire... | Get the expiry info object for the specified purpose and comparison date.
@param purpose $purpose The purpose of this context
@param int $comparisondate The date for comparison
@return expiry_info | [
"Get",
"the",
"expiry",
"info",
"object",
"for",
"the",
"specified",
"purpose",
"and",
"comparison",
"date",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L581-L621 |
216,352 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.update_from_expiry_info | protected function update_from_expiry_info(\stdClass $expiryrecord) {
if ($isanyexpired = $expiryrecord->info->is_any_expired()) {
// The context is expired in some fashion.
// Create or update as required.
if ($expiryrecord->record->expiredctxid) {
$expiredco... | php | protected function update_from_expiry_info(\stdClass $expiryrecord) {
if ($isanyexpired = $expiryrecord->info->is_any_expired()) {
// The context is expired in some fashion.
// Create or update as required.
if ($expiryrecord->record->expiredctxid) {
$expiredco... | [
"protected",
"function",
"update_from_expiry_info",
"(",
"\\",
"stdClass",
"$",
"expiryrecord",
")",
"{",
"if",
"(",
"$",
"isanyexpired",
"=",
"$",
"expiryrecord",
"->",
"info",
"->",
"is_any_expired",
"(",
")",
")",
"{",
"// The context is expired in some fashion."... | Update or delete the expired_context from the expiry_info object.
This function depends upon the data structure returned from get_nested_expiry_info.
If the context is expired in any way, then an expired_context will be returned, otherwise null will be returned.
@param \stdClass $expiryrecord
@return expired_con... | [
"Update",
"or",
"delete",
"the",
"expired_context",
"from",
"the",
"expiry_info",
"object",
".",
"This",
"function",
"depends",
"upon",
"the",
"data",
"structure",
"returned",
"from",
"get_nested_expiry_info",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L632-L668 |
216,353 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.update_expired_context | protected function update_expired_context(expired_context $expiredctx) {
// Fetch the context from the expired_context record.
$context = \context::instance_by_id($expiredctx->get('contextid'));
// Fetch the current nested expiry data.
$expiryrecords = self::get_nested_expiry_info($cont... | php | protected function update_expired_context(expired_context $expiredctx) {
// Fetch the context from the expired_context record.
$context = \context::instance_by_id($expiredctx->get('contextid'));
// Fetch the current nested expiry data.
$expiryrecords = self::get_nested_expiry_info($cont... | [
"protected",
"function",
"update_expired_context",
"(",
"expired_context",
"$",
"expiredctx",
")",
"{",
"// Fetch the context from the expired_context record.",
"$",
"context",
"=",
"\\",
"context",
"::",
"instance_by_id",
"(",
"$",
"expiredctx",
"->",
"get",
"(",
"'con... | Update the expired context record.
Note: You should use the return value as the provided value will be used to fetch data only.
@param expired_context $expiredctx The record to update
@return expired_context|null | [
"Update",
"the",
"expired",
"context",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L678-L724 |
216,354 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.get_role_users_for_expired_context | protected function get_role_users_for_expired_context(expired_context $expiredctx, \context $context) : \stdClass {
$expiredroles = $expiredctx->get('expiredroles');
$expiredroleusers = [];
if (!empty($expiredroles)) {
// Find the list of expired role users.
$expiredroleu... | php | protected function get_role_users_for_expired_context(expired_context $expiredctx, \context $context) : \stdClass {
$expiredroles = $expiredctx->get('expiredroles');
$expiredroleusers = [];
if (!empty($expiredroles)) {
// Find the list of expired role users.
$expiredroleu... | [
"protected",
"function",
"get_role_users_for_expired_context",
"(",
"expired_context",
"$",
"expiredctx",
",",
"\\",
"context",
"$",
"context",
")",
":",
"\\",
"stdClass",
"{",
"$",
"expiredroles",
"=",
"$",
"expiredctx",
"->",
"get",
"(",
"'expiredroles'",
")",
... | Get the list of actual users for the combination of expired, and unexpired roles.
@param expired_context $expiredctx
@param \context $context
@return \stdClass | [
"Get",
"the",
"list",
"of",
"actual",
"users",
"for",
"the",
"combination",
"of",
"expired",
"and",
"unexpired",
"roles",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L733-L777 |
216,355 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.is_context_expired | public static function is_context_expired(\context $context) : bool {
$parents = $context->get_parent_contexts(true);
foreach ($parents as $parent) {
if ($parent instanceof \context_course) {
// This is a context within a course. Check whether _this context_ is expired as a f... | php | public static function is_context_expired(\context $context) : bool {
$parents = $context->get_parent_contexts(true);
foreach ($parents as $parent) {
if ($parent instanceof \context_course) {
// This is a context within a course. Check whether _this context_ is expired as a f... | [
"public",
"static",
"function",
"is_context_expired",
"(",
"\\",
"context",
"$",
"context",
")",
":",
"bool",
"{",
"$",
"parents",
"=",
"$",
"context",
"->",
"get_parent_contexts",
"(",
"true",
")",
";",
"foreach",
"(",
"$",
"parents",
"as",
"$",
"parent",... | Determine whether the supplied context has expired.
@param \context $context
@return bool | [
"Determine",
"whether",
"the",
"supplied",
"context",
"has",
"expired",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L785-L800 |
216,356 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.is_course_expired | protected static function is_course_expired(\stdClass $course) : bool {
$context = \context_course::instance($course->id);
return self::is_course_context_expired($context);
} | php | protected static function is_course_expired(\stdClass $course) : bool {
$context = \context_course::instance($course->id);
return self::is_course_context_expired($context);
} | [
"protected",
"static",
"function",
"is_course_expired",
"(",
"\\",
"stdClass",
"$",
"course",
")",
":",
"bool",
"{",
"$",
"context",
"=",
"\\",
"context_course",
"::",
"instance",
"(",
"$",
"course",
"->",
"id",
")",
";",
"return",
"self",
"::",
"is_course... | Check whether the course has expired.
@param \stdClass $course
@return bool | [
"Check",
"whether",
"the",
"course",
"has",
"expired",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L808-L812 |
216,357 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.are_user_context_dependencies_expired | protected static function are_user_context_dependencies_expired(\context_user $context) : bool {
// The context instanceid is the user's ID.
if (isguestuser($context->instanceid) || is_siteadmin($context->instanceid)) {
// This is an admin, or the guest and cannot expire.
return ... | php | protected static function are_user_context_dependencies_expired(\context_user $context) : bool {
// The context instanceid is the user's ID.
if (isguestuser($context->instanceid) || is_siteadmin($context->instanceid)) {
// This is an admin, or the guest and cannot expire.
return ... | [
"protected",
"static",
"function",
"are_user_context_dependencies_expired",
"(",
"\\",
"context_user",
"$",
"context",
")",
":",
"bool",
"{",
"// The context instanceid is the user's ID.",
"if",
"(",
"isguestuser",
"(",
"$",
"context",
"->",
"instanceid",
")",
"||",
"... | Determine whether the supplied user context's dependencies have expired.
This checks whether courses have expired, and some other check, but does not check whether the user themself has expired.
Although this seems unusual at first, each location calling this actually checks whether the user is elgible for
deletion, ... | [
"Determine",
"whether",
"the",
"supplied",
"user",
"context",
"s",
"dependencies",
"have",
"expired",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L842-L883 |
216,358 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.is_context_expired_or_unprotected_for_user | public static function is_context_expired_or_unprotected_for_user(\context $context, \stdClass $user) : bool {
// User/course contexts can't expire if no purpose is set in the system context.
if (!data_registry::defaults_set()) {
return false;
}
$parents = $context->get_pare... | php | public static function is_context_expired_or_unprotected_for_user(\context $context, \stdClass $user) : bool {
// User/course contexts can't expire if no purpose is set in the system context.
if (!data_registry::defaults_set()) {
return false;
}
$parents = $context->get_pare... | [
"public",
"static",
"function",
"is_context_expired_or_unprotected_for_user",
"(",
"\\",
"context",
"$",
"context",
",",
"\\",
"stdClass",
"$",
"user",
")",
":",
"bool",
"{",
"// User/course contexts can't expire if no purpose is set in the system context.",
"if",
"(",
"!",... | Determine whether the supplied context has expired or unprotected for the specified user.
@param \context $context
@param \stdClass $user
@return bool | [
"Determine",
"whether",
"the",
"supplied",
"context",
"has",
"expired",
"or",
"unprotected",
"for",
"the",
"specified",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L892-L912 |
216,359 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.get_privacy_manager | protected function get_privacy_manager() : manager {
if (null === $this->manager) {
$this->manager = new manager();
$this->manager->set_observer(new \tool_dataprivacy\manager_observer());
}
return $this->manager;
} | php | protected function get_privacy_manager() : manager {
if (null === $this->manager) {
$this->manager = new manager();
$this->manager->set_observer(new \tool_dataprivacy\manager_observer());
}
return $this->manager;
} | [
"protected",
"function",
"get_privacy_manager",
"(",
")",
":",
"manager",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"manager",
")",
"{",
"$",
"this",
"->",
"manager",
"=",
"new",
"manager",
"(",
")",
";",
"$",
"this",
"->",
"manager",
"->",
"... | Create a new instance of the privacy manager.
@return manager | [
"Create",
"a",
"new",
"instance",
"of",
"the",
"privacy",
"manager",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L975-L982 |
216,360 | moodle/moodle | admin/tool/dataprivacy/classes/expired_contexts_manager.php | expired_contexts_manager.get_progress | protected function get_progress() : \progress_trace {
if (null === $this->progresstracer) {
$this->set_progress(new \text_progress_trace());
}
return $this->progresstracer;
} | php | protected function get_progress() : \progress_trace {
if (null === $this->progresstracer) {
$this->set_progress(new \text_progress_trace());
}
return $this->progresstracer;
} | [
"protected",
"function",
"get_progress",
"(",
")",
":",
"\\",
"progress_trace",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"progresstracer",
")",
"{",
"$",
"this",
"->",
"set_progress",
"(",
"new",
"\\",
"text_progress_trace",
"(",
")",
")",
";",
... | Get the progress tracer.
@return \progress_trace | [
"Get",
"the",
"progress",
"tracer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/expired_contexts_manager.php#L998-L1004 |
216,361 | moodle/moodle | backup/moodle2/restore_subplugin.class.php | restore_subplugin.launch_after_execute_methods | public function launch_after_execute_methods() {
// Check if the after_execute method exists and launch it
$afterexecute = 'after_execute_' . basename($this->connectionpoint->get_path());
if (method_exists($this, $afterexecute)) {
$this->$afterexecute();
}
} | php | public function launch_after_execute_methods() {
// Check if the after_execute method exists and launch it
$afterexecute = 'after_execute_' . basename($this->connectionpoint->get_path());
if (method_exists($this, $afterexecute)) {
$this->$afterexecute();
}
} | [
"public",
"function",
"launch_after_execute_methods",
"(",
")",
"{",
"// Check if the after_execute method exists and launch it",
"$",
"afterexecute",
"=",
"'after_execute_'",
".",
"basename",
"(",
"$",
"this",
"->",
"connectionpoint",
"->",
"get_path",
"(",
")",
")",
"... | after_execute dispatcher for any restore_subplugin class
This method will dispatch execution to the corresponding
after_execute_xxx() method when available, with xxx
being the connection point of the instance, so subplugin
classes with multiple connection points will support
multiple after_execute methods, one for eac... | [
"after_execute",
"dispatcher",
"for",
"any",
"restore_subplugin",
"class"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/restore_subplugin.class.php#L82-L88 |
216,362 | moodle/moodle | backup/moodle2/restore_subplugin.class.php | restore_subplugin.launch_after_restore_methods | public function launch_after_restore_methods() {
// Check if the after_restore method exists and launch it.
$afterestore = 'after_restore_' . basename($this->connectionpoint->get_path());
if (method_exists($this, $afterestore)) {
$this->$afterestore();
}
} | php | public function launch_after_restore_methods() {
// Check if the after_restore method exists and launch it.
$afterestore = 'after_restore_' . basename($this->connectionpoint->get_path());
if (method_exists($this, $afterestore)) {
$this->$afterestore();
}
} | [
"public",
"function",
"launch_after_restore_methods",
"(",
")",
"{",
"// Check if the after_restore method exists and launch it.",
"$",
"afterestore",
"=",
"'after_restore_'",
".",
"basename",
"(",
"$",
"this",
"->",
"connectionpoint",
"->",
"get_path",
"(",
")",
")",
"... | The after_restore dispatcher for any restore_subplugin class.
This method will dispatch execution to the corresponding
after_restore_xxx() method when available, with xxx
being the connection point of the instance, so subplugin
classes with multiple connection points will support
multiple after_restore methods, one fo... | [
"The",
"after_restore",
"dispatcher",
"for",
"any",
"restore_subplugin",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/restore_subplugin.class.php#L99-L105 |
216,363 | moodle/moodle | backup/moodle2/restore_subplugin.class.php | restore_subplugin.log | public function log($message, $level, $a = null, $depth = null, $display = false) {
return $this->step->log($message, $level, $a, $depth, $display);
} | php | public function log($message, $level, $a = null, $depth = null, $display = false) {
return $this->step->log($message, $level, $a, $depth, $display);
} | [
"public",
"function",
"log",
"(",
"$",
"message",
",",
"$",
"level",
",",
"$",
"a",
"=",
"null",
",",
"$",
"depth",
"=",
"null",
",",
"$",
"display",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"step",
"->",
"log",
"(",
"$",
"message",
... | Call the log function from the step. | [
"Call",
"the",
"log",
"function",
"from",
"the",
"step",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/restore_subplugin.class.php#L182-L184 |
216,364 | moodle/moodle | cache/locallib.php | cache_config_writer.config_save | protected function config_save() {
global $CFG;
$cachefile = static::get_config_file_path();
$directory = dirname($cachefile);
if ($directory !== $CFG->dataroot && !file_exists($directory)) {
$result = make_writable_directory($directory, false);
if (!$result) {
... | php | protected function config_save() {
global $CFG;
$cachefile = static::get_config_file_path();
$directory = dirname($cachefile);
if ($directory !== $CFG->dataroot && !file_exists($directory)) {
$result = make_writable_directory($directory, false);
if (!$result) {
... | [
"protected",
"function",
"config_save",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"cachefile",
"=",
"static",
"::",
"get_config_file_path",
"(",
")",
";",
"$",
"directory",
"=",
"dirname",
"(",
"$",
"cachefile",
")",
";",
"if",
"(",
"$",
"directory"... | Saves the current configuration.
Exceptions within this function are tolerated but must be of type cache_exception.
They are caught during initialisation and written to the error log. This is required in order to avoid
infinite loop situations caused by the cache throwing exceptions during its initialisation. | [
"Saves",
"the",
"current",
"configuration",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L69-L117 |
216,365 | moodle/moodle | cache/locallib.php | cache_config_writer.add_store_instance | public function add_store_instance($name, $plugin, array $configuration = array()) {
if (array_key_exists($name, $this->configstores)) {
throw new cache_exception('Duplicate name specificed for cache plugin instance. You must provide a unique name.');
}
$class = 'cachestore_'.$plugin... | php | public function add_store_instance($name, $plugin, array $configuration = array()) {
if (array_key_exists($name, $this->configstores)) {
throw new cache_exception('Duplicate name specificed for cache plugin instance. You must provide a unique name.');
}
$class = 'cachestore_'.$plugin... | [
"public",
"function",
"add_store_instance",
"(",
"$",
"name",
",",
"$",
"plugin",
",",
"array",
"$",
"configuration",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"configstores",
")",
")",
"... | Adds a plugin instance.
This function also calls save so you should redirect immediately, or at least very shortly after
calling this method.
@param string $name The name for the instance (must be unique)
@param string $plugin The name of the plugin.
@param array $configuration The configuration data for the plugin i... | [
"Adds",
"a",
"plugin",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L146-L191 |
216,366 | moodle/moodle | cache/locallib.php | cache_config_writer.add_lock_instance | public function add_lock_instance($name, $plugin, $configuration = array()) {
if (array_key_exists($name, $this->configlocks)) {
throw new cache_exception('Duplicate name specificed for cache lock instance. You must provide a unique name.');
}
$class = 'cachelock_'.$plugin;
i... | php | public function add_lock_instance($name, $plugin, $configuration = array()) {
if (array_key_exists($name, $this->configlocks)) {
throw new cache_exception('Duplicate name specificed for cache lock instance. You must provide a unique name.');
}
$class = 'cachelock_'.$plugin;
i... | [
"public",
"function",
"add_lock_instance",
"(",
"$",
"name",
",",
"$",
"plugin",
",",
"$",
"configuration",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"configlocks",
")",
")",
"{",
"throw"... | Adds a new lock instance to the config file.
@param string $name The name the user gave the instance. PARAM_ALHPANUMEXT
@param string $plugin The plugin we are creating an instance of.
@param string $configuration Configuration data from the config instance.
@throws cache_exception | [
"Adds",
"a",
"new",
"lock",
"instance",
"to",
"the",
"config",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L201-L229 |
216,367 | moodle/moodle | cache/locallib.php | cache_config_writer.delete_lock_instance | public function delete_lock_instance($name) {
if (!array_key_exists($name, $this->configlocks)) {
throw new cache_exception('The requested store does not exist.');
}
if ($this->configlocks[$name]['default']) {
throw new cache_exception('You can not delete the default lock... | php | public function delete_lock_instance($name) {
if (!array_key_exists($name, $this->configlocks)) {
throw new cache_exception('The requested store does not exist.');
}
if ($this->configlocks[$name]['default']) {
throw new cache_exception('You can not delete the default lock... | [
"public",
"function",
"delete_lock_instance",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"configlocks",
")",
")",
"{",
"throw",
"new",
"cache_exception",
"(",
"'The requested store does not exist.'",... | Deletes a lock instance given its name.
@param string $name The name of the plugin, PARAM_ALPHANUMEXT.
@return bool
@throws cache_exception | [
"Deletes",
"a",
"lock",
"instance",
"given",
"its",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L238-L253 |
216,368 | moodle/moodle | cache/locallib.php | cache_config_writer.set_mode_mappings | public function set_mode_mappings(array $modemappings) {
$mappings = array(
cache_store::MODE_APPLICATION => array(),
cache_store::MODE_SESSION => array(),
cache_store::MODE_REQUEST => array(),
);
foreach ($modemappings as $mode => $stores) {
if (!... | php | public function set_mode_mappings(array $modemappings) {
$mappings = array(
cache_store::MODE_APPLICATION => array(),
cache_store::MODE_SESSION => array(),
cache_store::MODE_REQUEST => array(),
);
foreach ($modemappings as $mode => $stores) {
if (!... | [
"public",
"function",
"set_mode_mappings",
"(",
"array",
"$",
"modemappings",
")",
"{",
"$",
"mappings",
"=",
"array",
"(",
"cache_store",
"::",
"MODE_APPLICATION",
"=>",
"array",
"(",
")",
",",
"cache_store",
"::",
"MODE_SESSION",
"=>",
"array",
"(",
")",
"... | Sets the mode mappings.
These determine the default caches for the different modes.
This function also calls save so you should redirect immediately, or at least very shortly after
calling this method.
@param array $modemappings
@return bool
@throws cache_exception | [
"Sets",
"the",
"mode",
"mappings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L266-L299 |
216,369 | moodle/moodle | cache/locallib.php | cache_config_writer.edit_store_instance | public function edit_store_instance($name, $plugin, $configuration) {
if (!array_key_exists($name, $this->configstores)) {
throw new cache_exception('The requested instance does not exist.');
}
$plugins = core_component::get_plugin_list_with_file('cachestore', 'lib.php');
if ... | php | public function edit_store_instance($name, $plugin, $configuration) {
if (!array_key_exists($name, $this->configstores)) {
throw new cache_exception('The requested instance does not exist.');
}
$plugins = core_component::get_plugin_list_with_file('cachestore', 'lib.php');
if ... | [
"public",
"function",
"edit_store_instance",
"(",
"$",
"name",
",",
"$",
"plugin",
",",
"$",
"configuration",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"configstores",
")",
")",
"{",
"throw",
"new",
"cache_ex... | Edits a give plugin instance.
The plugin instance is determined by its name, hence you cannot rename plugins.
This function also calls save so you should redirect immediately, or at least very shortly after
calling this method.
@param string $name
@param string $plugin
@param array $configuration
@return bool
@throws... | [
"Edits",
"a",
"give",
"plugin",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L314-L348 |
216,370 | moodle/moodle | cache/locallib.php | cache_config_writer.delete_store_instance | public function delete_store_instance($name) {
if (!array_key_exists($name, $this->configstores)) {
throw new cache_exception('The requested store does not exist.');
}
if ($this->configstores[$name]['default']) {
throw new cache_exception('The can not delete the default s... | php | public function delete_store_instance($name) {
if (!array_key_exists($name, $this->configstores)) {
throw new cache_exception('The requested store does not exist.');
}
if ($this->configstores[$name]['default']) {
throw new cache_exception('The can not delete the default s... | [
"public",
"function",
"delete_store_instance",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"configstores",
")",
")",
"{",
"throw",
"new",
"cache_exception",
"(",
"'The requested store does not exist.'... | Deletes a store instance.
This function also calls save so you should redirect immediately, or at least very shortly after
calling this method.
@param string $name The name of the instance to delete.
@return bool
@throws cache_exception | [
"Deletes",
"a",
"store",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L360-L386 |
216,371 | moodle/moodle | cache/locallib.php | cache_config_writer.get_default_stores | protected static function get_default_stores() {
global $CFG;
require_once($CFG->dirroot.'/cache/stores/file/lib.php');
require_once($CFG->dirroot.'/cache/stores/session/lib.php');
require_once($CFG->dirroot.'/cache/stores/static/lib.php');
return array(
'default_ap... | php | protected static function get_default_stores() {
global $CFG;
require_once($CFG->dirroot.'/cache/stores/file/lib.php');
require_once($CFG->dirroot.'/cache/stores/session/lib.php');
require_once($CFG->dirroot.'/cache/stores/static/lib.php');
return array(
'default_ap... | [
"protected",
"static",
"function",
"get_default_stores",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/cache/stores/file/lib.php'",
")",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/cache/... | Returns an array of default stores for use.
@return array | [
"Returns",
"an",
"array",
"of",
"default",
"stores",
"for",
"use",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L447-L480 |
216,372 | moodle/moodle | cache/locallib.php | cache_config_writer.update_default_config_stores | public static function update_default_config_stores() {
$factory = cache_factory::instance();
$factory->updating_started();
$config = $factory->create_config_instance(true);
$config->configstores = array_merge($config->configstores, self::get_default_stores());
$config->config_sa... | php | public static function update_default_config_stores() {
$factory = cache_factory::instance();
$factory->updating_started();
$config = $factory->create_config_instance(true);
$config->configstores = array_merge($config->configstores, self::get_default_stores());
$config->config_sa... | [
"public",
"static",
"function",
"update_default_config_stores",
"(",
")",
"{",
"$",
"factory",
"=",
"cache_factory",
"::",
"instance",
"(",
")",
";",
"$",
"factory",
"->",
"updating_started",
"(",
")",
";",
"$",
"config",
"=",
"$",
"factory",
"->",
"create_c... | Updates the default stores within the MUC config file. | [
"Updates",
"the",
"default",
"stores",
"within",
"the",
"MUC",
"config",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L485-L492 |
216,373 | moodle/moodle | cache/locallib.php | cache_config_writer.update_definitions | public static function update_definitions($coreonly = false) {
$factory = cache_factory::instance();
$factory->updating_started();
$config = $factory->create_config_instance(true);
$config->write_definitions_to_cache(self::locate_definitions($coreonly));
$factory->updating_finish... | php | public static function update_definitions($coreonly = false) {
$factory = cache_factory::instance();
$factory->updating_started();
$config = $factory->create_config_instance(true);
$config->write_definitions_to_cache(self::locate_definitions($coreonly));
$factory->updating_finish... | [
"public",
"static",
"function",
"update_definitions",
"(",
"$",
"coreonly",
"=",
"false",
")",
"{",
"$",
"factory",
"=",
"cache_factory",
"::",
"instance",
"(",
")",
";",
"$",
"factory",
"->",
"updating_started",
"(",
")",
";",
"$",
"config",
"=",
"$",
"... | Updates the definition in the configuration from those found in the cache files.
Calls config_save further down, you should redirect immediately or asap after calling this method.
@param bool $coreonly If set to true only core definitions will be updated. | [
"Updates",
"the",
"definition",
"in",
"the",
"configuration",
"from",
"those",
"found",
"in",
"the",
"cache",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L501-L507 |
216,374 | moodle/moodle | cache/locallib.php | cache_config_writer.locate_definitions | protected static function locate_definitions($coreonly = false) {
global $CFG;
$files = array();
if (file_exists($CFG->dirroot.'/lib/db/caches.php')) {
$files['core'] = $CFG->dirroot.'/lib/db/caches.php';
}
if (!$coreonly) {
$plugintypes = core_component... | php | protected static function locate_definitions($coreonly = false) {
global $CFG;
$files = array();
if (file_exists($CFG->dirroot.'/lib/db/caches.php')) {
$files['core'] = $CFG->dirroot.'/lib/db/caches.php';
}
if (!$coreonly) {
$plugintypes = core_component... | [
"protected",
"static",
"function",
"locate_definitions",
"(",
"$",
"coreonly",
"=",
"false",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"files",
"=",
"array",
"(",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/lib/db/caches... | Locates all of the definition files.
@param bool $coreonly If set to true only core definitions will be updated.
@return array | [
"Locates",
"all",
"of",
"the",
"definition",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L515-L551 |
216,375 | moodle/moodle | cache/locallib.php | cache_config_writer.write_definitions_to_cache | private function write_definitions_to_cache(array $definitions) {
// Preserve the selected sharing option when updating the definitions.
// This is set by the user and should never come from caches.php.
foreach ($definitions as $key => $definition) {
unset($definitions[$key]['select... | php | private function write_definitions_to_cache(array $definitions) {
// Preserve the selected sharing option when updating the definitions.
// This is set by the user and should never come from caches.php.
foreach ($definitions as $key => $definition) {
unset($definitions[$key]['select... | [
"private",
"function",
"write_definitions_to_cache",
"(",
"array",
"$",
"definitions",
")",
"{",
"// Preserve the selected sharing option when updating the definitions.",
"// This is set by the user and should never come from caches.php.",
"foreach",
"(",
"$",
"definitions",
"as",
"$... | Writes the updated definitions for the config file.
@param array $definitions | [
"Writes",
"the",
"updated",
"definitions",
"for",
"the",
"config",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L557-L579 |
216,376 | moodle/moodle | cache/locallib.php | cache_config_writer.set_definition_mappings | public function set_definition_mappings($definition, $mappings) {
if (!array_key_exists($definition, $this->configdefinitions)) {
throw new coding_exception('Invalid definition name passed when updating mappings.');
}
foreach ($mappings as $store) {
if (!array_key_exists(... | php | public function set_definition_mappings($definition, $mappings) {
if (!array_key_exists($definition, $this->configdefinitions)) {
throw new coding_exception('Invalid definition name passed when updating mappings.');
}
foreach ($mappings as $store) {
if (!array_key_exists(... | [
"public",
"function",
"set_definition_mappings",
"(",
"$",
"definition",
",",
"$",
"mappings",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"definition",
",",
"$",
"this",
"->",
"configdefinitions",
")",
")",
"{",
"throw",
"new",
"coding_exception",... | Sets the mappings for a given definition.
@param string $definition
@param array $mappings
@throws coding_exception | [
"Sets",
"the",
"mappings",
"for",
"a",
"given",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L602-L627 |
216,377 | moodle/moodle | cache/locallib.php | cache_config_writer.set_definition_sharing | public function set_definition_sharing($definition, $sharingoption, $userinputsharingkey = null) {
if (!array_key_exists($definition, $this->configdefinitions)) {
throw new coding_exception('Invalid definition name passed when updating sharing options.');
}
if (!($this->configdefinit... | php | public function set_definition_sharing($definition, $sharingoption, $userinputsharingkey = null) {
if (!array_key_exists($definition, $this->configdefinitions)) {
throw new coding_exception('Invalid definition name passed when updating sharing options.');
}
if (!($this->configdefinit... | [
"public",
"function",
"set_definition_sharing",
"(",
"$",
"definition",
",",
"$",
"sharingoption",
",",
"$",
"userinputsharingkey",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"definition",
",",
"$",
"this",
"->",
"configdefinitions",
... | Sets the selected sharing options and key for a definition.
@param string $definition The name of the definition to set for.
@param int $sharingoption The sharing option to set.
@param string|null $userinputsharingkey The user input key or null.
@throws coding_exception | [
"Sets",
"the",
"selected",
"sharing",
"options",
"and",
"key",
"for",
"a",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L649-L661 |
216,378 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_store_instance_summaries | public static function get_store_instance_summaries() {
$return = array();
$default = array();
$instance = cache_config::instance();
$stores = $instance->get_all_stores();
$locks = $instance->get_locks();
foreach ($stores as $name => $details) {
$class = $deta... | php | public static function get_store_instance_summaries() {
$return = array();
$default = array();
$instance = cache_config::instance();
$stores = $instance->get_all_stores();
$locks = $instance->get_locks();
foreach ($stores as $name => $details) {
$class = $deta... | [
"public",
"static",
"function",
"get_store_instance_summaries",
"(",
")",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"$",
"default",
"=",
"array",
"(",
")",
";",
"$",
"instance",
"=",
"cache_config",
"::",
"instance",
"(",
")",
";",
"$",
"stores",
... | Returns an array containing all of the information about stores a renderer needs.
@return array | [
"Returns",
"an",
"array",
"containing",
"all",
"of",
"the",
"information",
"about",
"stores",
"a",
"renderer",
"needs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L679-L737 |
216,379 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_store_plugin_summaries | public static function get_store_plugin_summaries() {
$return = array();
$plugins = core_component::get_plugin_list_with_file('cachestore', 'lib.php', true);
foreach ($plugins as $plugin => $path) {
$class = 'cachestore_'.$plugin;
$return[$plugin] = array(
... | php | public static function get_store_plugin_summaries() {
$return = array();
$plugins = core_component::get_plugin_list_with_file('cachestore', 'lib.php', true);
foreach ($plugins as $plugin => $path) {
$class = 'cachestore_'.$plugin;
$return[$plugin] = array(
... | [
"public",
"static",
"function",
"get_store_plugin_summaries",
"(",
")",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"$",
"plugins",
"=",
"core_component",
"::",
"get_plugin_list_with_file",
"(",
"'cachestore'",
",",
"'lib.php'",
",",
"true",
")",
";",
"fo... | Returns an array of information about plugins, everything a renderer needs.
@return array | [
"Returns",
"an",
"array",
"of",
"information",
"about",
"plugins",
"everything",
"a",
"renderer",
"needs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L743-L778 |
216,380 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_definition_summaries | public static function get_definition_summaries() {
$factory = cache_factory::instance();
$config = $factory->create_config_instance();
$storenames = array();
foreach ($config->get_all_stores() as $key => $store) {
if (!empty($store['default'])) {
$storenames[... | php | public static function get_definition_summaries() {
$factory = cache_factory::instance();
$config = $factory->create_config_instance();
$storenames = array();
foreach ($config->get_all_stores() as $key => $store) {
if (!empty($store['default'])) {
$storenames[... | [
"public",
"static",
"function",
"get_definition_summaries",
"(",
")",
"{",
"$",
"factory",
"=",
"cache_factory",
"::",
"instance",
"(",
")",
";",
"$",
"config",
"=",
"$",
"factory",
"->",
"create_config_instance",
"(",
")",
";",
"$",
"storenames",
"=",
"arra... | Returns an array about the definitions. All the information a renderer needs.
@return array | [
"Returns",
"an",
"array",
"about",
"the",
"definitions",
".",
"All",
"the",
"information",
"a",
"renderer",
"needs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L784-L819 |
216,381 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_definition_sharing_options | public static function get_definition_sharing_options($sharingoption, $isselectedoptions = true) {
$options = array();
$prefix = ($isselectedoptions) ? 'sharingselected' : 'sharing';
if ($sharingoption & cache_definition::SHARING_ALL) {
$options[cache_definition::SHARING_ALL] = new l... | php | public static function get_definition_sharing_options($sharingoption, $isselectedoptions = true) {
$options = array();
$prefix = ($isselectedoptions) ? 'sharingselected' : 'sharing';
if ($sharingoption & cache_definition::SHARING_ALL) {
$options[cache_definition::SHARING_ALL] = new l... | [
"public",
"static",
"function",
"get_definition_sharing_options",
"(",
"$",
"sharingoption",
",",
"$",
"isselectedoptions",
"=",
"true",
")",
"{",
"$",
"options",
"=",
"array",
"(",
")",
";",
"$",
"prefix",
"=",
"(",
"$",
"isselectedoptions",
")",
"?",
"'sha... | Given a sharing option hash this function returns an array of strings that can be used to describe it.
@param int $sharingoption The sharing option hash to get strings for.
@param bool $isselectedoptions Set to true if the strings will be used to view the selected options.
@return array An array of lang_string's. | [
"Given",
"a",
"sharing",
"option",
"hash",
"this",
"function",
"returns",
"an",
"array",
"of",
"strings",
"that",
"can",
"be",
"used",
"to",
"describe",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L828-L844 |
216,382 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_definition_actions | public static function get_definition_actions(context $context, array $definition) {
if (has_capability('moodle/site:config', $context)) {
$actions = array();
// Edit mappings.
$actions[] = array(
'text' => get_string('editmappings', 'cache'),
... | php | public static function get_definition_actions(context $context, array $definition) {
if (has_capability('moodle/site:config', $context)) {
$actions = array();
// Edit mappings.
$actions[] = array(
'text' => get_string('editmappings', 'cache'),
... | [
"public",
"static",
"function",
"get_definition_actions",
"(",
"context",
"$",
"context",
",",
"array",
"$",
"definition",
")",
"{",
"if",
"(",
"has_capability",
"(",
"'moodle/site:config'",
",",
"$",
"context",
")",
")",
"{",
"$",
"actions",
"=",
"array",
"... | Returns all of the actions that can be performed on a definition.
@param context $context
@return array | [
"Returns",
"all",
"of",
"the",
"actions",
"that",
"can",
"be",
"performed",
"on",
"a",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L851-L874 |
216,383 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_store_instance_actions | public static function get_store_instance_actions($name, array $storedetails) {
$actions = array();
if (has_capability('moodle/site:config', context_system::instance())) {
$baseurl = new moodle_url('/cache/admin.php', array('store' => $name, 'sesskey' => sesskey()));
if (empty($s... | php | public static function get_store_instance_actions($name, array $storedetails) {
$actions = array();
if (has_capability('moodle/site:config', context_system::instance())) {
$baseurl = new moodle_url('/cache/admin.php', array('store' => $name, 'sesskey' => sesskey()));
if (empty($s... | [
"public",
"static",
"function",
"get_store_instance_actions",
"(",
"$",
"name",
",",
"array",
"$",
"storedetails",
")",
"{",
"$",
"actions",
"=",
"array",
"(",
")",
";",
"if",
"(",
"has_capability",
"(",
"'moodle/site:config'",
",",
"context_system",
"::",
"in... | Returns all of the actions that can be performed on a store.
@param string $name The name of the store
@param array $storedetails
@return array | [
"Returns",
"all",
"of",
"the",
"actions",
"that",
"can",
"be",
"performed",
"on",
"a",
"store",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L883-L903 |
216,384 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_store_plugin_actions | public static function get_store_plugin_actions($name, array $plugindetails) {
$actions = array();
if (has_capability('moodle/site:config', context_system::instance())) {
if (!empty($plugindetails['canaddinstance'])) {
$url = new moodle_url('/cache/admin.php', array('action' ... | php | public static function get_store_plugin_actions($name, array $plugindetails) {
$actions = array();
if (has_capability('moodle/site:config', context_system::instance())) {
if (!empty($plugindetails['canaddinstance'])) {
$url = new moodle_url('/cache/admin.php', array('action' ... | [
"public",
"static",
"function",
"get_store_plugin_actions",
"(",
"$",
"name",
",",
"array",
"$",
"plugindetails",
")",
"{",
"$",
"actions",
"=",
"array",
"(",
")",
";",
"if",
"(",
"has_capability",
"(",
"'moodle/site:config'",
",",
"context_system",
"::",
"ins... | Returns all of the actions that can be performed on a plugin.
@param string $name The name of the plugin
@param array $plugindetails
@return array | [
"Returns",
"all",
"of",
"the",
"actions",
"that",
"can",
"be",
"performed",
"on",
"a",
"plugin",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L913-L925 |
216,385 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_add_store_form | public static function get_add_store_form($plugin) {
global $CFG; // Needed for includes.
$plugins = core_component::get_plugin_list('cachestore');
if (!array_key_exists($plugin, $plugins)) {
throw new coding_exception('Invalid cache plugin used when trying to create an edit form.');... | php | public static function get_add_store_form($plugin) {
global $CFG; // Needed for includes.
$plugins = core_component::get_plugin_list('cachestore');
if (!array_key_exists($plugin, $plugins)) {
throw new coding_exception('Invalid cache plugin used when trying to create an edit form.');... | [
"public",
"static",
"function",
"get_add_store_form",
"(",
"$",
"plugin",
")",
"{",
"global",
"$",
"CFG",
";",
"// Needed for includes.",
"$",
"plugins",
"=",
"core_component",
"::",
"get_plugin_list",
"(",
"'cachestore'",
")",
";",
"if",
"(",
"!",
"array_key_ex... | Returns a form that can be used to add a store instance.
@param string $plugin The plugin to add an instance of
@return cachestore_addinstance_form
@throws coding_exception | [
"Returns",
"a",
"form",
"that",
"can",
"be",
"used",
"to",
"add",
"a",
"store",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L934-L956 |
216,386 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_edit_store_form | public static function get_edit_store_form($plugin, $store) {
global $CFG; // Needed for includes.
$plugins = core_component::get_plugin_list('cachestore');
if (!array_key_exists($plugin, $plugins)) {
throw new coding_exception('Invalid cache plugin used when trying to create an edit... | php | public static function get_edit_store_form($plugin, $store) {
global $CFG; // Needed for includes.
$plugins = core_component::get_plugin_list('cachestore');
if (!array_key_exists($plugin, $plugins)) {
throw new coding_exception('Invalid cache plugin used when trying to create an edit... | [
"public",
"static",
"function",
"get_edit_store_form",
"(",
"$",
"plugin",
",",
"$",
"store",
")",
"{",
"global",
"$",
"CFG",
";",
"// Needed for includes.",
"$",
"plugins",
"=",
"core_component",
"::",
"get_plugin_list",
"(",
"'cachestore'",
")",
";",
"if",
"... | Returns a form that can be used to edit a store instance.
@param string $plugin
@param string $store
@return cachestore_addinstance_form
@throws coding_exception | [
"Returns",
"a",
"form",
"that",
"can",
"be",
"used",
"to",
"edit",
"a",
"store",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L966-L1005 |
216,387 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_possible_locks_for_stores | protected static function get_possible_locks_for_stores($plugindir, $plugin) {
global $CFG; // Needed for includes.
$supportsnativelocking = false;
if (file_exists($plugindir.'/lib.php')) {
require_once($plugindir.'/lib.php');
$pluginclass = 'cachestore_'.$plugin;
... | php | protected static function get_possible_locks_for_stores($plugindir, $plugin) {
global $CFG; // Needed for includes.
$supportsnativelocking = false;
if (file_exists($plugindir.'/lib.php')) {
require_once($plugindir.'/lib.php');
$pluginclass = 'cachestore_'.$plugin;
... | [
"protected",
"static",
"function",
"get_possible_locks_for_stores",
"(",
"$",
"plugindir",
",",
"$",
"plugin",
")",
"{",
"global",
"$",
"CFG",
";",
"// Needed for includes.",
"$",
"supportsnativelocking",
"=",
"false",
";",
"if",
"(",
"file_exists",
"(",
"$",
"p... | Returns an array of suitable lock instances for use with this plugin, or false if the plugin handles locking itself.
@param string $plugindir
@param string $plugin
@return array|false | [
"Returns",
"an",
"array",
"of",
"suitable",
"lock",
"instances",
"for",
"use",
"with",
"this",
"plugin",
"or",
"false",
"if",
"the",
"plugin",
"handles",
"locking",
"itself",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L1014-L1041 |
216,388 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_definition_store_options | public static function get_definition_store_options($component, $area) {
$factory = cache_factory::instance();
$definition = $factory->create_definition($component, $area);
$config = cache_config::instance();
$currentstores = $config->get_stores_for_definition($definition);
$poss... | php | public static function get_definition_store_options($component, $area) {
$factory = cache_factory::instance();
$definition = $factory->create_definition($component, $area);
$config = cache_config::instance();
$currentstores = $config->get_stores_for_definition($definition);
$poss... | [
"public",
"static",
"function",
"get_definition_store_options",
"(",
"$",
"component",
",",
"$",
"area",
")",
"{",
"$",
"factory",
"=",
"cache_factory",
"::",
"instance",
"(",
")",
";",
"$",
"definition",
"=",
"$",
"factory",
"->",
"create_definition",
"(",
... | Get an array of stores that are suitable to be used for a given definition.
@param string $component
@param string $area
@return array Array containing 3 elements
1. An array of currently used stores
2. An array of suitable stores
3. An array of default stores | [
"Get",
"an",
"array",
"of",
"stores",
"that",
"are",
"suitable",
"to",
"be",
"used",
"for",
"a",
"given",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L1078-L1099 |
216,389 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_default_mode_stores | public static function get_default_mode_stores() {
global $OUTPUT;
$instance = cache_config::instance();
$adequatestores = cache_helper::get_stores_suitable_for_mode_default();
$icon = new pix_icon('i/warning', new lang_string('inadequatestoreformapping', 'cache'));
$storenames =... | php | public static function get_default_mode_stores() {
global $OUTPUT;
$instance = cache_config::instance();
$adequatestores = cache_helper::get_stores_suitable_for_mode_default();
$icon = new pix_icon('i/warning', new lang_string('inadequatestoreformapping', 'cache'));
$storenames =... | [
"public",
"static",
"function",
"get_default_mode_stores",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"instance",
"=",
"cache_config",
"::",
"instance",
"(",
")",
";",
"$",
"adequatestores",
"=",
"cache_helper",
"::",
"get_stores_suitable_for_mode_default",
... | Get the default stores for all modes.
@return array An array containing sub-arrays, one for each mode. | [
"Get",
"the",
"default",
"stores",
"for",
"all",
"modes",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L1106-L1138 |
216,390 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_lock_summaries | public static function get_lock_summaries() {
$locks = array();
$instance = cache_config::instance();
$stores = $instance->get_all_stores();
foreach ($instance->get_locks() as $lock) {
$default = !empty($lock['default']);
if ($default) {
$name = ne... | php | public static function get_lock_summaries() {
$locks = array();
$instance = cache_config::instance();
$stores = $instance->get_all_stores();
foreach ($instance->get_locks() as $lock) {
$default = !empty($lock['default']);
if ($default) {
$name = ne... | [
"public",
"static",
"function",
"get_lock_summaries",
"(",
")",
"{",
"$",
"locks",
"=",
"array",
"(",
")",
";",
"$",
"instance",
"=",
"cache_config",
"::",
"instance",
"(",
")",
";",
"$",
"stores",
"=",
"$",
"instance",
"->",
"get_all_stores",
"(",
")",
... | Returns an array summarising the locks available in the system | [
"Returns",
"an",
"array",
"summarising",
"the",
"locks",
"available",
"in",
"the",
"system"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L1143-L1169 |
216,391 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_addable_lock_options | public static function get_addable_lock_options() {
$plugins = core_component::get_plugin_list_with_class('cachelock', '', 'lib.php');
$options = array();
$len = strlen('cachelock_');
foreach ($plugins as $plugin => $class) {
$method = "$class::can_add_instance";
... | php | public static function get_addable_lock_options() {
$plugins = core_component::get_plugin_list_with_class('cachelock', '', 'lib.php');
$options = array();
$len = strlen('cachelock_');
foreach ($plugins as $plugin => $class) {
$method = "$class::can_add_instance";
... | [
"public",
"static",
"function",
"get_addable_lock_options",
"(",
")",
"{",
"$",
"plugins",
"=",
"core_component",
"::",
"get_plugin_list_with_class",
"(",
"'cachelock'",
",",
"''",
",",
"'lib.php'",
")",
";",
"$",
"options",
"=",
"array",
"(",
")",
";",
"$",
... | Returns an array of lock plugins for which we can add an instance.
Suitable for use within an mform select element.
@return array | [
"Returns",
"an",
"array",
"of",
"lock",
"plugins",
"for",
"which",
"we",
"can",
"add",
"an",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L1178-L1191 |
216,392 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_add_lock_form | public static function get_add_lock_form($plugin, array $lockplugin = null) {
global $CFG; // Needed for includes.
$plugins = core_component::get_plugin_list('cachelock');
if (!array_key_exists($plugin, $plugins)) {
throw new coding_exception('Invalid cache lock plugin requested when... | php | public static function get_add_lock_form($plugin, array $lockplugin = null) {
global $CFG; // Needed for includes.
$plugins = core_component::get_plugin_list('cachelock');
if (!array_key_exists($plugin, $plugins)) {
throw new coding_exception('Invalid cache lock plugin requested when... | [
"public",
"static",
"function",
"get_add_lock_form",
"(",
"$",
"plugin",
",",
"array",
"$",
"lockplugin",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"// Needed for includes.",
"$",
"plugins",
"=",
"core_component",
"::",
"get_plugin_list",
"(",
"'cacheloc... | Gets the form to use when adding a lock instance.
@param string $plugin
@param array $lockplugin
@return cache_lock_form
@throws coding_exception | [
"Gets",
"the",
"form",
"to",
"use",
"when",
"adding",
"a",
"lock",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L1201-L1219 |
216,393 | moodle/moodle | cache/locallib.php | cache_administration_helper.get_lock_configuration_from_data | public static function get_lock_configuration_from_data($plugin, $data) {
global $CFG;
$file = $CFG->dirroot.'/cache/locks/'.$plugin.'/lib.php';
if (!file_exists($file)) {
throw new coding_exception('Invalid cache plugin provided. '.$file);
}
require_once($file);
... | php | public static function get_lock_configuration_from_data($plugin, $data) {
global $CFG;
$file = $CFG->dirroot.'/cache/locks/'.$plugin.'/lib.php';
if (!file_exists($file)) {
throw new coding_exception('Invalid cache plugin provided. '.$file);
}
require_once($file);
... | [
"public",
"static",
"function",
"get_lock_configuration_from_data",
"(",
"$",
"plugin",
",",
"$",
"data",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"file",
"=",
"$",
"CFG",
"->",
"dirroot",
".",
"'/cache/locks/'",
".",
"$",
"plugin",
".",
"'/lib.php'",
";"... | Gets configuration data from a new lock instance form.
@param string $plugin
@param stdClass $data
@return array
@throws coding_exception | [
"Gets",
"configuration",
"data",
"from",
"a",
"new",
"lock",
"instance",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/locallib.php#L1229-L1244 |
216,394 | moodle/moodle | lib/pear/HTML/QuickForm/advcheckbox.php | HTML_QuickForm_advcheckbox.getOnclickJs | function getOnclickJs($elementName)
{
$onclickJs = 'if (this.checked) { this.form[\''.$elementName.'\'].value=\''.addcslashes($this->_values[1], '\'').'\'; }';
$onclickJs .= 'else { this.form[\''.$elementName.'\'].value=\''.addcslashes($this->_values[0], '\'').'\'; }';
return $onclickJs;
... | php | function getOnclickJs($elementName)
{
$onclickJs = 'if (this.checked) { this.form[\''.$elementName.'\'].value=\''.addcslashes($this->_values[1], '\'').'\'; }';
$onclickJs .= 'else { this.form[\''.$elementName.'\'].value=\''.addcslashes($this->_values[0], '\'').'\'; }';
return $onclickJs;
... | [
"function",
"getOnclickJs",
"(",
"$",
"elementName",
")",
"{",
"$",
"onclickJs",
"=",
"'if (this.checked) { this.form[\\''",
".",
"$",
"elementName",
".",
"'\\'].value=\\''",
".",
"addcslashes",
"(",
"$",
"this",
"->",
"_values",
"[",
"1",
"]",
",",
"'\\''",
"... | Create the javascript for the onclick event which will
set the value of the hidden field
@param string $elementName The element name
@access public
@return string
@deprecated Deprecated since 3.2.6, this element no longer uses any javascript | [
"Create",
"the",
"javascript",
"for",
"the",
"onclick",
"event",
"which",
"will",
"set",
"the",
"value",
"of",
"the",
"hidden",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/advcheckbox.php#L127-L132 |
216,395 | moodle/moodle | lib/pear/HTML/QuickForm/advcheckbox.php | HTML_QuickForm_advcheckbox.setValues | function setValues($values)
{
if (empty($values)) {
// give it default checkbox behavior
$this->_values = array('', 1);
} elseif (is_scalar($values)) {
// if it's string, then assume the value to
// be passed is for when the element is checked
... | php | function setValues($values)
{
if (empty($values)) {
// give it default checkbox behavior
$this->_values = array('', 1);
} elseif (is_scalar($values)) {
// if it's string, then assume the value to
// be passed is for when the element is checked
... | [
"function",
"setValues",
"(",
"$",
"values",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"values",
")",
")",
"{",
"// give it default checkbox behavior",
"$",
"this",
"->",
"_values",
"=",
"array",
"(",
"''",
",",
"1",
")",
";",
"}",
"elseif",
"(",
"is_sca... | Sets the values used by the hidden element
@param mixed $values The values, either a string or an array
@access public
@return void | [
"Sets",
"the",
"values",
"used",
"by",
"the",
"hidden",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/advcheckbox.php#L145-L159 |
216,396 | moodle/moodle | lib/pear/HTML/QuickForm/advcheckbox.php | HTML_QuickForm_advcheckbox.setValue | function setValue($value)
{
$this->setChecked(isset($this->_values[1]) && $value == $this->_values[1]);
$this->_currentValue = $value;
} | php | function setValue($value)
{
$this->setChecked(isset($this->_values[1]) && $value == $this->_values[1]);
$this->_currentValue = $value;
} | [
"function",
"setValue",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"setChecked",
"(",
"isset",
"(",
"$",
"this",
"->",
"_values",
"[",
"1",
"]",
")",
"&&",
"$",
"value",
"==",
"$",
"this",
"->",
"_values",
"[",
"1",
"]",
")",
";",
"$",
"th... | Sets the element's value
@param mixed Element's value
@access public | [
"Sets",
"the",
"element",
"s",
"value"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/advcheckbox.php#L170-L174 |
216,397 | moodle/moodle | lib/pear/HTML/QuickForm/advcheckbox.php | HTML_QuickForm_advcheckbox.toHtml | function toHtml()
{
if ($this->_flagFrozen) {
return parent::toHtml();
} else {
return '<input' . $this->_getAttrString(array(
'type' => 'hidden',
'name' => $this->getName(),
'value' => $this->_values[0... | php | function toHtml()
{
if ($this->_flagFrozen) {
return parent::toHtml();
} else {
return '<input' . $this->_getAttrString(array(
'type' => 'hidden',
'name' => $this->getName(),
'value' => $this->_values[0... | [
"function",
"toHtml",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_flagFrozen",
")",
"{",
"return",
"parent",
"::",
"toHtml",
"(",
")",
";",
"}",
"else",
"{",
"return",
"'<input'",
".",
"$",
"this",
"->",
"_getAttrString",
"(",
"array",
"(",
"'type... | Returns the checkbox element in HTML
and the additional hidden element in HTML
@access public
@return string | [
"Returns",
"the",
"checkbox",
"element",
"in",
"HTML",
"and",
"the",
"additional",
"hidden",
"element",
"in",
"HTML"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/advcheckbox.php#L204-L216 |
216,398 | moodle/moodle | lib/pear/HTML/QuickForm/advcheckbox.php | HTML_QuickForm_advcheckbox.exportValue | function exportValue(&$submitValues, $assoc = false)
{
$value = $this->_findValue($submitValues);
if (null === $value) {
$value = $this->getValue();
} elseif (is_array($this->_values) && ($value != $this->_values[0]) && ($value != $this->_values[1])) {
$value = null;
... | php | function exportValue(&$submitValues, $assoc = false)
{
$value = $this->_findValue($submitValues);
if (null === $value) {
$value = $this->getValue();
} elseif (is_array($this->_values) && ($value != $this->_values[0]) && ($value != $this->_values[1])) {
$value = null;
... | [
"function",
"exportValue",
"(",
"&",
"$",
"submitValues",
",",
"$",
"assoc",
"=",
"false",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"_findValue",
"(",
"$",
"submitValues",
")",
";",
"if",
"(",
"null",
"===",
"$",
"value",
")",
"{",
"$",
"val... | This element has a value even if it is not checked, thus we override
checkbox's behaviour here | [
"This",
"element",
"has",
"a",
"value",
"even",
"if",
"it",
"is",
"not",
"checked",
"thus",
"we",
"override",
"checkbox",
"s",
"behaviour",
"here"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/advcheckbox.php#L274-L283 |
216,399 | moodle/moodle | mod/quiz/classes/output/edit_renderer.php | edit_renderer.edit_page | public function edit_page(\quiz $quizobj, structure $structure,
\question_edit_contexts $contexts, \moodle_url $pageurl, array $pagevars) {
$output = '';
// Page title.
$output .= $this->heading_with_help(get_string('editingquizx', 'quiz',
format_string($quizobj->get... | php | public function edit_page(\quiz $quizobj, structure $structure,
\question_edit_contexts $contexts, \moodle_url $pageurl, array $pagevars) {
$output = '';
// Page title.
$output .= $this->heading_with_help(get_string('editingquizx', 'quiz',
format_string($quizobj->get... | [
"public",
"function",
"edit_page",
"(",
"\\",
"quiz",
"$",
"quizobj",
",",
"structure",
"$",
"structure",
",",
"\\",
"question_edit_contexts",
"$",
"contexts",
",",
"\\",
"moodle_url",
"$",
"pageurl",
",",
"array",
"$",
"pagevars",
")",
"{",
"$",
"output",
... | Render the edit page
@param \quiz $quizobj object containing all the quiz settings information.
@param structure $structure object containing the structure of the quiz.
@param \question_edit_contexts $contexts the relevant question bank contexts.
@param \moodle_url $pageurl the canonical URL of this page.
@param array... | [
"Render",
"the",
"edit",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/classes/output/edit_renderer.php#L51-L118 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.