public static function lockTables($tablesToRead, $tablesToWrite = array())
    {
        if (!is_array($tablesToRead)) {
            $tablesToRead = array($tablesToRead);
        }

        if (!is_array($tablesToWrite)) {
            $tablesToWrite = array($tablesToWrite);
        }

        $lockExprs = array();
        foreach ($tablesToWrite as $table) {
            $lockExprs[] = $table . " WRITE";
        }

        foreach ($tablesToRead as $table) {
            $lockExprs[] = $table . " READ";
        }

        return self::exec("LOCK TABLES " . implode(', ', $lockExprs));
    }
public static function lockTables($tablesToRead, $tablesToWrite = array())
    {
        if (!is_array($tablesToRead)) {
            $tablesToRead = array($tablesToRead);
        }

        if (!is_array($tablesToWrite)) {
            $tablesToWrite = array($tablesToWrite);
        }

        $lockExprs = array();
        foreach ($tablesToWrite as $table) {
            $lockExprs[] = $table . " WRITE";
        }

        foreach ($tablesToRead as $table) {
            $lockExprs[] = $table . " READ";
        }

        return self::exec("LOCK TABLES " . implode(', ', $lockExprs));
    }
public static function lockTables ( $ tablesToRead , $ tablesToWrite = array ( ) ) { if ( ! is_array ( $ tablesToRead ) ) { $ tablesToRead = array ( $ tablesToRead ) ; } if ( ! is_array ( $ tablesToWrite ) ) { $ tablesToWrite = array ( $ tablesToWrite ) ; } $ lockExprs = array ( ) ; foreach ( $ tablesToWrite as $ table ) { $ lockExprs [ ] = $ table . " WRITE" ; } foreach ( $ tablesToRead as $ table ) { $ lockExprs [ ] = $ table . " READ" ; } return self :: exec ( "LOCK TABLES " . implode ( ', ' , $ lockExprs ) ) ; }
Locks the supplied table or tables.

**NOTE:** Piwik does not require the `LOCK TABLES` privilege to be available. Piwik
should still work if it has not been granted.

@param string|array $tablesToRead The table or tables to obtain 'read' locks on. Table names must
be prefixed (see {@link Piwik\Common::prefixTable()}).
@param string|array $tablesToWrite The table or tables to obtain 'write' locks on. Table names must
be prefixed (see {@link Piwik\Common::prefixTable()}).
@return \Zend_Db_Statement
Locks the supplied table or tables .