diff --git a/SpecialContentStaging.php b/SpecialContentStaging.php
index d5caba6..029b91e 100644
--- a/SpecialContentStaging.php
+++ b/SpecialContentStaging.php
@@ -29,18 +29,17 @@ function execute( $par ) {
$target = $request->getText( 'target' );
$showArchived = $request->getBool( 'showArchived' );
- $baseUrl = "?title=Special:ContentStaging";
- $baseUrl .= $showArchived ? "&showArchived=1" : "";
-
+ $baseUrl = '?title=Special:ContentStaging';
+ $baseUrl .= $showArchived ? '&showArchived=1' : '';
if ( !empty( $this->pagePrefix ) ) {
- if ( $action === "copy" ) {
+ if ( $action === 'copy' ) {
$this->copyPage( $this->pagePrefix, $page, $source, $target );
}
- if ( $action === "archive" ) {
+ if ( $action === 'archive' ) {
$this->archivePage( $page );
}
- if ( $action === "recover" ) {
+ if ( $action === 'recover' ) {
$this->recoverPage( $page );
}
@@ -87,15 +86,15 @@ function execute( $par ) {
$currPage = $stages[$stage];
$pageNextStage = $stages[$target];
- $stagingStatus = "✓";
+ $stagingStatus = '✓';
if( get_class( $currPage ) !== 'WikiPage' ) {
- $stagingStatus = "";
- } elseif ( $stage !== "production" && ( get_class( $pageNextStage ) !== 'WikiPage' || $this->replaceStageInternalRefs( $this->pagePrefix, $currPage->getText(), $source, $target ) !== $pageNextStage->getText() ) ) {
- $stagingStatus = "getId() .
- "&source=" . $source .
- "&target=" . $target . "\" style=\"color: red;\">✗";
+ $stagingStatus = '';
+ } elseif ( $stage !== 'production' && ( get_class( $pageNextStage ) !== 'WikiPage' || $this->replaceStageInternalRefs( $this->pagePrefix, $currPage->getText(), $source, $target ) !== $pageNextStage->getText() ) ) {
+ $stagingStatus = '✗';
}
$resultTable .= "| style='text-align: center;' | " . $stagingStatus . "\n";
} else {
@@ -104,13 +103,13 @@ function execute( $par ) {
}
if ( !$showArchived ) {
- $archiveOption = "🗀";
+ $archiveOption = '🗀';
} else {
- $archiveOption = "🗁";
+ $archiveOption = '🗁';
}
$resultTable .= "| style='text-align: center;' | " . $archiveOption . "\n";
@@ -118,9 +117,9 @@ function execute( $par ) {
$resultTable .= "|}\n";
if ( !$showArchived ) {
- $archiveLink = "🗀 View Archive";
+ $archiveLink = '🗀 View Archive';
} else {
- $archiveLink = "🗁 View List";
+ $archiveLink = '🗁 View List';
}
$output->addWikiText( $archiveLink . "\n" . $resultTable );
@@ -130,9 +129,9 @@ function execute( $par ) {
function getPagesByStage( $prefix, $stage = "" ) {
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select(
- array( "page" ),
- array( "page_id", "page_title", "page_namespace" ),
- array( "page_namespace = " . $this->mwNamespaceIndex, "page_title LIKE '" . $prefix . "/" . $stage . "%'" )
+ array( 'page' ),
+ array( 'page_id', 'page_title', 'page_namespace' ),
+ array( 'page_namespace = ' . $this->mwNamespaceIndex, 'page_title LIKE "' . $prefix . '/' . $stage . '%"' )
);
return $res;
@@ -141,30 +140,30 @@ function getPagesByStage( $prefix, $stage = "" ) {
function getPagesByPrefix( $prefix ) {
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select(
- array( "page" ),
- array( "page_id", "page_title", "page_namespace" ),
- array( "page_namespace = " . $this->mwNamespaceIndex, "page_title LIKE '" . $prefix . "%'" )
+ array( 'page' ),
+ array( 'page_id', 'page_title', 'page_namespace' ),
+ array( 'page_namespace = ' . $this->mwNamespaceIndex, 'page_title LIKE "' . $prefix . '%"' )
);
return $res;
}
function replaceGeneralPrefix( $title, $prefix ) {
- return str_replace( $prefix . "/", "", $title );
+ return str_replace( $prefix . '/', '', $title );
}
function getTitleWithoutPrefixes( $fullTitle ) {
- $arrTitle = explode( "/", $fullTitle, 3 );
+ $arrTitle = explode( '/', $fullTitle, 3 );
return $arrTitle[sizeof( $arrTitle ) - 1];
}
function getStage( $fullTitle ) {
- $arrTitle = explode( "/", $fullTitle, 3 );
- return sizeof( $arrTitle ) > 2 ? $arrTitle[sizeof( $arrTitle ) - 2] : "unstaged";
+ $arrTitle = explode( '/', $fullTitle, 3 );
+ return sizeof( $arrTitle ) > 2 ? $arrTitle[sizeof( $arrTitle ) - 2] : 'unstaged';
}
function replaceStageInternalRefs( $prefix, $page, $source, $target ) {
- return str_replace( $prefix . "/" . $source, $prefix . "/" . $target, $page );
+ return str_replace( $prefix . '/' . $source, $prefix . '/' . $target, $page );
}
function copyPage( $prefix, $page, $source, $target ) {
@@ -174,17 +173,17 @@ function copyPage( $prefix, $page, $source, $target ) {
$objSrc = $page;
}
$titleSrc = $objSrc->getTitle()->mTextform;
- if( $source === "" ) {
- $titleTarget = $this->mwNamespace . str_replace( $prefix . "/", $prefix . "/" . $target . "/", $titleSrc );
+ if( $source === '' ) {
+ $titleTarget = $this->mwNamespace . str_replace( $prefix . '/', $prefix . '/' . $target . '/', $titleSrc );
} else {
- $titleTarget = $this->mwNamespace . str_replace( $prefix . "/" . $source, $prefix . "/" . $target, $titleSrc );
+ $titleTarget = $this->mwNamespace . str_replace( $prefix . '/' . $source, $prefix . '/' . $target, $titleSrc );
}
$pageContent = $objSrc->getContent()->getNativeData();
$pageContent = $this->replaceStageInternalRefs( $prefix, $pageContent, $source, $target );
$objTarget = WikiPage::factory ( Title::newFromText( $titleTarget ) );
- $objTarget->doEditContent( new WikitextContent( $pageContent ), "Staging content from " . $source . " to " . $target );
+ $objTarget->doEditContent( new WikitextContent( $pageContent ), 'Staging content from ' . $source . ' to ' . $target );
return $objTarget;
}