// Get params for this operation
$params = $operation;
// Append the FileOp class
- $performOps[] = new $class( $this, $params );
+ $performOps[] = new $class( $this, $params, $this->logger );
} else {
throw new FileBackendError( "Operation '$opName' is not supported." );
}
* @ingroup FileBackend
* @author Aaron Schulz
*/
+use Psr\Log\LoggerInterface;
/**
* FileBackend helper class for representing operations.
/** @var FileBackendStore */
protected $backend;
+ /** @var LoggerInterface */
+ protected $logger;
/** @var int */
protected $state = self::STATE_NEW;
*
* @param FileBackendStore $backend
* @param array $params
+ * @param LoggerInterface $logger PSR logger instance
* @throws FileBackendError
*/
- final public function __construct( FileBackendStore $backend, array $params ) {
+ final public function __construct(
+ FileBackendStore $backend, array $params, LoggerInterface $logger
+ ) {
$this->backend = $backend;
+ $this->logger = $logger;
list( $required, $optional, $paths ) = $this->allowedParams();
foreach ( $required as $name ) {
if ( isset( $params[$name] ) ) {
$params = $this->params;
$params['failedAction'] = $action;
try {
- wfDebugLog( 'FileOperation', get_class( $this ) .
+ $this->logger->error( get_class( $this ) .
" failed (batch #{$this->batchId}): " . FormatJson::encode( $params ) );
} catch ( Exception $e ) {
// bad config? debug log error?