blob: 49d8d08635ad227288ea0a830d270551d2a1cd12 [file] [log] [blame]
gobriendd79db82008-04-26 00:09:51 +00001<?php
2/*******************************************************************************
3 * Copyright (c) 2006-2007 Eclipse Foundation
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Bjorn Freeman-Benson - initial API and implementation
11 * Ward Cunningham - initial API and implementation
12 * Karl Mathias - initial API and implementation
13 *******************************************************************************/
14
15//require_once( $GLOBALS['CLASSES_DIRECTORY'] . "functions.php" );
16//require_once( $GLOBALS['CLASSES_DIRECTORY'] . "context.class.php" );
17
18
19
20class CheckAndModifyDatabaseSchema {
21 public function check_and_modify( $context ) {
22 $rtrn = true;
23 $dir = $context->get("components_directory");
24 foreach( dirs($dir) as $component ) {
25 print $dir . "$component/check-database-schema.php\n";
26
27 if( file_exists( $dir . "$component/check-database-schema.php" ) ) {
28 echo "Checking db schema for table '$component'\n";
kitlo1d027092018-04-19 17:44:07 -040029 mysqli_select_db($dbh, $component);
gobriendd79db82008-04-26 00:09:51 +000030 // the included code uses the context to check (and perhaps modify) the database(s) schemas
31 include_once( $dir . "$component/check-database-schema.php" );
32 $checkername = $component . "_SchemaChecker";
33 $obj = new $checkername ;
34 if( !$obj->check_and_modify( $context ) ) {
35 echo "***Trouble during checking database schema for table: '$component' ****\n";
36 $rtrn = false;
37 }
38 }
39 }
40 return $rtrn;
41 }
42}
43
44?>