Example #1
0
function fix_mysql_root_password($server)
{
    global $gbl, $sgbl, $login, $ghtml;
    $pass = $login->password;
    $pass = fix_nname_to_be_variable($pass);
    $pass = substr($pass, 3, 11);
    $dbadmin = new Dbadmin(null, $server, "mysql___{$server}");
    $dbadmin->get();
    if ($dbadmin->dbaction === 'add') {
        $dbadmin->syncserver = $server;
        $dbadmin->ttype = 'mysql';
        $dbadmin->dbtype = 'mysql';
        $dbadmin->dbadmin_name = 'root';
        $dbadmin->parent_clname = createParentName("pserver", $server);
        $dbadmin->write();
        $dbadmin->get();
        $dbadmin->dbaction = 'clean';
    }
    if ($dbadmin->dbpassword) {
        dprint("Mysql Password is not null\n");
        return;
    }
    $dbadmin->dbpassword = $pass;
    $dbadmin->setUpdateSubaction('update');
    try {
        $dbadmin->was();
    } catch (exception $e) {
    }
}