See text/EN/licence.txt for full licencing information. NOTE TO PROGRAMMERS: Do not edit this file. If you need to make changes, save your changed file to the appropriate *_custom folder **** If you ignore this advice, then your website upgrades (e.g. for bug fixes) will likely kill your changes **** */ /* Used to generate a database schema in the form of SQL code that can be imported into MySQL Workbench First run this, then run SQLEditor on the files created in uploads/website_specific. */ require_code('relations'); $all_tables = get_all_tables(); $tables_by = get_tables_by_addon(); foreach ($tables_by as $t => $ts) { $path = get_custom_file_base() . '/uploads/website_specific/ocportal_erd__' . $t . '.sql'; $myfile = fopen($path, 'wt'); $tables = array(); foreach ($ts as $table) { if (!array_key_exists($table, $all_tables)) { continue; } // Not installed $tables[$table] = $all_tables[$table]; } fwrite($myfile, get_innodb_table_sql($tables, $all_tables)); fclose($myfile); fix_permissions($path); sync_file($path); } $GLOBALS['SCREEN_TEMPLATE_CALLED'] = ''; echo 'Done, files generated in <kbd>uploads/website_specific</kbd>.';
/* ocPortal Copyright (c) ocProducts, 2004-2012 See text/EN/licence.txt for full licencing information. NOTE TO PROGRAMMERS: Do not edit this file. If you need to make changes, save your changed file to the appropriate *_custom folder **** If you ignore this advice, then your website upgrades (e.g. for bug fixes) will likely kill your changes **** */ /* Used to generate a database schema in the form of SQL code that can be imported into MySQL Workbench First run this, then import it all into a new database (existing is problematic as it needs to be InnoDB), then run SQLEditor on that database -- or if you like try your luck importing, but that was crashing for me. */ $filename = 'ocportal-erd.sql'; if (!isset($_GET['testing'])) { header('Content-Type: application/octet-stream' . '; authoritative=true;'); if (strstr(ocp_srv('HTTP_USER_AGENT'), 'MSIE') !== false) { header('Content-Disposition: filename="' . str_replace(chr(13), '', str_replace(chr(10), '', addslashes($filename))) . '"'); } else { header('Content-Disposition: attachment; filename="' . str_replace(chr(13), '', str_replace(chr(10), '', addslashes($filename))) . '"'); } } else { header('Content-type: text/plain'); } require_code('relations'); $relation_map = get_relation_map(); $tables = get_all_tables(); echo get_innodb_table_sql($tables, $tables); $GLOBALS['SCREEN_TEMPLATE_CALLED'] = ''; exit;