thank for reply
is it correctely for use $DB and $CFG
my folder moodle config.php
/var/www/mdl/config.php
my folder my script LDAP is
/var/www/mdl/LDAP/my_script.php
I try this
<?php
require_once('/var/www/mdl/config.php');
echo "<h1>TO USE DB</h1>";
var_dump($DB);
echo "<h1> TO USE CFG</h1>";
var_dump($CFG);
?>
my script is ok , i have this display
TO USE DB
object(mysqli_native_moodle_database)#5 (27) { ["mysqli":protected]=> object(mysqli)#6 (18) { ["affected_rows"]=> int(1) ["client_info"]=> string(6) "5.5.24" ["client_version"]=> int(50524) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> int(0) ["error"]=> string(0) "" ["field_count"]=> int(9) ["host_info"]=> string(25) "Localhost via UNIX socket" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(27) "5.5.24-0ubuntu0.12.04.1-log" ["server_version"]=> int(50524) ["stat"]=> string(140) "Uptime: 7245 Threads: 1 Questions: 112959 Slow queries: 0 Opens: 3386 Flush tables: 1 Open tables: 400 Queries per second avg: 15.591" ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(616) ["warning_count"]=> int(0) } ["transactions_supported":"mysqli_native_moodle_database":private]=> NULL ["database_manager":protected]=> NULL ["temptables":protected]=> object(mysqli_native_moodle_temptables)#7 (3) { ["mdb":protected]=> *RECURSION* ["prefix":protected]=> string(5) "prod_" ["temptables":protected]=> array(0) { } } ["tables":protected]=> NULL ["dbhost":protected]=> string(9) "localhost" ["dbuser":protected]=> string(4) "root" ["dbpass":protected]=> string(4) "test" ["dbname":protected]=> string(11) "moodle_prod" ["prefix":protected]=> string(5) "prod_" ["dboptions":protected]=> array(2) { ["dbpersist"]=> int(0) ["dbsocket"]=> int(0) } ["external":protected]=> bool(false) ["reads":protected]=> int(8) ["writes":protected]=> int(0) ["debug":protected]=> int(0) ["last_sql":protected]=> NULL ["last_params":protected]=> NULL ["last_type":protected]=> int(1) ["last_extrainfo":protected]=> NULL ["last_time":protected]=> float(1372169887.6973) ["loggingquery":"moodle_database":private]=> bool(false) ["used_for_db_sessions":protected]=> bool(true) ["transactions":"moodle_database":private]=> array(0) { } ["force_rollback":"moodle_database":private]=> bool(false) ["settingshash":"moodle_database":private]=> NULL ["fix_sql_params_i":"moodle_database":private]=> NULL ["inorequaluniqueindex":"moodle_database":private]=> int(1) }
TO USE CFG
object(stdClass)#1 (526) { ["dbtype"]=> string(6) "mysqli" ["dblibrary"]=> string(6) "native" ["dbhost"]=> string(9) "localhost" ["dbname"]=> string(11) "moodle_prod" ["dbuser"]=> string(4) "root" ["dbpass"]=> string(4) "test" ["prefix"]=> string(5) "prod_" ["dboptions"]=> array(2) { ["dbpersist"]=> int(0) ["dbsocket"]=> int(0) } ["wwwroot"]=> string(21) "http://localhost/prod" ["dataroot"]=> string(15) "/var/moodledata" ["admin"]=> string(5) "admin" ["directorypermissions"]=> int(511) ["passwordsaltmain"]=> string(27) "SNd6T=;OTf#-h^/G=k
And now , is have a simple method for call DB and CFG ?,
I think a autoloder, is moodle2 have a autoloader for caller simple ?
Or my method is simple correctely for the next programming with moodle2.