diff --git a/code/Controllers/CMSPageHistoryController.php b/code/Controllers/CMSPageHistoryController.php index 923c192c..eba00f31 100644 --- a/code/Controllers/CMSPageHistoryController.php +++ b/code/Controllers/CMSPageHistoryController.php @@ -396,11 +396,11 @@ class CMSPageHistoryController extends CMSMain $toVersionRecord = Versioned::get_version(SiteTree::class, $id, $toVersion); if (!$fromVersionRecord) { - user_error("Can't find version $fromVersion of page $id", E_USER_ERROR); + throw new \Exception("Can't find version $fromVersion of page $id"); } if (!$toVersionRecord) { - user_error("Can't find version $toVersion of page $id", E_USER_ERROR); + throw new \Exception("Can't find version $toVersion of page $id"); } if (!$record) { diff --git a/code/Tasks/RemoveOrphanedPagesTask.php b/code/Tasks/RemoveOrphanedPagesTask.php index 2c19e02e..c422e747 100644 --- a/code/Tasks/RemoveOrphanedPagesTask.php +++ b/code/Tasks/RemoveOrphanedPagesTask.php @@ -96,7 +96,7 @@ in the other stage:
$fields->push(new HeaderField( 'Header', - _t('SilverStripe\\CMS\\Tasks\\RemoveOrphanedPagesTask.HEADER', 'Remove all orphaned pages task') + _t(__CLASS__ . '.HEADER', 'Remove all orphaned pages task') )); $fields->push(new LiteralField( 'Description', @@ -134,14 +134,14 @@ in the other stage:
'SelectAllLiteral', sprintf( '

%s ', - _t('SilverStripe\\CMS\\Tasks\\RemoveOrphanedPagesTask.SELECTALL', 'select all') + _t(__CLASS__ . '.SELECTALL', 'select all') ) )); $fields->push(new LiteralField( 'UnselectAllLiteral', sprintf( '%s

', - _t('SilverStripe\\CMS\\Tasks\\RemoveOrphanedPagesTask.UNSELECTALL', 'unselect all') + _t(__CLASS__ . '.UNSELECTALL', 'unselect all') ) )); $fields->push(new OptionsetField( @@ -149,13 +149,13 @@ in the other stage:
_t('SilverStripe\\CMS\\Tasks\\RemoveOrphanedPagesTask.CHOOSEOPERATION', 'Choose operation:'), [ 'rebase' => _t( - 'SilverStripe\\CMS\\Tasks\\RemoveOrphanedPagesTask.OPERATION_REBASE', + __CLASS__ . '.OPERATION_REBASE', sprintf( 'Rebase selected to a new holder page "%s" and unpublish. None of these pages will show up for website visitors.', $this->rebaseHolderTitle() ) ), - 'remove' => _t('SilverStripe\\CMS\\Tasks\\RemoveOrphanedPagesTask.OPERATION_REMOVE', 'Remove selected from all stages (WARNING: Will destroy all selected pages from both stage and live)'), + 'remove' => _t(__CLASS__ . '.OPERATION_REMOVE', 'Remove selected from all stages (WARNING: Will destroy all selected pages from both stage and live)'), ], 'rebase' )); @@ -164,7 +164,7 @@ in the other stage:
sprintf( '

%s

', _t( - 'SilverStripe\\CMS\\Tasks\\RemoveOrphanedPagesTask.DELETEWARNING', + __CLASS__ . '.DELETEWARNING', 'Warning: These operations are not reversible. Please handle with care.' ) ) @@ -174,7 +174,7 @@ in the other stage:
'NotFoundLabel', sprintf( '

%s

', - _t('SilverStripe\\CMS\\Tasks\\RemoveOrphanedPagesTask.NONEFOUND', 'No orphans found') + _t(__CLASS__ . '.NONEFOUND', 'No orphans found') ) )); } @@ -184,7 +184,7 @@ in the other stage:
'SilverStripe\\Forms\\Form', $fields, new FieldList( - new FormAction('doSubmit', _t('SilverStripe\\CMS\\Tasks\\RemoveOrphanedPagesTask.BUTTONRUN', 'Run')) + new FormAction('doSubmit', _t(__CLASS__ . '.BUTTONRUN', 'Run')) ) ); @@ -217,7 +217,7 @@ in the other stage:
$successIDs = $this->rebaseOrphans($data['OrphanIDs']); break; default: - user_error(sprintf("Unknown operation: '%s'", $data['OrphanOperation']), E_USER_ERROR); + throw new \InvalidArgumentException(sprintf("Unknown operation: '%s'", $data['OrphanOperation'])); } $content = ''; @@ -228,7 +228,7 @@ in the other stage:
} $content .= ""; } else { - $content = _t('SilverStripe\\CMS\\Tasks\\RemoveOrphanedPagesTask.NONEREMOVED', 'None removed'); + $content = _t(__CLASS__ . '.NONEREMOVED', 'None removed'); } return $this->customise([