<commit_before><?php

require 'MoodleRest.php';

$config = require 'config.php';

if(empty($config["url"]) or empty($config["token"])){
    echo "Por favor, configura las settings primero.";
    exit(-1);
}

$moodle = new MoodleRest($config["url"], $config["token"]);
$moodle->type("rest");

$res = $moodle->query("core_webservice_get_site_info");

var_dump($res);

?><commit_msg>Script para comprobar funciones.<commit_after><?php

require 'MoodleRest.php';

$config = require 'config.php';

if(empty($config["url"]) or empty($config["token"])){
    echo "Por favor, configura las settings primero.";
    exit(-1);
}

$moodle = new MoodleRest($config["url"], $config["token"]);
$moodle->type("rest");

$res = $moodle->query("core_webservice_get_site_info");

if(isset($res->exception) and $res->exception == "webservice_access_exception"){
	echo "No tienes permiso para cargar esta información.\n"
		."Agrega la siguiente función: core_webservice_get_site_info\n\n";
	exit(-1);
}

$required = [
	"core_user_get_users_by_field",
	"core_user_create_users",
	"core_user_get_users_by_field",
	"enrol_manual_enrol_users",
	"core_course_create_categories",
	"core_course_create_courses",
	"core_course_get_contents",
	"core_update_inplace_editable",
	"core_group_create_groups",
	"core_group_add_group_members",
];

$funcs = array();
foreach($res->functions as $f){ $funcs[] = $r->name; }

foreach($required as $r){
	$str = "- $r :";
	echo str_pad($str, 40, " ", STR_PAD_RIGHT);
	echo (in_array($r, $funcs) ? "OK" : "NO");
	echo "\n";
}

?>
{'fraction_non_alphanumeric': 0.18827361563517916, 'fraction_numerical': 0.003257328990228013, 'mean_word_length': 6.492682926829269, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2708413', 'n_tokens_mistral': 592, 'n_tokens_neox': 583, 'n_words': 104}