Pluf_Migration Class Reference

List of all members.

Public Member Functions

 __construct ($app=null)
 install ()
 unInstall ()
 backup ($path, $name=null)
 restore ($path, $name)
 migrate ($to_version=null)
 installApp ($app, $uninstall=false)
 findMigrations ()
 runMigrations ($migrations)
 runMigration ($migration, $the_way='up')
 setAppVersion ($app, $version)
 delAppInfo ($app)
 getAppVersion ($app)

Public Attributes

 $apps = array()
 $to_version = null
 $dry_run = false
 $display = false

Protected Attributes

 $app = ''


Detailed Description

A class to manage the migration of the code from one version to another, upward or downward.

You can directly use the migrate.php script.

Simple example usage:

 $m = new Pluf_Migration('MyApp');
 $m->migrate();

 // Install the application MyApp
 $m = new Pluf_Migration('MyApp');
 $m->install();
 // Uninstall the application MyApp
 $m->unInstall();

 $m = new Pluf_Migration();
 $m->migrate(); // migrate all the installed app to the newest version.

 $m = new Pluf_Migration();
 $m->migrate(3); // migrate (upgrade or downgrade) to version 3
 

Constructor & Destructor Documentation

Pluf_Migration::__construct ( app = null  ) 

Create a new migration.

Parameters:
mixed Application or array of applications to migrate.


Member Function Documentation

Pluf_Migration::install (  ) 

Install the application.

Basically run the base install function for each application and then set the version to the latest migration.

Pluf_Migration::unInstall (  ) 

Uninstall the application.

Pluf_Migration::backup ( path,
name = null 
)

Backup the application.

Parameters:
string Path to the backup folder
string Backup name (null)

Pluf_Migration::restore ( path,
name 
)

Restore the application.

Parameters:
string Path to the backup folder
string Backup name

Pluf_Migration::migrate ( to_version = null  ) 

Run the migration.

Pluf_Migration::installApp ( app,
uninstall = false 
)

Un/Install the given application.

Parameters:
string Application to install.
bool Uninstall (false)

Pluf_Migration::findMigrations (  ) 

Find the migrations for the current app.

Returns:
array Migrations names indexed by order.

Pluf_Migration::runMigrations ( migrations  ) 

Run the migrations.

From an array of possible migrations, it will first get the current version of the app and then based on $this->to_version will run the migrations in the right order or do nothing if nothing to be done.

Parameters:
array Possible migrations.

Pluf_Migration::runMigration ( migration,
the_way = 'up' 
)

Run the given migration.

Pluf_Migration::setAppVersion ( app,
version 
)

Set the application version.

Parameters:
string Application
int Version
Returns:
true

Pluf_Migration::delAppInfo ( app  ) 

Remove the application information.

Parameters:
string Application
Returns:
true

Pluf_Migration::getAppVersion ( app  ) 

Get the current version of the app.

Parameters:
string Application.
Returns:
int Version.


Member Data Documentation

Pluf_Migration::$app = '' [protected]

Application beeing migrated.

Pluf_Migration::$apps = array()

Applications which are going to be migrated.

Pluf_Migration::$to_version = null

Target version for the migration.

Pluf_Migration::$dry_run = false

Set to true to not act.

Pluf_Migration::$display = false

Display on the console what is done.


The documentation for this class was generated from the following file:

Generated on Wed Feb 3 15:44:52 2010 for Pluf by  doxygen