$__actualPath = dirname($__actualPath); require_once $__actualPath . '/setup.inc.php'; $requestedAction = 'edit'; $pageLocation = '1'; $wo = new WOOOF(); $tm = WOOOF::getCurrentDateTime(); $database = $wo->db->getDatabaseName(); $table = trim($wo->db->escape($_GET["table"])); $content = '<br/><a href="dbManager.php#' . $table . '" class="normalTextCyan">Back to Main Page</a><br/><br/>'; $result = $wo->db->query("show indexes from `{$table}`"); $content .= "<h3>Database Indexes for [{$table}]</h3>"; $content .= "<table width=\"100%\" border=\"0\" cellspacing=\"1\" align=\"left\" bgcolor=\"#FFFFFF\"><tr bgcolor=\"#000000\" class=\"normal_text_yellow\"><td>Table</td><td>Non_unique</td><td>Key_name</td><td>Seq_in_index</td><td>Column_name</td><td>Collation</td><td>Cardinality</td><td>Sub_part</td><td>Packed</td><td>Null</td><td>Index_type</td><td>Comment</td></tr>"; while ($row = $wo->db->fetchAssoc($result)) { $content .= "<tr bgcolor=\"#000000\" class=\"normal_text_cyan\"><td>{$row["Table"]}</td><td>{$row["Non_unique"]}</td><td>{$row["Key_name"]}</td><td>{$row["Seq_in_index"]}</td><td>{$row["Column_name"]}</td><td>{$row["Collation"]}</td><td>{$row["Cardinality"]}</td><td>{$row["Sub_part"]}</td><td>{$row["Packed"]}</td><td>{$row["Null"]}</td><td>{$row["Index_type"]}</td><td>{$row["Comment"]}</td></tr>\n"; } $content .= "</table>"; $content .= "<br><br><br><br>"; $content .= "<h3>Indexes in MetaData not already in the DB for Table [" . $_GET["table"] . "]</h3>"; ob_start(); $res2 = WOOOF_MetaData::buildIndexesForTable($wo, $database, $table, false); if ($res2 !== FALSE) { $content .= '<br>' . implode("<br>", $res2); } else { $content .= '<br>' . '<h2>Error</h2>' . $wo->getErrorsAsStringAndClear(); } ob_end_clean(); $content .= ' <br><br> <a href="mdSynch.php?what=buildIndex¶m1=' . $table . '¶m2=1" class="normalTextOrange">Build new Indexes</a> '; require_once 'template.php';
/** * Echoes sql statements (calling updateMetaDataFromOtherMetaData) * - Creates new metaData tables (using this class) * - Reverse engineers new metaData tables into normal metaData tables (hack!) * - Exports metaData tables. * - Rollbacks any changes from the reverse engineering above. * - Imports exported metaData and updateMetaDataFromOtherMetaData * * @param WOOOF $wo * @return boolean */ public static function selfUpgradeMetaData(WOOOF $wo, $database) { echo '<h2>' . __CLASS__ . '.' . __FUNCTION__ . '</h2>'; $succ = WOOOF_MetaData::createNewMetaDataTables($wo); if ($succ === FALSE) { return FALSE; } $succ = WOOOF_MetaData::reverseEngineerObject($wo, $database, '__tableMetaData', 'refresh', '__tableMetaDataNew'); if ($succ === FALSE) { return FALSE; } $succ = WOOOF_MetaData::reverseEngineerObject($wo, $database, '__columnMetaData', 'refresh', '__columnMetaDataNew'); if ($succ === FALSE) { return FALSE; } $fullFileName = WOOOF_MetaData::exportMetaData($wo, true, false); if ($fullFileName === FALSE) { return FALSE; } $wo->db->rollback(); // take back dmls of reverseEngineer $succ = WOOOF_MetaData::importMetaData($wo, basename($fullFileName)); if ($succ) { $succ = WOOOF_MetaData::updateMetaDataFromOtherMetaData($wo, $ddl, $dml, $sqlPerTable, false, false); if ($succ === FALSE) { return FALSE; } } // CAUTION: Assuming that the produced SQL statements will be executed. $succ = WOOOF_MetaData::versionWriteToDB($wo); if ($succ === FALSE) { return FALSE; } return true; }
<?php $__isAdminPage = true; $__isSiteBuilderPage = true; $__actualPath = dirname($_SERVER['SCRIPT_FILENAME']); $__actualPath = dirname($__actualPath); require_once $__actualPath . '/setup.inc.php'; $requestedAction = 'read'; $pageLocation = '1'; $pageTitle = 'Administration Back End'; $wo = new WOOOF(); $in = $wo->getMultipleGetPost(['table', 'class']); if (!$wo->hasContent($in['table']) or !$wo->hasContent($in['class'])) { die("You have to provice 'table' and 'class' parameters"); } $res = WOOOF_MetaData::createTplCodeForTable($wo, $in['table'], $in['class']); $res = '<textarea rows="50" cols="100">' . htmlentities($res) . "</textarea>"; echo $res; exit;
<?php $__isSiteBuilderPage = true; $__actualPath = dirname($_SERVER['SCRIPT_FILENAME']); $__actualPath = dirname($__actualPath); require_once $__actualPath . '/setup.inc.php'; $requestedAction = 'edit'; $pageLocation = '1'; $wo = new WOOOF(); if (!$wo->constructedOk) { $wo->handleShowStopperError("1000 Failed to init WOOOF."); } $tm = WOOOF::getCurrentDateTime(); $metaDataDBVersion = WOOOF_MetaData::versionReadFromDB($wo, $wo->db); if ($metaDataDBVersion !== NULL) { if ($metaDataDBVersion === 'UNDEFINED' or substr($metaDataDBVersion, 0, 2) < substr(WOOOF_MetaData::$version, 0, 2)) { echo "\n\t\t\tNeed to upgradre DB MetaData: DB version [{$metaDataDBVersion}] is behind Code Version [" . WOOOF_MetaData::$version . "]\n\t\t\t<br>\n\t\t\t<a href=\"mdSynch.php?what=selfUpgradeMetaData\">Click here to upgrade right now...</a>\n\t\t"; die; } } if (!isset($_COOKIE["allTablesVisible"])) { setcookie("allTablesVisible", "no"); header("Location: dbManager.php?tm=" . $tm); exit; } if ($_COOKIE["allTablesVisible"] == "no") { $switchText = "Make system tables visible"; $showSystemTables = FALSE; } else { $switchText = "Hide system tables"; $showSystemTables = TRUE;
die('Aborting execution.'); } if ($wo->getConfigurationFor('databaseLog')[0] == true) { echo "Please set the databaseLog config option to false and try again.<br>"; die('Aborting execution.'); } $paramNames = array('recreate'); $in = $wo->getMultipleGetPost($paramNames); $recreate = $in['recreate'] == '1'; $dbName = $wo->getConfigurationFor('databaseName')[0]; $usersArray = null; // set to null to create default users: sysOp, notLoggedIn, admin, user1 /* * // Example. $usersArray = array( array( 'sysOp', 'passowrd1', array('System Operator', 'Normal User'), null, false ), array( 'notLoggedIn', '', 'Not Logged In', WOOOF_User::ID_OF_NOT_LOGGED_IN, false ), array( 'admin', 'passowrd2', array('System Operator', 'Normal User'), null, false ), array( 'user1', 'passowrd3', 'Normal User', null, false ), ); */ $succ = WOOOF_MetaData::initDatabase($wo, $dbName, $usersArray, $recreate); $dbString = $dbName . '@' . $wo->getConfigurationFor('databaseHost')[0]; if ($succ) { echo "<h2>Db [{$dbString}] init ok</h2>"; echo '<a href="dbManager.php">Go to the dbManager page...</a>'; } else { echo "<h2>Db [{$dbString}] init FAILED!!!!</h2>"; } echo nl2br($wo->getErrorsAsStringAndClear()); echo "<br>Finished</br>";