Index: trunk/phase3/includes/db/Database.php |
— | — | @@ -3151,13 +3151,13 @@ |
3152 | 3152 | * @param $lineCallback Callback: Optional function called before reading each line |
3153 | 3153 | * @param $resultCallback Callback: Optional function called for each MySQL result |
3154 | 3154 | * @param $fname String: Calling function name |
| 3155 | + * @param $inputCallback Callback: Optional function called for each complete line (ended with ;) sent |
3155 | 3156 | * @return bool|string |
3156 | 3157 | */ |
3157 | 3158 | function sourceStream( $fp, $lineCallback = false, $resultCallback = false, |
3158 | | - $fname = 'DatabaseBase::sourceStream' ) |
| 3159 | + $fname = 'DatabaseBase::sourceStream', $inputCallback = false ) |
3159 | 3160 | { |
3160 | 3161 | $cmd = ''; |
3161 | | - $done = false; |
3162 | 3162 | |
3163 | 3163 | while ( !feof( $fp ) ) { |
3164 | 3164 | if ( $lineCallback ) { |
— | — | @@ -3184,6 +3184,9 @@ |
3185 | 3185 | |
3186 | 3186 | if ( $done || feof( $fp ) ) { |
3187 | 3187 | $cmd = $this->replaceVars( $cmd ); |
| 3188 | + if ( $inputCallback ) { |
| 3189 | + call_user_func( $resultCallback, $cmd ); |
| 3190 | + } |
3188 | 3191 | $res = $this->query( $cmd, $fname ); |
3189 | 3192 | |
3190 | 3193 | if ( $resultCallback ) { |
— | — | @@ -3196,7 +3199,6 @@ |
3197 | 3200 | } |
3198 | 3201 | |
3199 | 3202 | $cmd = ''; |
3200 | | - $done = false; |
3201 | 3203 | } |
3202 | 3204 | } |
3203 | 3205 | |