File tree 3 files changed +16
-29
lines changed
3 files changed +16
-29
lines changed Original file line number Diff line number Diff line change @@ -95,18 +95,11 @@ public function apply()
95
95
return false ;
96
96
}
97
97
98
- try {
99
-
100
- $ env = new DbPatch_Command_Patch_PHP_Environment ();
101
- $ env ->setDb ($ this ->getDb ()->getAdapter ())
102
- ->setWriter ($ this ->getWriter ())
103
- ->setConfig ($ this ->getConfig ())
104
- ->install ($ phpFile );
105
-
106
- } catch (Exception $ e ) {
107
- $ this ->getWriter ()->line (sprintf ('error php patch: %s ' , $ e ->getMessage ()));
108
- return false ;
109
- }
98
+ $ env = new DbPatch_Command_Patch_PHP_Environment ();
99
+ $ env ->setDb ($ this ->getDb ()->getAdapter ())
100
+ ->setWriter ($ this ->getWriter ())
101
+ ->setConfig ($ this ->getConfig ())
102
+ ->install ($ phpFile );
110
103
111
104
return true ;
112
105
}
Original file line number Diff line number Diff line change @@ -92,17 +92,12 @@ public function apply()
92
92
return false ;
93
93
}
94
94
95
- try {
96
- $ db = $ this ->getDb ();
97
- $ db ->import ($ this ->data ['filename ' ]);
95
+ $ db = $ this ->getDb ();
96
+ $ db ->import ($ this ->data ['filename ' ]);
98
97
99
- // SQLite needs a reconnect after changing scheme
100
- $ this ->fixSqliteSchemaChangedBug ();
98
+ // SQLite needs a reconnect after changing scheme
99
+ $ this ->fixSqliteSchemaChangedBug ();
101
100
102
- } catch (Exception $ e ) {
103
- $ this ->writer ->error ($ e ->getMessage ());
104
- return false ;
105
- }
106
101
return true ;
107
102
}
108
103
Original file line number Diff line number Diff line change @@ -107,14 +107,14 @@ public function execute()
107
107
foreach ($ patchFiles as $ patchNr => $ patchFile )
108
108
{
109
109
if (($ patchFile ->patch_number <> $ latestPatchNumber + 1 ) && !$ force ) {
110
- $ this ->writer ->error (
111
- sprintf ('expected patch number %d instead of %d (%s). Use --force to override this check. ' ,
112
- $ latestPatchNumber + 1 ,
113
- $ patchFile ->patch_number ,
114
- $ patchFile ->basename
110
+ throw new DbPatch_Exception (
111
+ sprintf (
112
+ 'expected patch number %d instead of %d (%s). Use --force to override this check. ' ,
113
+ $ latestPatchNumber + 1 ,
114
+ $ patchFile ->patch_number ,
115
+ $ patchFile ->basename
115
116
)
116
117
);
117
- return ;
118
118
}
119
119
120
120
if (in_array ($ patchNr , $ patchNumbersToSkip )) {
@@ -130,12 +130,11 @@ public function execute()
130
130
->apply ();
131
131
132
132
if (!$ result ) {
133
- return ;
133
+ throw new DbPatch_Exception ( sprintf ( ' Running patch %d failed! ' , $ patchNr )) ;
134
134
}
135
135
136
136
$ this ->addToChangelog ($ patchFile );
137
137
$ latestPatchNumber = $ patchFile ->patch_number ;
138
-
139
138
}
140
139
}
141
140
You can’t perform that action at this time.
0 commit comments