summaryrefslogtreecommitdiff
path: root/includes/logging/LogEntry.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-12-17 09:15:42 +0100
committerPierre Schmitz <pierre@archlinux.de>2015-12-17 09:44:51 +0100
commita1789ddde42033f1b05cc4929491214ee6e79383 (patch)
tree63615735c4ddffaaabf2428946bb26f90899f7bf /includes/logging/LogEntry.php
parent9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff)
Update to MediaWiki 1.26.0
Diffstat (limited to 'includes/logging/LogEntry.php')
-rw-r--r--includes/logging/LogEntry.php34
1 files changed, 28 insertions, 6 deletions
diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php
index 66c2bde1..8427adbb 100644
--- a/includes/logging/LogEntry.php
+++ b/includes/logging/LogEntry.php
@@ -115,6 +115,28 @@ abstract class LogEntryBase implements LogEntry {
public function isLegacy() {
return false;
}
+
+ /**
+ * Create a blob from a parameter array
+ *
+ * @param array $params
+ * @return string
+ * @since 1.26
+ */
+ public static function makeParamBlob( $params ) {
+ return serialize( (array)$params );
+ }
+
+ /**
+ * Extract a parameter array from a blob
+ *
+ * @param string $blob
+ * @return array
+ * @since 1.26
+ */
+ public static function extractParams( $blob ) {
+ return unserialize( $blob );
+ }
}
/**
@@ -224,14 +246,14 @@ class DatabaseLogEntry extends LogEntryBase {
public function getParameters() {
if ( !isset( $this->params ) ) {
$blob = $this->getRawParameters();
- wfSuppressWarnings();
- $params = unserialize( $blob );
- wfRestoreWarnings();
+ MediaWiki\suppressWarnings();
+ $params = LogEntryBase::extractParams( $blob );
+ MediaWiki\restoreWarnings();
if ( $params !== false ) {
$this->params = $params;
$this->legacy = false;
} else {
- $this->params = $blob === '' ? array() : explode( "\n", $blob );
+ $this->params = LogPage::extractParams( $blob );
$this->legacy = true;
}
}
@@ -516,7 +538,7 @@ class ManualLogEntry extends LogEntryBase {
'log_title' => $this->getTarget()->getDBkey(),
'log_page' => $this->getTarget()->getArticleID(),
'log_comment' => $comment,
- 'log_params' => serialize( (array)$this->getParameters() ),
+ 'log_params' => LogEntryBase::makeParamBlob( $this->getParameters() ),
);
if ( isset( $this->deleted ) ) {
$data['log_deleted'] = $this->deleted;
@@ -584,7 +606,7 @@ class ManualLogEntry extends LogEntryBase {
$this->getSubtype(),
$this->getTarget(),
$this->getComment(),
- serialize( (array)$this->getParameters() ),
+ LogEntryBase::makeParamBlob( $this->getParameters() ),
$newId,
$formatter->getIRCActionComment() // Used for IRC feeds
);