The project control panel
Overview
The Command Line Interface provides useful commands to execute the usual tasks of an application development. However, symfony comes bundled with a web control panel for your projects, enabling you to achieve the same tasks as with the CLI from a web browser.
Installation
The project control panel is not installed by default in a project, but as it consists of a single file, it's pretty easy to add it to each project where you need it.
Locate the file called sf_control_panel.php in $pear_data_dir/symfony/web/ and copy it to your project web/ folder. That's it.
To test the control panel, just browse this script using your favorite web browser. As it's in the root web folder, it should be accessible with:
http://myapp.example.com/sf_control_panel.php

Note: The execution of this script is restricted to the localhost for safety reasons. If the page returned is blank, it might be because you are calling a distant server. You can force the script to run in a distant server by removing lines 11 to 15, but beware of the security risks (see Security below).
Features
Tasks and batch

The control panel gives a web access to the usual CLI tasks for your application. You can easily clear the cache (for all the applications or selectively), rebuild the model or the database itself.
When you click on one of the task links (the bold links), the page displays again with a report of the task action. You can close the report at any time to keep on using the control panel.
The batch scripts located in the project batch/ folder are also detected and can be executed from the control panel by a simple click.
Note: Some of the symfony tasks can take some time to execute, according to the size of your project. If your web server has a small timeout configuration, you might end up with unfinished tasks. Increase your web server timeout to avoid these problems.
Browsing the project
The control panel automatically detects the applications and their environments. It provides links to browse each application in all the available environments.
Parsing the project

All the PHP, XML and YML files of your project can be parsed from within the control panel. It displays the project structure by separating the applications and the model.
For a given application, the list of existing modules is displayed. If you click on a module name, it reveals its structure and allows you to browse its actions, templates and configuration.
The source code is displayed with syntax highlighting, as long as you configured PHP with the appropriate option.
It can be very handy to check your data schema, the available methods of the model or the libraries included in your lib/ folders.
Security
The script is configured to work only when called on localhost to avoid that if it accidentally gets transferred to production, nobody can access it and execute symfony tasks on your project.
This also means that you should exclude this file from your transfers to production. If you use the symfony sync task, this is done by adding the script to the config/rsync_exclude.txt file:
stats
.svn
web/uploads
cache
log
web/sf_control_panel.php
The script can execute symfony commands, and since those commands deal with the file system (creating, modifying and removing files), they may not work if the permissions given to your web server don't allow it. If the cache clearing commands should always work (simply because the cache files are created by your web server), the ones to init a module, a scaffolding or an administration will work only if your web server has write permissions to the apps/ folder. This can be acceptable in a development environment, but it is extremely inadvisable for a production server. So once again, do not use this control panel in the server used in production.
|