options_expert.php

00001 <?php
00002 require_once 'diogenes.common.inc.php';
00003 require_once 'diogenes.toplevel.inc.php';
00004 require_once 'diogenes/diogenes.table-editor.inc.php';
00005 
00006 // set up the page
00007 $page = new $globals->toplevel(true);
00008 $page->assign("greeting",__("Global options"));
00009 $page->toolbar(__("Mode"), array( array( __("standard"), "options.php" ), __("expert")));
00010 
00011 $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : "";
00012 
00013 switch ($action) {
00014 case "cvs-rcs":
00015   $page->info("converting spool from CVS to RCS..");
00016   $res = $globals->db->query("select alias from diogenes_site");
00017   while(list($site) = mysql_fetch_row($res)) {
00018     $page->info("processing '$site'..");
00019     $spool = new Diogenes_VCS_Spool($page,$site);
00020     $page->info("-> deleting 'CVS' subdirectories from spool..");
00021     $goners = System::find($spool->datadir.' -type d');
00022     foreach($goners as $goner) {
00023       if (basename($goner) == "CVS")
00024         System::rm("-r $goner");
00025     }
00026     $page->info("-> changing files in spool to read-only..");
00027     $modfiles = System::find($spool->datadir.' -type f');
00028     foreach($modfiles as $modfile) {
00029       chmod($modfile,0444);
00030     }
00031   }
00032   $globals->updateOption("rcs","Diogenes_VCS_RCS");
00033   break;
00034 
00035 case "rcs-cvs":
00036   $page->info("converting spool from RCS to CVS..");
00037   if (!is_dir("{$globals->rcsroot}/CVSROOT")) {
00038     $page->info("-> no CVSROOT not found, running init..");
00039     if ($ret = shell_exec(escapeshellcmd("cvs -d".escapeshellarg($globals->rcsroot)." init")))
00040       $page->info($ret);
00041   }
00042 
00043   // remove current spool dirs and do a clean checkout of each site
00044   $res = $globals->db->query("select alias from diogenes_site");
00045   while(list($site) = mysql_fetch_row($res)) {
00046     $page->info("processing '$site'..");
00047     $page->info("-> removing '{$globals->spoolroot}/$site'..");
00048     System::rm("-r {$globals->spoolroot}/$site");
00049     $page->info("-> doing a checkout of module '$site'..");
00050     $spool = new Diogenes_VCS_CVS($page,$site,$_SESSION['session']->username,true);
00051   }
00052   $globals->updateOption("rcs","Diogenes_VCS_CVS");
00053   break;
00054 }
00055 
00056 $page->assign('msg_convert',__("Convert"));
00057 $page->assign('msg_vcs',__("version control system"));
00058 
00059 switch ($globals->rcs) {
00060 case "Diogenes_VCS_RCS":
00061   $page->assign('msg_current_vcs',__("You are currently using RCS as the version control system for your barrels."));
00062   $page->append('conversions',array("rcs-cvs", __("You can switch to a full CVS repository by clicking here.")));
00063   break;
00064 
00065 case "Diogenes_VCS_CVS":
00066   $page->assign('msg_current_vcs',__("You are currently using CVS as the version control system for your barrels."));
00067   $page->append('conversions',array("cvs-rcs", __("You can switch back to RCS by clicking here.")));
00068   break;
00069 }
00070 
00071 
00072 // set up the editor
00073 $editor = new DiogenesTableEditor($globals->table_global_options,"name",true);
00074 $editor->add_where_condition("barrel=''");
00075 $editor->hide('barrel', '');
00076 $editor->describe("name", __("option"), false);
00077 $editor->describe("value", __("value"), true);
00078 
00079 // run the editor
00080 $editor->table_style = "width:80%";
00081 $editor->run($page,'editor_content');
00082 
00083 $page->display('toplevel-options_expert.tpl');
00084 ?>

Generated on Fri Jan 11 01:20:08 2008 for Diogenes by  doxygen 1.5.1