19 private string $logType;
20 private Title $baseSourceTitle;
22 public function __construct( Title $baseSourceTitle,
string $logType ) {
23 $this->baseSourceTitle = $baseSourceTitle;
24 $this->logType = $logType;
27 public function logBundleSuccess( User $performer,
string $reason ):
void {
28 $entry = $this->getManualLogEntry( $this->logType,
'deletefok', $performer, $reason );
29 $logid = $entry->insert();
30 $entry->publish( $logid );
33 public function logPageSuccess( User $performer,
string $reason ):
void {
34 $entry = $this->getManualLogEntry( $this->logType,
'deletelok', $performer, $reason );
35 $logid = $entry->insert();
36 $entry->publish( $logid );
39 public function logBundleError( User $performer,
string $reason, Status $error ):
void {
40 $entry = $this->getManualLogEntry( $this->logType,
'deletefnok', $performer, $reason );
41 $this->publishError( $entry, $error );
44 public function logPageError( User $performer,
string $reason, Status $error ):
void {
45 $entry = $this->getManualLogEntry( $this->logType,
'deletelnok', $performer, $reason );
46 $this->publishError( $entry, $error );
49 private function publishError( ManualLogEntry $entry, Status $error ):
void {
50 $entry->setParameters( [
51 'target' => $this->baseSourceTitle->getPrefixedText(),
52 'error' => $error->getErrorsArray(),
54 $logid = $entry->insert();
55 $entry->publish( $logid );
58 private function getManualLogEntry(
64 $entry =
new ManualLogEntry( $logType, $logKey );
65 $entry->setPerformer( $performer );
66 $entry->setTarget( $this->baseSourceTitle );
67 $entry->setParameters( [
68 'target' => $this->baseSourceTitle->getPrefixedText(),
70 $entry->setComment( $reason );