protected function _setup( array $files )
	{
		foreach( $files as $rname => $filepath )
		{
			$this->_msg( 'Using tables from ' . basename( $filepath ), 1 ); $this->_status('');

			if ( ( $content = file_get_contents( $filepath ) ) === false ) {
				throw new MW_Setup_Exception( sprintf( 'Unable to get content from file "%1$s"', $filepath ) );
			}

			$schema = $this->_getSchema( $rname );

			foreach( $this->_getTableDefinitions( $content ) as $name => $sql )
			{
				$this->_msg( sprintf( 'Checking table "%1$s": ', $name ), 2 );

				if( $schema->tableExists( $name ) !== true ) {
					$this->_execute( $sql, $rname );
					$this->_status( 'created' );
				} else {
					$this->_status( 'OK' );
				}
			}

			foreach( $this->_getIndexDefinitions( $content ) as $name => $sql )
			{
				$parts = explode( '.', $name );
				$this->_msg( sprintf( 'Checking index "%1$s": ', $name ), 2 );

				if ( $schema->indexExists( $parts[0], $parts[1] ) !== true ) {
					$this->_execute( $sql, $rname );
					$this->_status( 'created' );
				} else {
					$this->_status( 'OK' );
				}
			}
		}
	}
protected function _setup( array $files )
	{
		foreach( $files as $rname => $filepath )
		{
			$this->_msg( 'Using tables from ' . basename( $filepath ), 1 ); $this->_status('');

			if ( ( $content = file_get_contents( $filepath ) ) === false ) {
				throw new MW_Setup_Exception( sprintf( 'Unable to get content from file "%1$s"', $filepath ) );
			}

			$schema = $this->_getSchema( $rname );

			foreach( $this->_getTableDefinitions( $content ) as $name => $sql )
			{
				$this->_msg( sprintf( 'Checking table "%1$s": ', $name ), 2 );

				if( $schema->tableExists( $name ) !== true ) {
					$this->_execute( $sql, $rname );
					$this->_status( 'created' );
				} else {
					$this->_status( 'OK' );
				}
			}

			foreach( $this->_getIndexDefinitions( $content ) as $name => $sql )
			{
				$parts = explode( '.', $name );
				$this->_msg( sprintf( 'Checking index "%1$s": ', $name ), 2 );

				if ( $schema->indexExists( $parts[0], $parts[1] ) !== true ) {
					$this->_execute( $sql, $rname );
					$this->_status( 'created' );
				} else {
					$this->_status( 'OK' );
				}
			}
		}
	}
protected function _setup ( array $ files ) { foreach ( $ files as $ rname => $ filepath ) { $ this -> _msg ( 'Using tables from ' . basename ( $ filepath ) , 1 ) ; $ this -> _status ( '' ) ; if ( ( $ content = file_get_contents ( $ filepath ) ) === false ) { throw new MW_Setup_Exception ( sprintf ( 'Unable to get content from file "%1$s"' , $ filepath ) ) ; } $ schema = $ this -> _getSchema ( $ rname ) ; foreach ( $ this -> _getTableDefinitions ( $ content ) as $ name => $ sql ) { $ this -> _msg ( sprintf ( 'Checking table "%1$s": ' , $ name ) , 2 ) ; if ( $ schema -> tableExists ( $ name ) !== true ) { $ this -> _execute ( $ sql , $ rname ) ; $ this -> _status ( 'created' ) ; } else { $ this -> _status ( 'OK' ) ; } } foreach ( $ this -> _getIndexDefinitions ( $ content ) as $ name => $ sql ) { $ parts = explode ( '.' , $ name ) ; $ this -> _msg ( sprintf ( 'Checking index "%1$s": ' , $ name ) , 2 ) ; if ( $ schema -> indexExists ( $ parts [ 0 ] , $ parts [ 1 ] ) !== true ) { $ this -> _execute ( $ sql , $ rname ) ; $ this -> _status ( 'created' ) ; } else { $ this -> _status ( 'OK' ) ; } } } }
Creates all required tables if they don't exist
Creates all required tables if they don t exist