-
Notifications
You must be signed in to change notification settings - Fork 1k
Developer Guide
This guide is not intended to be documentation; this is a simple overview developers can reference for common tasks and learning the layout of MPOS.
This is written towards developers with a solid understanding of basic php/html/sql and a little smarty/css/js for good measure. If that does not describe you, proceed with caution.
This guide covers
- Development Cycle
- Adding a static page
- Adding a config option (file)
- Version incrementing
Address any complaints, suggestions, fixes, vitriol, or thanks to xisi @ freenode / #mpos
MPOS development cycles are simple:
- Create an issue report
- Create a new branch based on this issue
- Work on a branch solving the issue
- Create a pull request to merge the changes into next
Whenever an issue is worked on, it must be referenced. All pull requests are reviewed for changes and locally tested before acceptance.
There are 2 components needed for a new static page:
-
Template - A smarty template for the page
-
public/templates/mpos/type/[type]/default.tpl
-
Page - A php controller for the page
-
public/include/pages/[type]/page.inc.php
If functionality is added or changed, the related class files must be edited in:
public/include/classes
You'll need to add your class into the classes folder (extends Base)
If your class will need to be used by other classes, you'll want a setX method for the base class, which will attach your instance to another class, so add that.
If your class ends up touching a database table, set the table name correctly so other classes that use it can have the correct table name.
Then you need to include it in the autoloader, which will load your class up every pageload.
And lastly, you need to instantiate the class in the file at the bottom, and attach any other needed instances to it. This is where order of operations comes into play, making sure that your class is loaded at the proper time and has access to the instances you're trying to attach to it.
Add at least one of the following, possibly two:
-
Config option - The config option in your
global.inc.php
and inglobal.inc.dist.php
-
public/include/config/global.inc.php
-
public/include/config/global.inc.dist.php
-
Smarty Globals - If you need to access the config option in a template, you need to add it to the smarty globals
-
public/include/smarty_globals.inc.php
When an update is ready to be pulled, these must be updated before doing so:
-
DB Version
-
DB Version - If a database was updated, update
DB_VERSION
inpublic/include/version.inc.php
-
Update SQL - Create
0XY_whatever_update.sql
and update/insert any changes needed to fix existing installs -
DB Insert SQL -
DB_VERSION = '0.X.Y'
in000_base_structure.sql
- Check the
000_base_structure.sql
to see how this works
- Check the
-
DB Update SQL -
DB_VERSION = '0.X.Y'
in0XY_whatever_update.sql
- Check an existing
0XY_whatever_update.sql
to see how this works
- Check an existing
-
Config Version
-
Config Version - if the config was updated, update
CONFIG_VERSION
inpublic/include/version.inc.php
-
Config Version - if the config was updated, update
-
- installation of Redis requires TCL 8.5 or newer TCL Download Page