We're growing into something new. Read More
fstrube

Franklin Strube


<?php 
$installer = $this;
$installer->startSetup();
$installer->run("
    CREATE TABLE `{$installer->getTable('globalthinking_academy/course')}` (
      `course_id` int(11) unsigned NOT NULL auto_increment,
      `store_id` smallint(5) unsigned DEFAULT NULL, /*Note: store_id must allow NULL if we SET NULL on delete */
      
      `course_number` varchar(20) NOT NULL,
      `course_name` text,
      ...
      `status` varchar(20) NOT NULL default 'pending',
      `created_at` timestamp NOT NULL default CURRENT_TIMESTAMP,
      `updated_at` timestamp NOT NULL,
      PRIMARY KEY  (`course_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");

$installer->getConnection()->addKey($installer->getTable('globalthinking_academy/course'),'FK_COURSE_STORE','store_id');
$installer
    ->getConnection()
    ->addConstraint(
        'FK_COURSE_STORE',
        $installer->getTable('globalthinking_academy/course'), 
        'store_id',
        $installer->getTable('core/store'), 
        'store_id',
        'set null', /*Note: store_id column must allow NULL if we SET NULL on delete */
        'cascade'
);

$installer->endSetup();

MySQL Foreign Keys

I was recently working on a project in Magento, and was having problems adding a MySQL table with a foreign key constraint referencing the core_stores table. It turns out that my problem had to do with the NOT NULL attributes of the store_id column and the ON DELETE SET NULL behavior of the foreign key constraint. If the constraint is ON DELETE SET NULL, then your column CANNOT be NOT NULL; otherwise, MySQL will give an error message something like: MySQL Error Nr. 1005 Can't create table ______ (errno: 150)

Discussion

How do you delete a subscriber from a list in Campaign Monitor via API?

I need to remove a subscriber from one list in CM via API, but potentially keep them in other lists. Unfortunately, unsubscribing them will add them to the master supression list, which is not what we want. Through the admin interface you can accomplish this by "deleting" the subscriber, but I can't find a suitable API method for doing this. Does anyone have any idea?

Discussion

Using Suhosin to Secure Your PHP Server

If you are ever working with sensitive user data in PHP sessions (i.e. - SSN, credit cards, etc.), you will not want that information stored in plaintext. Unfortunately, the default session handler in PHP does just that. I ran into this issue on a recent development project for work, which stored SSNs both in a MySQL database as well as in the session. The database was easy to take care of, because the app was written in CakePHP. I simply had to implement the Cryptable behavior on the appropriate models. The session, on the other hand, was a bit more tricky. Unable to find a suitable CakePHP extension to handle encrypted session variables (and coming too close to the launch date for the app to write my own), I found the Suhosin extension for PHP. All I had to do was install it on my server and I was good to go. sudo apt-get install php5-suhosin Not only does Suhosin encrypt the session data out-of-box, it also provides a variety of security enhancements for PHP. This is definitely a must-have on any server that will be dealing with sensitive/secure user data.

Discussion

960 Gridder - Lay out websites with ease.

This useful bookmarklet helps you align your site content to the 960 grid.