PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/core/zap/ZoneApply.php

http://zoop.googlecode.com/
PHP | 37 lines | 25 code | 8 blank | 4 comment | 0 complexity | 0e56a92c95d31306c6ee32263df443b5 MD5 | raw file
 1<?php
 2class ZoneApply
 3{
 4	function subMigrations($p, $s)
 5	{
 6		SqlBeginTransaction();
 7		
 8		//	make sure the migrations table exists
 9		Migration::initDB();
10		
11		//	have it scan the migrations directory for all available migrations
12		$versions = Migration::getAllMigrationNames();
13		
14		//	query the db for applied migrations
15		$applied = Migration::getAllAppiedMigrationNames();
16		
17		//	apply anything that hasn't been done yet, in the proper order
18		$unapplied = array_diff($versions, $applied);
19		
20		foreach($unapplied as $key => $needsApplied)
21		{
22			Migration::apply($key, $needsApplied);
23		}
24		
25		SqlCommitTransaction();
26	}
27	
28	function subMigration($p, $s)
29	{
30		$version = $p[3];
31		SqlBeginTransaction();
32		$filename = Migration::filenameFromVersion($version);
33		Migration::apply($filename, $version);
34		SqlCommitTransaction();
35	}
36	
37}