class Pman_Cms_UpdateDatabase extends Pman
{
- static $cli_desc = "Update SQL - Beta";
+ static $cli_desc = "Update Database (Cms)";
static $cli_opts = array(
'template' => array(
'min' => 1,
'max' => 1,
+ ),
+ 'force-content-update' => array(
+ 'desc' => 'Force updating of content from templates',
+ 'default' => '',
+ 'short' => 'f',
+ 'min' => 1,
+ 'max' => 1,
+
),
'debug' => array(
'desc' => 'Turn on debuggin',
);
var $cli = false;
+
+ var $opts;
+
function getAuth() {
return true;
}
- function get($tbl, $opts)
+ function get($tbl, $opts= array())
{
if (!empty($opts['debug'])) {
DB_DataObject::debugLevel(1);
die("done");
}
+ $this->opts = $opts;
+
$this->updateData();
if (!empty($tbl)) {
'name' => 'category',
'display_name' => 'Category',
),
+ array(
+ 'name' => 'disabled',
+ 'display_name' => 'Disabled element',
+ ),
)
- )
+ ),
+ array(
+ 'etype' => '',
+ 'name' => 'Cms.Settings',
+ 'display_name' => 'Cms Settings',
+ 'cn' => array(
+
+ )
+ ),
+ array(
+ 'etype' => '',
+ 'name' => 'cms_page_class',
+ 'display_name' => 'Cms Page Class',
+ 'cn' => array(
+ array(
+ 'name' => 'deep-blue',
+ 'display_name' => 'Deep Blue',
+ ),
+ array(
+ 'name' => 'deep-grey',
+ 'display_name' => 'Deep Grey',
+ ),
+ array(
+ 'name' => 'light-red',
+ 'display_name' => 'Light Red',
+ ),
+ array(
+ 'name' => 'deep-orange',
+ 'display_name' => 'Deep Orange',
+ ),
+ array(
+ 'name' => 'deep-green',
+ 'display_name' => 'Deep Green',
+ )
+ )
+ ),
)
);
-
+ /*
$p = DB_DataObject::Factory('cms_page');
$p->page_type_id = 0;
$all = $p->fetchAll();
foreach($all as $t) {
$t->convertOld();
}
-
- $opts = HTML_FlexyFramework::get()->Pman_Cms;
-
- $tp = DB_DataObject::factory('cms_template');
- $tp->syncTemplateDir(false, '', true);
- //if (isset($q['lang'])) {
- // $this->syncLang($q['lang']);
- //}
+ $ff = $this->bootLoader;
+ $opts = isset($this->bootLoader->Pman_Cms) ? $this->bootLoader->Pman_Cms : array();
+ echo "Calling syncTemplateDir from Cms/UpdateDatabase\n";
- $page = DB_DataObject::factory('cms_page');
- $page->initData();
-
- // templates.. -- assume the above does the template syncing..
- //DB_DataObject::DebugLevel(1);
- echo "Sync the Languages template.....\n";
- $x = DB_Dataobject::Factory('cms_templatestr');
- $x->selectAdd();
- $x->selectAdd('distinct(lang) as lang');
- $x->whereAdd("lang != ''");
- if(!$x->count()){
- echo "Sync default Language.....\n";
- $tps = DB_DataObject::factory('cms_templatestr');
- $tps->syncLang('en'); /// this should be configured somewhere..
+ if (empty($this->opts['force-content-update'])) {
return;
}
- foreach( $x->fetchAll('lang') as $l) {
- echo "Sync $l Language.....\n";
- $tps = DB_DataObject::factory('cms_templatestr');
- $tps->syncLang($l); /// this should be configured somewhere..
- }
+ */
+ echo "Template sync has been removed from here - call Cms/UpdateTemplates\n";
- //sync the tables to cms_templatestr
- if(isset($opts['DataObjects_Cms_templatestr']['tables'])){
- $cts = DB_DataObject::factory('cms_templatestr');
-
- foreach($opts['DataObjects_Cms_templatestr']['tables'] as $table=>$cols)){
- $t = DB_DataObject::factory($table);
- foreach($t->fetchAll() as $d) {
- $cts->onTableChange($this, $t, 'update');
- }
- }
-
-
-
-
-
-
-// if()
-// }
+
}
}
\ No newline at end of file