Development - GiftFlow/giftflow GitHub Wiki

Contributing

If you would like to contribute ideas, please join the Development mailing list. If you would like to contribute code, and are looking for a place to start check out the TODO list and the Issues page.

Mailing Lists

The GiftFlow Development Google Group is for technical discussions about features and bugs.

The GiftFlow Discuss Google Group is for anyone who wants to talk about making GiftFlow happen. This list is to talk about organizing the community through whatever means possible and is a good place for non-developers to discuss ideas or problems with the website.

Generating test data

If you are not deploying to a production server and would like to generate some fake test data for your database, you can use our Summoner application.

To use the Summoner, enter the 'database/stable/Summoner' directory and edit summon.php and set the totals to what you need. Try to stick to the same relative proportions - no more transactions than goods. Save summon.php and run it in a terminal. It should generate a file called Balrog.sql which can be imported into your existing empty database.

NOTE: The password to all the fake users created by Summoner is 'giftflow'.

Refreshing the database

There is a script for refreshing the database. It clears the database entirely and recreates it from scratch, but it requires that the 'gift' database exists. The script can also populate the database with the test data generated above. To run the script enter the 'database/stable/' directory and run dbRefresh.php. You can feed it the '--fakedata' argument so it will slurp Balrog.sql into your database.

Known bugs

If you are not able to add new locations, your system setup may be affected by PHP Bug 11058. A workaround is to fully stop and start Apache. Restarting the service will not solve the problem.

Debugging

First of all, when developing on your local webserver you might want to set 'display_errors' to 'On' in your php.ini file.

There are several ways to debug the project. To debug the Javascript use Firebug in Firefox, or Chrome's web developer tools. The following are tools for debugging the server side PHP code.

GiftFlow Profiler

GiftFlow comes with the powerful PHP Quick Profiler system built-in. This allows you to:

  1. View log messages
  2. Benchmark the run time of your application
  3. View the SQL queries used to load the current page
  4. Analyze the memory resources used to load the current page

To enable the profiler, log in as an admin user. In the profile dropdown in the top right corner of the screen, a new "Admin Area" option will appear. Go to the Admin Area and click the "Turn Profiler On" button.

CodeIgniter Logging

You can write messages to a server side log file. They are stored in 'system/logs/'. Make sure that directory has write permissions. In 'application/config/config.php' set $config['log_threshold'] to 4. Then you can make calls like the following in your code: log_message('info', 'here is some debug info');

Xdebug

This is a server side PHP debugger which allows you to step through your code. It integrates well with IDEs like Netbeans.

FirePHP

This is Firefox plugin for logging PHP messages to a browser console. To get it to work, install Firebug and FirePHP. Then in your PHP code make a call like so:

$this->load->library('firephp');
$this->firephp->log('here is some debug info');

You should be able to see that info in your Firebug console.