Roxen.git / server / config_interface / dbs / restore_db.pike

version» Context lines:

Roxen.git/server/config_interface/dbs/restore_db.pike:19:    if( !sizeof( bks ) )    {    res += _(79,"<p>No backups are currently available. To make a backup of a "    "database, focus on it in the Databases tab, and click on the "    "make backup button. Please note that you can only make backups "    "of databases managed by Roxen.</p>");    }       if( !id->variables->db )    { -  res += "<table width='100%'>\n" +  res += "<style type='text/css'>\n" +  ".dbrestore { border-spacing: 0; }\n" +  ".dbrestore td, .dbrestore th { padding: 2px 4px 2px 0; }\n" +  ".dbrestore td:last-child, .dbrestore th:last-child { padding-right: 0; }\n" +  ".dbrestore th { border-bottom: 1px solid black; }\n" +  ".dbrestore .flag { font-size: smaller; }\n" +  ".dbrestore .date { font-size: smaller; white-space: nowrap; }\n" +  "</style>\n" +  "<table width='100%' class='dbrestore'>\n"    "<tr><th colspan='2' align='left'>" + _(463, "Database") +    "</th><th align='left'>"+_(405,"Directory")+ -  "</th><th align='left'>"+_(459,"Date")+"</th></tr>\n"; +  "</th><th>&nbsp;</th><th align='left'>"+_(459,"Date")+"</th></tr>\n";    foreach( sort( indices( bks ) ), string bk )    { - #ifndef YES_I_KNOW_WHAT_I_AM_DOING +  string extra = "";    // Hide the Roxen-internal databases. -  if ((<"roxen", "mysql">)[bk]) continue; +  if ((<"roxen", "mysql">)[bk]) { + #ifndef YES_I_KNOW_WHAT_I_AM_DOING +  continue; + #else +  extra = " " + _(1143, "(Roxen-internal database)");   #endif -  +  }    mapping done = ([ ]); -  res += "<tr><td colspan='4'><gtext scale='0.6'>" + -  Roxen.html_encode_string(bk) + "</gtext></td></tr>\n"; +  res += "<tr><td colspan='4'>" + +  Roxen.html_encode_string(bk + extra) + +  "</td></tr>\n";       foreach( bks[bk], mapping b )    {    if( !done[b->directory] )    {    done[b->directory] = ({ -  b->whn, b->directory, +  (int)b->whn, b->directory,    ({ b->tbl }),    "<a href='restore_db.pike?db="+Roxen.html_encode_string(bk) -  +"&dir="+Roxen.html_encode_string( b->directory )+"'>"+ +  +"&amp;dir="+Roxen.html_encode_string( b->directory )+ +  "&amp;&usr.set-wiz-id;'>"+    "<gbutton>"+_(460,"Restore")+"</gbutton></a> "    "<a href='restore_db.pike?db="+Roxen.html_encode_string(bk)+ -  "&dir="+Roxen.html_encode_string( b->directory )+"&drop=1'>"+ +  "&amp;dir="+Roxen.html_encode_string( b->directory )+ +  "&amp;drop=1&amp;&usr.set-wiz-id;'>"+    "<gbutton>"+_(227,"Delete")+"</gbutton></a>"    });    }    else    done[b->directory][2] += ({ b->tbl });    }    -  foreach( sort( values( done ) ), array r ) +  foreach(sort(indices(done)), string dir)    { -  +  [int when, string d, array(string) tables, string buttons] = done[dir];    res += "<tr>";    res += " <td>&nbsp;</td>\n"; -  res += " <td>"+r[3]+"</td>\n"; -  res += " <td>"+r[1]+"</td>\n"; -  res += " <td>"+isodate((int)r[0])+"</td>\n"; +  res += " <td>" + buttons + "</td>\n"; +  res += " <td><tt>" + d + "</tt></td>"; +  if (has_value(tables, "")) { +  // In progress marker. +  res += "<td class='flag'><em>" + _(1144, "Incomplete") + "<em></td>"; +  } else { +  res += "<td>&nbsp;</td>\n"; +  } +  res += " <td class='date'>" + isodate(when) + "</td>\n";    res += "</tr>\n";    }    }    res += "</table>\n";    }    else    {    if( id->variables->drop )    {    DBManager.delete_backup( id->variables->db, id->variables->dir );
Roxen.git/server/config_interface/dbs/restore_db.pike:86:    DBManager.restore( id->variables->db,    id->variables->dir,    id->variables->todb,    tables );    return Roxen.http_redirect("/dbs/backups.html", id );    }    else    {    array possible = ({});    foreach( bks[ id->variables->db ], mapping bk ) -  if( bk->directory == id->variables->dir ) +  if( bk->directory == id->variables->dir && sizeof(bk->tbl) )    possible += ({ bk->tbl });       res += "<gtext scale=0.5>"+    _(461,"Restore the following tables from the backup")+    "</gtext> <br />"    "<input type=hidden name=db value='&form.db:http;' />"    "<input type=hidden name=dir value='&form.dir:http;' />";       res += "<blockquote><table>";    int n;