mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
ENH Don't emit deprecation warnings for unavoidable API calls (#2985)
This commit is contained in:
parent
81bfa84f0a
commit
96ce092745
@ -5,6 +5,7 @@ namespace SilverStripe\CMS\BatchActions;
|
|||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\Admin\CMSBatchAction;
|
use SilverStripe\Admin\CMSBatchAction;
|
||||||
use SilverStripe\Control\HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
|
use SilverStripe\Dev\Deprecation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete items batch action.
|
* Delete items batch action.
|
||||||
@ -27,6 +28,7 @@ class CMSBatchAction_Archive extends CMSBatchAction
|
|||||||
|
|
||||||
public function applicablePages($ids)
|
public function applicablePages($ids)
|
||||||
{
|
{
|
||||||
return $this->applicablePagesHelper($ids, 'canArchive');
|
// canArchive() is deprecated, not $this->applicablePagesHelper()
|
||||||
|
return Deprecation::withNoReplacement(fn() => $this->applicablePagesHelper($ids, 'canArchive'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ use SilverStripe\Core\Convert;
|
|||||||
use SilverStripe\Core\Environment;
|
use SilverStripe\Core\Environment;
|
||||||
use SilverStripe\Core\Flushable;
|
use SilverStripe\Core\Flushable;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
|
use SilverStripe\Dev\Deprecation;
|
||||||
use SilverStripe\Forms\DateField;
|
use SilverStripe\Forms\DateField;
|
||||||
use SilverStripe\Forms\DropdownField;
|
use SilverStripe\Forms\DropdownField;
|
||||||
use SilverStripe\Forms\FieldGroup;
|
use SilverStripe\Forms\FieldGroup;
|
||||||
@ -1997,7 +1998,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
if (!$record || !$record->exists()) {
|
if (!$record || !$record->exists()) {
|
||||||
throw new HTTPResponse_Exception("Bad record ID #$id", 404);
|
throw new HTTPResponse_Exception("Bad record ID #$id", 404);
|
||||||
}
|
}
|
||||||
if (!$record->canArchive()) {
|
$canArchive = Deprecation::withNoReplacement(fn() => $record->canArchive());
|
||||||
|
if (!$canArchive) {
|
||||||
return Security::permissionFailure();
|
return Security::permissionFailure();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ use SilverStripe\Core\Manifest\ModuleResource;
|
|||||||
use SilverStripe\Core\Manifest\ModuleResourceLoader;
|
use SilverStripe\Core\Manifest\ModuleResourceLoader;
|
||||||
use SilverStripe\Core\Manifest\VersionProvider;
|
use SilverStripe\Core\Manifest\VersionProvider;
|
||||||
use SilverStripe\Core\Resettable;
|
use SilverStripe\Core\Resettable;
|
||||||
|
use SilverStripe\Dev\Deprecation;
|
||||||
use SilverStripe\Forms\CheckboxField;
|
use SilverStripe\Forms\CheckboxField;
|
||||||
use SilverStripe\Forms\CompositeField;
|
use SilverStripe\Forms\CompositeField;
|
||||||
use SilverStripe\Forms\DropdownField;
|
use SilverStripe\Forms\DropdownField;
|
||||||
@ -2567,7 +2568,9 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If a page is on any stage it can be archived
|
// If a page is on any stage it can be archived
|
||||||
if (($isOnDraft || $isPublished) && $this->canArchive()) {
|
if (($isOnDraft || $isPublished)) {
|
||||||
|
$canArchive = Deprecation::withNoReplacement(fn() => $this->canArchive());
|
||||||
|
if ($canArchive) {
|
||||||
$title = $isPublished
|
$title = $isPublished
|
||||||
? _t('SilverStripe\\CMS\\Controllers\\CMSMain.UNPUBLISH_AND_ARCHIVE', 'Unpublish and archive')
|
? _t('SilverStripe\\CMS\\Controllers\\CMSMain.UNPUBLISH_AND_ARCHIVE', 'Unpublish and archive')
|
||||||
: _t('SilverStripe\\CMS\\Controllers\\CMSMain.ARCHIVE', 'Archive');
|
: _t('SilverStripe\\CMS\\Controllers\\CMSMain.ARCHIVE', 'Archive');
|
||||||
@ -2580,6 +2583,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
|||||||
))
|
))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// "save", supports an alternate state that is still clickable, but notifies the user that the action is not needed.
|
// "save", supports an alternate state that is still clickable, but notifies the user that the action is not needed.
|
||||||
$noChangesClasses = 'btn-outline-primary font-icon-tick';
|
$noChangesClasses = 'btn-outline-primary font-icon-tick';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user