Skip to content
Browse files

make operation backend interaction through inheritance

  • Loading branch information...
1 parent db6c81d commit 8701a650f0545e86e2317a7ac449cbb1c6dbdd1e @marvil07 committed
Showing with 21 additions and 14 deletions.
  1. +21 −14 includes/VersioncontrolOperation.php
View
35 includes/VersioncontrolOperation.php
@@ -547,7 +547,7 @@ public function updateLabels($labels) {
* versioncontrol_get_operations() and versioncontrol_get_operation_items().)
* In case of an error, NULL is returned instead of the operation array.
*/
- public function insert(&$operation_items) {
+ public final function insert(&$operation_items) {
$this->_fill(TRUE);
if (!isset($this->repository)) {
@@ -627,11 +627,8 @@ public function insert(&$operation_items) {
}
// Notify the backend first.
- if (versioncontrol_backend_implements($vcs, 'operation')) {
- _versioncontrol_call_backend($vcs, 'operation', array(
- 'insert', $this, $operation_items
- ));
- }
+ $this->_insert($operation_items);
+
// Everything's done, let the world know about it!
module_invoke_all('versioncontrol_operation',
'insert', $this, $operation_items
@@ -659,6 +656,14 @@ public function insert(&$operation_items) {
return $this;
}
+ /**
+ * Let child backend repo classes add information that _is not_ in
+ * VersioncontrolRepository::data without modifying general flow if
+ * necessary.
+ */
+ protected function _insert($operation_items) {
+ }
+
/**
* Delete a commit, a branch operation or a tag operation from the database,
* and call the necessary hooks.
@@ -667,7 +672,7 @@ public function insert(&$operation_items) {
* The commit, branch operation or tag operation array containing
* the operation that should be deleted.
*/
- public function delete() {
+ public final function delete() {
$operation_items = $this->getItems();
// As versioncontrol_update_operation_labels() provides an update hook for
@@ -680,14 +685,8 @@ public function delete() {
module_invoke_all('versioncontrol_operation',
'delete', $this, $operation_items);
- $vcs = $this->repository->vcs;
-
// Provide an opportunity for the backend to delete its own stuff.
- if (versioncontrol_backend_implements($vcs, 'operation')) {
- _versioncontrol_call_backend($vcs, 'operation', array(
- 'delete', $this, $operation_items
- ));
- }
+ $this->_delete($operation_items);
db_query('DELETE FROM {versioncontrol_operation_labels}
WHERE vc_op_id = %d', $this->vc_op_id);
@@ -697,6 +696,14 @@ public function delete() {
WHERE vc_op_id = %d', $this->vc_op_id);
}
+ /**
+ * Let child backend repo classes add information that _is not_ in
+ * VersioncontrolRepository::data without modifying general flow if
+ * necessary.
+ */
+ protected function _delete($operation_items) {
+ }
+
/**
* Assemble a list of query constraints from the given @p $constraints and
* @p $tables arrays. Both of these are likely to be altered to match the

0 comments on commit 8701a65

Please sign in to comment.
Something went wrong with that request. Please try again.