22 private $baseSourceTitle;
24 public function __construct( Title $baseSourceTitle,
string $logType ) {
25 $this->baseSourceTitle = $baseSourceTitle;
26 $this->logType = $logType;
29 public function logBundleSuccess( User $performer,
string $reason ):
void {
30 $entry = $this->getManualLogEntry( $this->logType,
'deletefok', $performer, $reason );
31 $logid = $entry->insert();
32 $entry->publish( $logid );
35 public function logPageSuccess( User $performer,
string $reason ):
void {
36 $entry = $this->getManualLogEntry( $this->logType,
'deletelok', $performer, $reason );
37 $logid = $entry->insert();
38 $entry->publish( $logid );
41 public function logBundleError( User $performer,
string $reason, Status $error ):
void {
42 $entry = $this->getManualLogEntry( $this->logType,
'deletefnok', $performer, $reason );
43 $this->publishError( $entry, $error );
46 public function logPageError( User $performer,
string $reason, Status $error ):
void {
47 $entry = $this->getManualLogEntry( $this->logType,
'deletelnok', $performer, $reason );
48 $this->publishError( $entry, $error );
51 private function publishError( ManualLogEntry $entry, Status $error ):
void {
52 $entry->setParameters( [
53 'target' => $this->baseSourceTitle->getPrefixedText(),
54 'error' => $error->getErrorsArray(),
56 $logid = $entry->insert();
57 $entry->publish( $logid );
60 private function getManualLogEntry(
61 string $logType,
string $logKey, User $performer,
string $reason
63 $entry =
new ManualLogEntry( $logType, $logKey );
64 $entry->setPerformer( $performer );
65 $entry->setTarget( $this->baseSourceTitle );
66 $entry->setParameters( [
67 'target' => $this->baseSourceTitle->getPrefixedText(),
69 $entry->setComment( $reason );