diff --git a/src/Versioned.php b/src/Versioned.php index 72b8ec9a..25459a42 100644 --- a/src/Versioned.php +++ b/src/Versioned.php @@ -287,17 +287,6 @@ public function augmentDataQueryCreation(SQLSelect &$query, DataQuery &$dataQuer */ public function __construct($mode = self::STAGEDVERSIONED) { - // Handle deprecated behaviour - if ($mode === 'Stage' && func_num_args() === 1) { - Deprecation::notice("5.0", "Versioned now takes a mode as a single parameter"); - $mode = static::VERSIONED; - } elseif (is_array($mode) || func_num_args() > 1) { - Deprecation::notice("5.0", "Versioned now takes a mode as a single parameter"); - $mode = func_num_args() > 1 || count($mode) > 1 - ? static::STAGEDVERSIONED - : static::VERSIONED; - } - if (!in_array($mode, [static::STAGEDVERSIONED, static::VERSIONED])) { throw new InvalidArgumentException("Invalid mode: {$mode}"); } @@ -1143,11 +1132,6 @@ protected function lookupReverseOwners() */ public function canPublish($member = null) { - // Skip if invoked by extendedCan() - if (func_num_args() > 4) { - return null; - } - if (!$member) { $member = Security::getCurrentUser(); } @@ -1167,6 +1151,12 @@ public function canPublish($member = null) return $owner->canEdit($member); } + protected function extendCanPublish() + { + // prevent canPublish() from extending itself + return null; + } + /** * Check if the current user can delete this record from live * @@ -1175,11 +1165,6 @@ public function canPublish($member = null) */ public function canUnpublish($member = null) { - // Skip if invoked by extendedCan() - if (func_num_args() > 4) { - return null; - } - if (!$member) { $member = Security::getCurrentUser(); } @@ -1199,6 +1184,12 @@ public function canUnpublish($member = null) return $owner->canPublish($member); } + protected function extendCanUnpublish() + { + // prevent canUnpublish() extending itself + return null; + } + /** * Check if the current user is allowed to archive this record. * If extended, ensure that both canDelete and canUnpublish are extended also @@ -1208,11 +1199,6 @@ public function canUnpublish($member = null) */ public function canArchive($member = null) { - // Skip if invoked by extendedCan() - if (func_num_args() > 4) { - return null; - } - if (!$member) { $member = Security::getCurrentUser(); } @@ -1242,6 +1228,12 @@ public function canArchive($member = null) return true; } + protected function extendCanArchive() + { + // Prevent canArchive() extending itself + return null; + } + /** * Check if the user can revert this record to live * @@ -1252,11 +1244,6 @@ public function canRevertToLive($member = null) { $owner = $this->owner; - // Skip if invoked by extendedCan() - if (func_num_args() > 4) { - return null; - } - // Can't revert if not on live if (!$owner->isPublished()) { return false; @@ -1280,6 +1267,12 @@ public function canRevertToLive($member = null) return $owner->canEdit($member); } + protected function extendCanRevertToLive() + { + // Prevent canRevertToLive() extending itself + return null; + } + /** * Extend permissions to include additional security for objects that are not published to live. * @@ -1452,15 +1445,6 @@ public function latestPublished() )->value(); } - /** - * @deprecated 4.0..5.0 - */ - public function doPublish() - { - Deprecation::notice('5.0', 'Use publishRecursive instead'); - return $this->owner->publishRecursive(); - } - /** * Publish this object and all owned objects to Live * @@ -1714,15 +1698,6 @@ public function onAfterRevertToLive() $owner->unlinkDisownedObjects(Versioned::LIVE, Versioned::DRAFT); } - /** - * @deprecated 4.0..5.0 - */ - public function publish($fromStage, $toStage, $createNewVersion = false) - { - Deprecation::notice('5.0', 'Use copyVersionToStage instead'); - $this->owner->copyVersionToStage($fromStage, $toStage, $createNewVersion); - } - /** * Move a database record from one stage to the other. * @@ -1805,16 +1780,6 @@ public function getMigratingVersion() return $this->owner->getField(self::MIGRATING_VERSION); } - /** - * @deprecated 4.0...5.0 - * @param string $version The version. - */ - public function migrateVersion($version) - { - Deprecation::notice('5.0', 'use setMigratingVersion instead'); - $this->setMigratingVersion($version); - } - /** * Set the migrating version. *