Classes/Setup.php
public function schema( array $sql )
	{
		$ctx = self::getContext();
		$dbm = $ctx->getDatabaseManager();
		$conn = $dbm->acquire();

		try
		{
			$tables = [];

			foreach( ['fe_users_', 'madmin_', 'mshop_'] as $prefix )
			{
				$result = $conn->create( 'SHOW TABLES like \'' . $prefix . '%\'' )->execute();

				while( ( $row = $result->fetch( \Aimeos\MW\DB\Result\Base::FETCH_NUM ) ) !== false ) {
					$tables[] = $row[0];
				}
			}

			foreach( $tables as $table )
			{
				$result = $conn->create( 'SHOW CREATE TABLE ' . $table )->execute();

				while( ( $row = $result->fetch( \Aimeos\MW\DB\Result\Base::FETCH_NUM ) ) !== false )
				{
					$str = preg_replace( '/,[\n ]*CONSTRAINT.+CASCADE/', '', $row[1] );
					$str = str_replace( '"', '`', $str );

					$sql[] = $str . ";\n";
				}
			}

			$dbm->release( $conn );
		}
		catch( \Exception $e )
		{
			$dbm->release( $conn );
		}


		return ['sqlString' => $sql ];
	}
public function schema( array $sql )
	{
		$ctx = self::getContext();
		$dbm = $ctx->getDatabaseManager();
		$conn = $dbm->acquire();

		try
		{
			$tables = [];

			foreach( ['fe_users_', 'madmin_', 'mshop_'] as $prefix )
			{
				$result = $conn->create( 'SHOW TABLES like \'' . $prefix . '%\'' )->execute();

				while( ( $row = $result->fetch( \Aimeos\MW\DB\Result\Base::FETCH_NUM ) ) !== false ) {
					$tables[] = $row[0];
				}
			}

			foreach( $tables as $table )
			{
				$result = $conn->create( 'SHOW CREATE TABLE ' . $table )->execute();

				while( ( $row = $result->fetch( \Aimeos\MW\DB\Result\Base::FETCH_NUM ) ) !== false )
				{
					$str = preg_replace( '/,[\n ]*CONSTRAINT.+CASCADE/', '', $row[1] );
					$str = str_replace( '"', '`', $str );

					$sql[] = $str . ";\n";
				}
			}

			$dbm->release( $conn );
		}
		catch( \Exception $e )
		{
			$dbm->release( $conn );
		}


		return ['sqlString' => $sql ];
	}
public function schema ( array $ sql ) { $ ctx = self :: getContext ( ) ; $ dbm = $ ctx -> getDatabaseManager ( ) ; $ conn = $ dbm -> acquire ( ) ; try { $ tables = [ ] ; foreach ( [ 'fe_users_' , 'madmin_' , 'mshop_' ] as $ prefix ) { $ result = $ conn -> create ( 'SHOW TABLES like \'' . $ prefix . '%\'' ) -> execute ( ) ; while ( ( $ row = $ result -> fetch ( \ Aimeos \ MW \ DB \ Result \ Base :: FETCH_NUM ) ) !== false ) { $ tables [ ] = $ row [ 0 ] ; } } foreach ( $ tables as $ table ) { $ result = $ conn -> create ( 'SHOW CREATE TABLE ' . $ table ) -> execute ( ) ; while ( ( $ row = $ result -> fetch ( \ Aimeos \ MW \ DB \ Result \ Base :: FETCH_NUM ) ) !== false ) { $ str = preg_replace ( '/,[\n ]*CONSTRAINT.+CASCADE/' , '' , $ row [ 1 ] ) ; $ str = str_replace ( '"' , '`' , $ str ) ; $ sql [ ] = $ str . ";\n" ; } } $ dbm -> release ( $ conn ) ; } catch ( \ Exception $ e ) { $ dbm -> release ( $ conn ) ; } return [ 'sqlString' => $ sql ] ; }
Executes the setup tasks if extension is installed.

@param string|null $extname Installed extension name
Executes the setup tasks if extension is installed .