Roxen.git / server / config_interface / actions / change_version.pike

version» Context lines:

Roxen.git/server/config_interface/actions/change_version.pike:7:      LocaleString name = _(46,"Change Roxen version")+"...";   LocaleString doc = _(42,"If you have more than one Roxen version installed\n"    "in the same location, you can use this action to\n"    "change the currently running version.");      class Server(string dir,    string version,    string version_h )   { -  int cannot_change_back; -  string file( string fn ) -  { -  return Stdio.read_bytes( "../"+dir+"/"+fn ); -  } -  -  Calendar.Day get_date_from_cvsid( string data ) -  { -  string q; -  if (sscanf( data, "%*s$Id: %*s,v %s\n", q ) < 3) -  return 0; -  return Calendar.dwim_day( (q/" ")[1] ); -  } -  +     Calendar.Day reldate()    { -  return 0; -  -  Calendar.Day d2, d = get_date_from_cvsid( version_h ); -  if( !d ) -  { -  d=get_date_from_cvsid( file( "base_server/roxen.pike" )||"" ); -  -  foreach( ({"base_server/roxen.pike", -  "base_server/configuration.pike", -  "base_server/roxenloader.pike", -  "start", -  "base_server/module.pike" }), -  string f ) -  { -  string q = file( f )||""; -  if( f == "start" ) -  if( search( q, "100)" )==-1 ) -  cannot_change_back = 1; -  if( (d2 = get_date_from_cvsid(q )) && d2 > d ) -  d = d2; +  Stdio.Stat st = file_stat("../" + dir + "/VERSION.DIST"); +  return st && Calendar.Day("unix", st->mtime);    } -  } -  return d; -  } +        protected string _sprintf()    {    return sprintf("Server(%O,%O,%O)", dir,version, reldate() );    }   }      array available_versions()   {    array res = ({});
Roxen.git/server/config_interface/actions/change_version.pike:96:    if( t->how_many( Calendar.Day() ) == 0 ) return "-";    return sprintf( (string)_(45,"%d days"),    t->how_many( Calendar.Day() ) );   }      string parse( RequestID id )   {    string res =    "<h2 class='no-margin-top'>"+_(46,"Change Roxen version")+"</h2>\n"    "<p>"; -  int warn; +        if( id->variables->server )    {    werror("Change to "+id->variables->server+"\n" );    mv("../local/environment", "../local/environment~");    Stdio.write_file( combine_path(roxen.configuration_dir,    "server_version"),    id->variables->server );    roxen->shutdown(0.5);    return (string)_(47,"Shutting down and changing Roxen version");
Roxen.git/server/config_interface/actions/change_version.pike:135:    res += "<tr><td>";    if( f->version != roxen.roxen_ver+"."+roxen.roxen_build )    res += "<input type='radio' name='server' value='"+f->dir+"' /> ";    else    res += "";    res += "</td>";       Calendar.Day d = f->reldate();    Calendar.Day diff = d && d->distance( Calendar.now() );    -  warn += f->cannot_change_back; +     res +=    "<td>"+f->version+"</td>"    "<td>"+(f->cannot_change_back?"<div class='notify warn inline'>&nbsp;</div>":"")+    "</td>"    "<td>"+(d ? d->set_language( roxen.get_locale()+"_UNICODE" )    ->format_ext_ymd() : "n/a")+    "</td>"    "<td>"+nice_relative_date( diff )+"</td>"    "<td>"+f->dir+"</td></tr>\n";    }