Doctrine 1.x log all queries

To log all queries we need to use Event Listeners class QueryDebuggerListener extends Doctrine_EventListener { public function preStmtExecute(Doctrine_Event $event) { $q = $event->getQuery(); $params = $event->getParams(); while (sizeof($params) > 0) { $param = array_shift($params); if (!is_numeric($param)) { $param = sprintf(“‘%s'”, $param); } $q = substr_replace($q, $param, strpos($q, ‘?’), 1); } error_log($q); } } $queryDbg =Continue reading “Doctrine 1.x log all queries”

Restore #AWS RDS instance from a database snapshot by using AWS CLI

The AWS Command Line Interface is a unified tool to manage your AWS services. I am using AWS RDS PostgreSQL for my application. I don’t need to run this application 24/7/365. So I have the ability to stop periodically my instances to save some money in my pocket. Nobody wants to do repeated tasks manually.Continue reading “Restore #AWS RDS instance from a database snapshot by using AWS CLI”