classes/BuildTasks.php
static function run_check_sql_files( $task=null, $args=array(), $cliopts=array() )
    {
        $opts = self::getOpts( @$args[0], @$args[1], $cliopts );
        if ( !SharedLock::acquire( $opts['extension']['name'], LOCK_SH, $opts ) )
            throw new PakeException( "Source code locked by another process" );

        $destdir = self::getBuildDir( $opts ) . '/' . $opts['extension']['name'];

        $schemafile = $opts['files']['sql_files']['db_schema'];
        $schemafiles = array( 'share' => 'db_schema.dba', 'sql/mysql' => $schemafile, 'sql/oracle' => $schemafile, 'sql/postgresql' => $schemafile );
        if ( $schemafile == '$db.sql' )
        {
            $schemafiles = array( 'share' => 'db_schema.dba', 'sql/mysql' => 'mysql.sql', 'sql/oracle' => 'oracle.sql', 'sql/postgresql' => 'postgresql.sql' );
        }
        $count = 0;
        foreach( $schemafiles as $dir => $file )
        {
            $files = pakeFinder::type( 'file' )->name( $file )->maxdepth( 0 )->in( $destdir . "/$dir" );
            if ( count( $files ) )
            {
                if ( filesize( $files[0] ) == 0 )
                {
                    SharedLock::release( $opts['extension']['name'], LOCK_SH, $opts );
                    throw new pakeException( "Sql schema file {$files[0]} is empty. Please fix" );
                }
                $count++;
            }

        }
        if ( $count > 0 && $count < 4 )
        {
            SharedLock::release( $opts['extension']['name'], LOCK_SH, $opts );
            throw new pakeException( "Found some sql schema files but not all of them. Please fix" );
        }

        $datafile = $opts['files']['sql_files']['db_data'];
        $datafiles = array( 'share' => 'db_data.dba', 'sql/mysql' => $datafile, 'sql/oracle' => $datafile, 'sql/postgresql' => $datafile );
        if ( $datafile == '$db.sql' )
        {
            $datafiles = array( 'share' => 'db_data.dba', 'sql/mysql' => 'mysql.sql', 'sql/oracle' => 'oracle.sql', 'sql/postgresql' => 'postgresql.sql' );
        }
        $count = 0;
        foreach( $datafiles as $dir => $file )
        {
            $files = pakeFinder::type( 'file' )->name( $file )->maxdepth( 0 )->in( $destdir . "/$dir" );
            if ( count( $files ) )
            {
                if ( filesize( $files[0] ) == 0 )
                {
                    SharedLock::release( $opts['extension']['name'], LOCK_SH, $opts );
                    throw new pakeException( "Sql data file {$files[0]} is empty. Please fix" );
                }
                $count++;
            }
        }
        if ( $count > 0 && $count < 4 )
        {
            SharedLock::release( $opts['extension']['name'], LOCK_SH, $opts );
            throw new pakeException( "Found some sql data files but not all of them. Please fix" );
        }

        SharedLock::release( $opts['extension']['name'], LOCK_SH, $opts );
    }
static function run_check_sql_files( $task=null, $args=array(), $cliopts=array() )
    {
        $opts = self::getOpts( @$args[0], @$args[1], $cliopts );
        if ( !SharedLock::acquire( $opts['extension']['name'], LOCK_SH, $opts ) )
            throw new PakeException( "Source code locked by another process" );

        $destdir = self::getBuildDir( $opts ) . '/' . $opts['extension']['name'];

        $schemafile = $opts['files']['sql_files']['db_schema'];
        $schemafiles = array( 'share' => 'db_schema.dba', 'sql/mysql' => $schemafile, 'sql/oracle' => $schemafile, 'sql/postgresql' => $schemafile );
        if ( $schemafile == '$db.sql' )
        {
            $schemafiles = array( 'share' => 'db_schema.dba', 'sql/mysql' => 'mysql.sql', 'sql/oracle' => 'oracle.sql', 'sql/postgresql' => 'postgresql.sql' );
        }
        $count = 0;
        foreach( $schemafiles as $dir => $file )
        {
            $files = pakeFinder::type( 'file' )->name( $file )->maxdepth( 0 )->in( $destdir . "/$dir" );
            if ( count( $files ) )
            {
                if ( filesize( $files[0] ) == 0 )
                {
                    SharedLock::release( $opts['extension']['name'], LOCK_SH, $opts );
                    throw new pakeException( "Sql schema file {$files[0]} is empty. Please fix" );
                }
                $count++;
            }

        }
        if ( $count > 0 && $count < 4 )
        {
            SharedLock::release( $opts['extension']['name'], LOCK_SH, $opts );
            throw new pakeException( "Found some sql schema files but not all of them. Please fix" );
        }

        $datafile = $opts['files']['sql_files']['db_data'];
        $datafiles = array( 'share' => 'db_data.dba', 'sql/mysql' => $datafile, 'sql/oracle' => $datafile, 'sql/postgresql' => $datafile );
        if ( $datafile == '$db.sql' )
        {
            $datafiles = array( 'share' => 'db_data.dba', 'sql/mysql' => 'mysql.sql', 'sql/oracle' => 'oracle.sql', 'sql/postgresql' => 'postgresql.sql' );
        }
        $count = 0;
        foreach( $datafiles as $dir => $file )
        {
            $files = pakeFinder::type( 'file' )->name( $file )->maxdepth( 0 )->in( $destdir . "/$dir" );
            if ( count( $files ) )
            {
                if ( filesize( $files[0] ) == 0 )
                {
                    SharedLock::release( $opts['extension']['name'], LOCK_SH, $opts );
                    throw new pakeException( "Sql data file {$files[0]} is empty. Please fix" );
                }
                $count++;
            }
        }
        if ( $count > 0 && $count < 4 )
        {
            SharedLock::release( $opts['extension']['name'], LOCK_SH, $opts );
            throw new pakeException( "Found some sql data files but not all of them. Please fix" );
        }

        SharedLock::release( $opts['extension']['name'], LOCK_SH, $opts );
    }
Checks if a schema.sql file is present for any supported database (or none at all)

The accepted directory structure is:

myextension
|___share
|   |___db_schema.dba
|   `___db_data.dba
`__ sql
|__ mysql
|   |__ cleandata.sql
|   `__ schema.sql
|__ oracle
|   |__ cleandata.sql
|   `__ schema.sql
`__ postgresql
|__ cleandata.sql
`__ schema.sql

NB: there are NOT a lot of extensions currently following this schema.
Alternative used are: sql/mysql/mysql.sql, sql/mysql/random.sql