PluginProbe
ShiftController Employee Shift Scheduling / 4.9.65
ShiftController Employee Shift Scheduling v4.9.65
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
shiftcontroller / hc3 / migrationservice.php

migrationservice.php in ShiftController Employee Shift Scheduling 4.9.65, at hc3/migrationservice.php

52 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
2 class HC3_MigrationService
3 {
4 public $settings;
5 public $dbForge;
6
7 public function __construct(
8 HC3_Settings $settings,
9 HC3_Database_DbForge $dbForge = NULL
10 )
11 {
12 $this->settings = $settings;
13 $this->dbForge = $dbForge;
14 }
15
16 public function getVersion( $moduleName )
17 {
18 $confName = 'migration_' . $moduleName;
19 $return = $this->settings->get( $confName );
20 if( ! $return ){
21 $return = 0;
22 }
23 return $return;
24 }
25
26 public function saveVersion( $moduleName, $version )
27 {
28 $return = TRUE;
29 $confName = 'migration_' . $moduleName;
30 $this->settings->set( $confName, $version );
31 return $return;
32 }
33
34
35 protected function _up( $versions, $moduleName )
36 {
37 $confName = 'migration_' . $moduleName;
38
39 $installedVersion = $this->settings->get( $confName );
40 if( ! $installedVersion ){
41 $installedVersion = 0;
42 }
43
44 foreach( $versions as $v => $callable ){
45 if( $v <= $installedVersion ){
46 continue;
47 }
48 call_user_func( $callable );
49 $this->settings->set( $confName, $v );
50 }
51 }
52 }