/** * Create an empty stub for the schema.php file */ protected function add() { // make sure the schema file doesn't exist if (file_exists(MPM_DB_PATH . 'schema.php') || file_exists(MPM_DB_PATH . 'test_data.php')) { $this->clw->addText('The schema and/or test data files already exist. Delete them first if you want to use this option.'); $this->clw->write(); exit; } $file = MpmTemplateHelper::getTemplate('schema.txt'); $test_data_file = MpmTemplateHelper::getTemplate('test_data.txt'); $fp = fopen(MPM_DB_PATH . 'schema.php', "w"); if ($fp == false) { echo "\nUnable to write to file. Initialization failed!\n\n"; exit; } $success = fwrite($fp, $file); if ($success == false) { echo "\nUnable to write to file. Initialization failed!\n\n"; exit; } fclose($fp); $fp = fopen(MPM_DB_PATH . 'test_data.php', "w"); if ($fp == false) { echo "\nUnable to write to file. Initialization failed!\n\n"; exit; } $success = fwrite($fp, $test_data_file); if ($success == false) { echo "\nUnable to write to file. Initialization failed!\n\n"; exit; } fclose($fp); $this->clw->addText('File ' . MPM_DB_PATH . 'schema.php has been created.'); $this->clw->addText('File ' . MPM_DB_PATH . 'test_data.php has been created.'); $this->clw->write(); }