示例#1
0
 public static function Util_Migrate_AllConf2Xml($SERVER_ROOT)
 {
     // will migrate all included vh and tp xml files
     if ($SERVER_ROOT == '' || trim($SERVER_ROOT) == '') {
         die("Require SERVER_ROOT as input param!");
     }
     error_log("Migrate plain conf to xml from {$SERVER_ROOT}\n");
     if ($SERVER_ROOT[-1] != '/') {
         $SERVER_ROOT .= '/';
     }
     define('SERVER_ROOT', $SERVER_ROOT);
     $servconf = SERVER_ROOT . 'conf/httpd_config.conf';
     $cdata = new CData(DInfo::CT_SERV, $servconf);
     $cdata->migrate_allconf2xml();
     $adminconf = SERVER_ROOT . 'admin/conf/admin_config.conf';
     $admindata = new CData(DInfo::CT_ADMIN, $adminconf);
     $filemap = DPageDef::GetInstance()->GetFileMap(DInfo::CT_ADMIN);
     $admindata->save_xml_file($admindata->_root, $filemap, $admindata->_xmlpath);
     $admindata->copy_permission($admindata->_path, $admindata->_xmlpath);
     error_log("Migration done.\n");
 }
示例#2
0
<?php

/*
* By Silvio Garbes
* Em: 10/11/2015
*/
require_once '../proxieMySQLEntities.php';
try {
    $proxy = new CData();
    $response = $proxy->Execute("tabela1");
    foreach ($response->Result as $customer) {
        print_r($customer);
    }
} catch (Exception $e) {
    //catch errors from the Cloud Driver for MySQL
    echo $e->getError(), "\n";
}
示例#3
0
 protected function instantiateTemplate()
 {
     $tpname = $this->_disp->Get(DInfo::FLD_ViewName);
     $vhname = $this->_disp->GetLast(DInfo::FLD_REF);
     $s_tpnode = $this->_serv->GetChildNodeById('vhTemplate', $tpname);
     if ($s_tpnode == NULL) {
         return false;
     }
     $s_vhnode = $s_tpnode->GetChildNodeById('member', $vhname);
     if ($s_vhnode == NULL) {
         return false;
     }
     $confpath = $this->getConfFilePath(DInfo::CT_TP, $tpname);
     $tp = new CData(DInfo::CT_TP, $confpath);
     if (($conferr = $tp->GetConfErr()) != NULL) {
         $this->_disp->Set(DInfo::FLD_TopMsg, $conferr);
         return false;
     }
     $tproot = $tp->GetRootNode();
     $configfile = $tproot->GetChildVal('configFile');
     if ($configfile == NULL) {
         return false;
     }
     $vhRoot_path = '';
     if (strncasecmp('$VH_ROOT', $configfile, 8) == 0) {
         $vhRoot_path = $s_vhnode->GetChildVal('vhRoot');
         // customized
         if ($vhRoot_path == NULL) {
             //default
             $vhRoot_path = $tproot->GetChildVal('vhRoot');
             if ($vhRoot_path == NULL) {
                 return false;
             }
         }
     }
     $configfile = PathTool::GetAbsFile($configfile, 'VR', $vhname, $vhRoot_path);
     $vh = new CData(DInfo::CT_VH, $configfile, "`{$vhname}");
     if (($conferr = $vh->GetConfErr()) != NULL) {
         $this->_disp->Set(DInfo::FLD_TopMsg, $conferr);
         return false;
     }
     $vhroot = $tproot->GetChildren('virtualHostConfig');
     if ($vhroot == false) {
         return false;
     }
     $vh->SetRootNode($vhroot);
     $vh->SaveFile();
     // save serv file
     $basemap = new DTblMap(array('', '*virtualhost$name'), 'V_TOPD');
     $tproot->AddChild(new CNode('name', $vhname));
     $tproot->AddChild(new CNode('note', "Instantiated from template {$tpname}"));
     $basemap->Convert(0, $tproot, 1, $this->_serv->GetRootNode());
     $s_vhnode->RemoveFromParent();
     $domains = $s_vhnode->GetChildVal('vhDomain');
     if ($domains == NULL) {
         $domains = $vhname;
     }
     // default
     if (($domainalias = $s_vhnode->GetChildVal('vhAliases')) != NULL) {
         $domains .= ", {$domainalias}";
     }
     $listeners = $s_tpnode->GetChildVal('listeners');
     $lns = preg_split("/, /", $listeners, -1, PREG_SPLIT_NO_EMPTY);
     foreach ($lns as $ln) {
         $listener = $this->_serv->GetChildNodeById('listener', $ln);
         if ($listener != NULL) {
             $vhmap = new CNode('vhmap', $vhname);
             $vhmap->AddChild(new CNode('domain', $domains));
             $listener->AddChild($vhmap);
         } else {
             error_log("cannot find listener {$ln} \n");
         }
     }
     $this->_serv->SaveFile();
     return true;
 }
示例#4
0
<?php

if ($argc != 3) {
    die("require parameter SERVER_ROOT and [recover script file path | 2xml ]");
}
$SERVROOT = $argv[1];
ini_set('include_path', "../html.open/lib/:../html.open/lib/ows/:.");
date_default_timezone_set('America/New_York');
spl_autoload_register(function ($class) {
    include $class . '.php';
});
if ($argv[2] == "2xml") {
    CData::Util_Migrate_AllConf2Xml($SERVROOT);
} else {
    CData::Util_Migrate_AllXml2Conf($SERVROOT, $argv[2], 1);
}
示例#5
0
         }
         $template_vars['db_pconne'] = $pconn_val ? 'checked="checked" ' : null;
     }
 } elseif (isset($_GET['content'])) {
     $template_location[] = 'administration/content.html';
     $template_vars['page_title'] .= 'Content Management';
     $cpages = CData::content_pages();
     if (!isset($_GET['cpage']) || isset($_GET['cpage']) && !in_array(strtoupper($_GET['cpage']), $cpages)) {
         $cpagel_vars['cpage_list'] = null;
         foreach ($cpages as $cp) {
             $cpagel_vars['cpage_name'] = ucfirst(strtolower($cp));
             $cpage_vars['cpage_list'] .= Template::load('administration/styles/content_pages_list.html', $cpagel_vars, 0);
         }
         $template_vars['content_management'] = Template::load('administration/styles/content_pages.html', $cpage_vars, 0);
     } else {
         $cpage = new CData($_GET['cpage']);
         $cpage_vars = array();
         $cpage_vars = $cpage->used_vars();
         $cpage_vars['cpage_name'] = ucfirst(strtolower($_GET['cpage']));
         $cpage_vars['cpage_pp'] = $cpage->results_pp;
         $cpage_vars['cpage_data_list'] = '';
         $cpage_vars['the_status'] = '';
         $i = 1;
         if (isset($_GET['action']) && $_GET['action'] == 'add') {
             $template_vars['content_management'] = Template::load('administration/styles/content_page_data_add.html', $cpage_vars, 0);
         } elseif (isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['id'])) {
             foreach ($cpage->used_content() as $used_content) {
                 if ($used_content['cdata_id'] == (int) $_GET['id']) {
                     $the_title = $used_content['cdata_subject'];
                     $the_content = D64Code::decode($used_content['cdata_content']);
                     $cpage_vars['cpage_id'] = $used_content['cdata_id'];