Adding base abstract class to set future patch classes.

This commit is contained in:
ralpheav
2013-06-05 16:23:39 -04:00
parent 9a50ee4971
commit 68b0fff2c6
2 changed files with 12 additions and 9 deletions

View File

@@ -10,16 +10,21 @@ G::LoadClass("System");
* *
*/ */
class patch abstract class patch
{
static protected $isPathchable = false;
abstract static public function isApplicable();
abstract static public function execute();
}
class p11835 extends patch
{ {
static private $isPathchable = false;
/* /*
* Note.- Use before upgrade DB. * Note.- Use before upgrade DB.
* Check if the table TASK has the field TAS_GROUP_VARIABLE * Check if the table TASK has the field TAS_GROUP_VARIABLE
* @return boolean * @return boolean
*/ */
static public function is_11835Applicable() static public function isApplicable()
{ {
patch::$isPathchable = false; patch::$isPathchable = false;
$con = Propel::getConnection("workflow"); $con = Propel::getConnection("workflow");
@@ -30,7 +35,6 @@ class patch
if ($row ['Field'] == "TAS_GROUP_VARIABLE") { if ($row ['Field'] == "TAS_GROUP_VARIABLE") {
$version = System::getVersion (); $version = System::getVersion ();
$version = explode('-',$version); $version = explode('-',$version);
//$pos = strpos($version,'2.5.1-testing');
if ($version[0] == '2.5.1') { if ($version[0] == '2.5.1') {
echo "Version " . $version[0] . " Patch\n"; echo "Version " . $version[0] . " Patch\n";
patch::$isPathchable = true; patch::$isPathchable = true;
@@ -48,7 +52,7 @@ class patch
* if the current task has asignated users, means SELF_SERVICE only, * if the current task has asignated users, means SELF_SERVICE only,
* otherwise leave TAS_GROUP_VARIABLE as it is. * otherwise leave TAS_GROUP_VARIABLE as it is.
*/ */
static public function execute_11835() static public function execute()
{ {
//Check if this is the version to apply the patch //Check if this is the version to apply the patch
$count = 0; $count = 0;
@@ -80,4 +84,3 @@ class patch
} }
} }

View File

@@ -602,11 +602,11 @@ class workspaceTools
{ {
G::LoadClass("patch"); G::LoadClass("patch");
$this->initPropel( true ); $this->initPropel( true );
patch::is_11835Applicable(); p11835::isApplicable();
$systemSchema = System::getSystemSchema(); $systemSchema = System::getSystemSchema();
$this->upgradeSchema( $systemSchema ); $this->upgradeSchema( $systemSchema );
$this->upgradeData(); $this->upgradeData();
patch::execute_11835(); p11835::execute();
return true; return true;
} }