Get generated queries from CakePHP

Seeing queries generated by your framework can be very useful. CakePHP, with its DebugToolbar, you can see the queries generated by your application. However, There is a limit to the Debug Toolbar. It shows a limited list.

Here’s a sure fire way to get all the queries generated:

$this->Model>getDataSource()->getLog(false, false);

Enjoy!

Continuous Integration with CakePHP

Continuous Integration is probably one the best things since Testing was developed. CakePHP, along with Symfony and Yii, is one of my favorite when it comes to PHP.

I do Continuous Integration with Circle CI . A fantastic service.

machine:
  php:
    version: 5.5.11
dependencies:
  post:
    - pear config-set auto_discover 1
    - pear install pear.phpunit.de/PHPUnit-3.7.32
    - echo "<?php
        class DATABASE_CONFIG {
        public \$test = array(
          'datasource' => 'Database/Mysql',
          'persistent' => false,
          'host' => '127.0.0.1',
          'login' => 'ubuntu',
          'password' => '',
          'database' => 'circle_test',
          'prefix' => ''
        );
        }" > app/Config/database.php
test:
  override:
    - php ./app/Console/cake.php test app AllModel

Notes

For MySQL, Circle CI uses circle_test and ubuntu as a default database and default user, respectively. Circle CI would use PHPUnit with your phpunit.xml if it sees it. However, you can override it like what I did above.

Web Developer Weekly: PHP, Ruby and even Databases

PHP

Ruby

Database

Critical update for bash released today for CentOS

The most recent security vulnerability news is here. Bash can be used by an attacker to launch malicious code on the server. There’s a simple script to know if your server can be exploited.

env X="() { :;} ; echo shellshock" /bin/sh -c "echo completed"
env X="() { :;} ; echo shellshock" `which bash` -c "echo completed"

CentOS has just released it’s security update

Everyone on CentOS should do a simple yum update

Regards!