====== Step by step example ====== Below are a few tips if you want to maintain or create packages for an existing PHP applications. We are going to package the excellent wwwSQLDesigner Application package from Ondřej Žára. Since the Radria packaging system is a One click install, you need to setup everything so the application is fully usable once it is installed. This means setting up the database configuration, the file path, default admin user. ===== Setting up the application ===== ==== Project Setup ==== Lets start by creating a new project: * Project name: sqldesignerPkg * Database name: sqlddatabase * Database login: sqldlogin * Database password: sqldpassword The SiteManager creates the project tree and the database. In the radria folder there is now a new sqldesignerPkg/ folder. Then we download at http://ondras.zarovi.cz/sql/ the latest version of wwwSQLDesigner. And unzip it under a subfolder in our new project. radria/sqldesignerPkg/sqldesigner ==== Database Setup ==== We setup the mysql connection database in radria/sqldesignerPkg/sqldesigner/io.php define('SERVER','localhost'); define('USER','sqldlogin'); define('PASSWORD','sqldpassword'); define('DB','sqlddatabase'); define('TABLE','wwwsqldesigner'); $conn = mysql_connect(SERVER,USER,PASSWORD); mysql_select_db(DB); In most PHP application the database configuration is in a config.php or db.inc.php files. And execute the sql statement from radria/sqldesignerPkg/sqldesigner/mysql.sql DROP TABLE IF EXISTS `wwwsqldesigner`; CREATE TABLE `wwwsqldesigner` ( `keyword` varchar(20) NOT NULL default '', `data` mediumtext NOT NULL, `dt` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`keyword`) ); in our sqldesignerdbx database, can use the phpMyAdmin or WebIDE to do this. ==== Testing ==== We need to test our work to see if the application is working properly. http://localhost/radria/sqldesignerPkg/sqldesigner/ ==== Documentation ==== Next we add some documentation in the /docs/ folder we create a sqldesigner sub folder. radria/sqldesignerPkg/docs/sqldesigner We add in it an index.html file with some documentation and instruction on how to use the application. ===== Creating the Package ===== ==== Requirements ==== To create the package we will use the Package Builder its a step-by-step wizard that automates most of the work. Add the package builder to your project. With the SiteManager in the **package** list in the **tools** section install the following packages: contentadmin package_builder ==== Step by Step Wizard ==== Now in the SiteManager Tools list you have the **Package Builder** open it. It will ask you for a password, it's the same as the database Username: sqldlogin Password: sqldpassword === Package information === The first form on the wizard is the package information. * Package name: **sqldesigner_1.3.3** * Package version: **0.2** * Description: Web based database structure designer Important: in the package name we add the version of the application separated with a **_**. === Selecting the files === The next screen lists all the files in your project. Check the box on the left of each file under the sqldesigner folder and in the docs/sqldesigner === Selecting Table === This screen displays all the tables available in the database with the option to add them in the package with or without data. Select the wwwsqldesigner table and check **Store only structure** === Auto Install Parameters === This last screen contains all the parameters needed to enable an auto installation. For more detailed information on what each field means take a look at [[how_to_package_application_and_libraries]] In the **Install Commands** replace sqldesigner/io.php sqlddatabase [database] replace sqldesigner/io.php sqldlogin [user_username] replace sqldesigner/io.php sqldpassword [user_password] In the **PHP files to uploads** none It's a tools for development only, we don't want it to be published on the live / production application. In the **HTML file to upload** none This would not even work in an HTML only web server. In the **application starting url** sqldesigner/index.php In the **Application starting link label** SQL Designer This will enable the link in the SiteManager Tools list.