Source of file DummyReadonlyMySQLDatabase.php
Size: 0,595 Bytes - Last Modified: 2021-12-23T10:26:55+00:00
/var/www/docs.ssmods.com/process/src/src/DummyReadonlyMySQLDatabase.php
12345678910111213141516171819202122232425 | <?php namespace Symbiote\TestAssist; use SilverStripe\ORM\Connect\MySQLDatabase; use Exception; /** * Description of DummyReadonlyMySQLDatabase * * @author marcus */ class DummyReadonlyMySQLDatabase extends MySQLDatabase { public $writeQueries = array('insert','update','delete','replace', 'drop', 'create', 'truncate'); public function query($sql, $errorLevel = E_USER_ERROR) { if (in_array(strtolower(substr($sql,0,strpos($sql,' '))), $this->writeQueries)) { throw new Exception("Attempted to write to readonly database"); } return parent::query($sql, $errorLevel); } } |