* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. ******************************************************************************/ include_once 'utils.php'; /** * Clean all the current data. * * @author Richard Friedman */ writeDatabaseInformation(); writeLine("<b>Cleaning up all the data.</b>"); $database = RingsideApiDbDatabase::getDatabaseConnection(); if ($database === false) { writeLine("No such database is currently available"); RingsideApiDbDatabase::closeConnection($database); } else { $schema = readSqlFile('RingsideDbCleanData.sql'); if ($schema === false) { writeError(' The SQL could not be loade from the application '); exit; } $result = RingsideApiDbDatabase::queryMultiLine($schema, $database); if ($result === false) { writeError('The database was not cleaned properly, check the error log.'); } else {
/** * Create the schema for demo applications. * @return true/false */ function createDemoSchema() { writeLine('Setting up DEMO tables for Tutorials.'); $database = RingsideApiDbDatabase::getConnection(); if ($database === false) { writeError('Can not connect to the database server.'); writeError('Please check and configure your LocalSettings.php'); writeError('Your current database information.'); writeDatabaseInformation(); return false; } if (!mysql_select_db(RingsideApiConfig::$db_name, $database)) { writeError("Can not select the database '{RingsideApiConfig::{$db_name}}'."); } $schema = readSqlFile('demo-schema.sql'); if ($schema === false) { writeError('The schema \'demo-schema.sql\' could not be loaded.'); return false; } $result = RingsideApiDbDatabase::queryMultiLine($schema, $database); if ($result === false) { writeError('The schema \'demo-schema.sql\' did not fully load, please check the error log'); return false; } writeLine('The demo schema was loaded.'); writeLine(); RingsideApiDbDatabase::closeConnection($database); return true; }