Changeset 6328 for trunk/prototype
- Timestamp:
- 05/28/12 17:34:40 (12 years ago)
- Location:
- trunk/prototype
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/Sync.php
r6111 r6328 8 8 9 9 if(!function_exists('parseURI')) 10 { 10 { 11 11 function parseURI( $URI ) 12 12 { … … 24 24 25 25 if(!function_exists('formatURI')) 26 { 26 { 27 27 function formatURI( $concept = false, $id = false, $service = false ) 28 28 { … … 61 61 62 62 if(!function_exists('prepare')) 63 { 63 { 64 64 function prepare( $concept, $id, $dt, &$data, &$oldIds, &$mounted, &$synced ) 65 65 { … … 123 123 $args = array( $args ); 124 124 125 Controller::addFallbackHandler( 0, function($e){ throw $e; } ); 125 Controller::addFallbackHandler( 0, function($e, $URI){ 126 127 throw new Exception( $e->getMessage(), 100, $e ); 128 129 } ); 130 131 Controller::addFallbackHandler( 100, function( $e, $URI ){ 132 133 Controller::rollback( $URI ); 134 throw $e; 135 136 }); 126 137 127 138 foreach( $args as $i => $data ) … … 161 172 if( !isset($tx['order']) ) 162 173 continue; 163 174 164 175 $oldId = $oldIds[ $tx['order'] ]; 165 176 … … 173 184 unset( $data[$oldURI] ); 174 185 175 $return[ $oldURI ] = !$tx['rollback'] ? $dt ? 186 $return[ $oldURI ] = !$tx['rollback'] ? $dt ? 176 187 array( 'id' => $tx['id'] ) : false : 'ROLLBACK'; 177 188 } … … 182 193 } 183 194 195 184 196 echo json_encode( $return ); 185 197 186 198 Controller::closeAll(); 187 199 188 200 // ob_start(); 189 201 // print "\n"; -
trunk/prototype/api/controller.php
r6132 r6328 180 180 public static function rollback( $URI, $criteria = false ) 181 181 { 182 if( isset( $URI['service'] ) ) 183 unset( self::$tx[ $URI['service'] ] ); 184 185 self::$txID--; 186 182 187 return self::call( 'rollback', $URI, false, $criteria ); 183 188 } … … 635 640 catch( Exception $e ) 636 641 { 637 if( !self::fallback( $e ) )642 if( !self::fallback( $e, $URI ) ) 638 643 self::closeAll(); 639 644 … … 644 649 } 645 650 646 public static function fallback( $exception )651 public static function fallback( $exception, $URI ) 647 652 { 648 653 $code = $exception->getCode(); … … 651 656 { 652 657 $fn = self::$fallbackHandlers[ $code ]; 653 return $fn( $exception );658 return $fn( $exception, $URI ); 654 659 } 655 660 … … 762 767 catch( Exception $e ) 763 768 { 764 if( !self::fallback( $e ) )769 if( !self::fallback( $e, $URI ) ) 765 770 self::closeAll(); 766 771
Note: See TracChangeset
for help on using the changeset viewer.