function rebuildWorkspaceConfig() { require_once TOOLKIT . "/class.mysqldump.php"; $dump = new MySQLDump($this->_db); $prefix = $this->getConfigVar("tbl_prefix", "database"); $data = $dump->takeDump($prefix . "pages", "DATA_ONLY"); $data .= $dump->takeDump($prefix . "customfields", "DATA_ONLY"); $meta = $dump->takeDump($prefix . "metadata", "DATA_ONLY", "`class` IN('page','customfield', 'section', 'master', 'utility')"); $data .= $dump->takeDump($prefix . "utilities", "DATA_ONLY"); $data .= $dump->takeDump($prefix . "masters", "DATA_ONLY"); $data .= $dump->takeDump($prefix . "sections", "DATA_ONLY"); unset($dump); ## Make sure the prefix is correct. We need it as 'tbl_' not the user specified one str_replace("`{$prefix}", '`tbl_', $data); ## Make sure we dont get metadata primary key collisions $meta = preg_replace('/VALUES \\(\\d+/i', "VALUES (''", $meta); $data .= $meta; @file_put_contents(WORKSPACE . "/workspace.conf", $data); if ($hash = @md5_file(WORKSPACE . "/workspace.conf")) { $this->setConfigVar("config_checksum", $hash, "workspace"); $this->saveConfig(); $this->flush_cache("ALL"); return true; } $this->log->pushToLog("ERROR: Rebuilding of workspace configuration failed", SYM_LOG_ERROR, true, true); return false; }
* ***/ if (array_key_exists("begin", $_POST['action'])) { $start = time(); $Admin->log->writeToLog("============================================\r\n", true); $Admin->log->pushToLog("Beginning 1.1.00 Migration", SYM_LOG_NOTICE, true, true); ##Create Backup $Admin->log->pushToLog("Backing Up Existing Database...", SYM_LOG_NOTICE, true, false); require_once TOOLKIT . "/class.mysqldump.php"; $data = "\nTRUNCATE `tbl_entries`;"; $data .= "\nTRUNCATE `tbl_entries2customfields`;"; $data .= "\nTRUNCATE `tbl_comments`;"; $data .= "\nTRUNCATE `tbl_entries_types`;"; $data .= "\nDELETE FROM `tbl_metadata` WHERE `class` IN('entry', 'comment');"; $dump = new MySQLDump($DB); $data .= $dump->takeDump($Admin->getConfigVar("tbl_prefix", "database") . "entries", "DATA_ONLY"); $data .= $dump->takeDump($Admin->getConfigVar("tbl_prefix", "database") . "comments", "DATA_ONLY"); $data .= $dump->takeDump($Admin->getConfigVar("tbl_prefix", "database") . "metadata", "DATA_ONLY", "`class` IN('entry','comment')"); unset($dump); if (!@file_put_contents(TMP . "/migration-backup.sql", $data)) { define("__SYM_MIGRATION_ERRORS__", true); $Admin->log->pushToLog("Failed.", SYM_LOG_NOTICE, true, true, true); } else { $Admin->log->pushToLog("Done.", SYM_LOG_NOTICE, true, true, true); } ##Entries if (!defined("__SYM_MIGRATION_ERRORS__")) { $Admin->log->pushToLog("Migrating Entries Table", SYM_LOG_NOTICE, true, true); //--------------------- $TFM = new TextformatterManager(array('parent' => &$Admin)); $sql = "SELECT `id`, `title`, `body_raw`, `formatter` FROM `tbl_entries`";