Release diogenes-0.9.22
[diogenes.git] / htdocs / toplevel / options_expert.php
CommitLineData
6855525e
JL
1<?php
2require_once 'diogenes.common.inc.php';
3require_once 'diogenes.toplevel.inc.php';
4require_once 'diogenes/diogenes.table-editor.inc.php';
5
6// set up the page
7$page = new $globals->toplevel(true);
8$page->assign("greeting",__("Global options"));
9$page->toolbar(__("Mode"), array( array( __("standard"), "options.php" ), __("expert")));
10
11$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : "";
12
13switch ($action) {
14case "cvs-rcs":
15 $page->info("converting spool from CVS to RCS..");
16 $res = $globals->db->query("select alias from diogenes_site");
17 while(list($site) = mysql_fetch_row($res)) {
18 $page->info("processing '$site'..");
cb8988c6 19 $spool = new Diogenes_VCS_Spool($page,$site);
6855525e
JL
20 $page->info("-> deleting 'CVS' subdirectories from spool..");
21 $goners = System::find($spool->datadir.' -type d');
22 foreach($goners as $goner) {
23 if (basename($goner) == "CVS")
24 System::rm("-r $goner");
25 }
26 $page->info("-> changing files in spool to read-only..");
27 $modfiles = System::find($spool->datadir.' -type f');
28 foreach($modfiles as $modfile) {
29 chmod($modfile,0444);
30 }
31 }
cb8988c6 32 $globals->updateOption("rcs","Diogenes_VCS_RCS");
6855525e
JL
33 break;
34
35case "rcs-cvs":
36 $page->info("converting spool from RCS to CVS..");
37 if (!is_dir("{$globals->rcsroot}/CVSROOT")) {
38 $page->info("-> no CVSROOT not found, running init..");
39 if ($ret = shell_exec(escapeshellcmd("cvs -d".escapeshellarg($globals->rcsroot)." init")))
40 $page->info($ret);
41 }
42
43 // remove current spool dirs and do a clean checkout of each site
44 $res = $globals->db->query("select alias from diogenes_site");
45 while(list($site) = mysql_fetch_row($res)) {
46 $page->info("processing '$site'..");
47 $page->info("-> removing '{$globals->spoolroot}/$site'..");
48 System::rm("-r {$globals->spoolroot}/$site");
49 $page->info("-> doing a checkout of module '$site'..");
cb8988c6 50 $spool = new Diogenes_VCS_CVS($page,$site,$_SESSION['session']->username,true);
6855525e 51 }
cb8988c6 52 $globals->updateOption("rcs","Diogenes_VCS_CVS");
6855525e
JL
53 break;
54}
55
56$page->assign('msg_convert',__("Convert"));
57$page->assign('msg_vcs',__("version control system"));
58
59switch ($globals->rcs) {
cb8988c6 60case "Diogenes_VCS_RCS":
6855525e
JL
61 $page->assign('msg_current_vcs',__("You are currently using RCS as the version control system for your barrels."));
62 $page->append('conversions',array("rcs-cvs", __("You can switch to a full CVS repository by clicking here.")));
63 break;
64
cb8988c6 65case "Diogenes_VCS_CVS":
6855525e
JL
66 $page->assign('msg_current_vcs',__("You are currently using CVS as the version control system for your barrels."));
67 $page->append('conversions',array("cvs-rcs", __("You can switch back to RCS by clicking here.")));
68 break;
69}
70
71
72// set up the editor
73$editor = new DiogenesTableEditor($globals->table_global_options,"name",true);
74$editor->add_where_condition("barrel=''");
75$editor->hide('barrel', '');
76$editor->describe("name", __("option"), false);
77$editor->describe("value", __("value"), true);
78
79// run the editor
80$editor->table_style = "width:80%";
81$editor->run($page,'editor_content');
82
83$page->display('toplevel-options_expert.tpl');
84?>