1
0
mirror of https://github.com/flarum/core.git synced 2025-08-01 22:20:21 +02:00

Remove Deprecated Beta14 Code (#2428)

This commit is contained in:
Alexander Skvortsov
2020-12-01 11:21:28 -05:00
committed by GitHub
parent 5a763050a6
commit fe41bc1fdc
13 changed files with 4 additions and 323 deletions

View File

@@ -1,39 +0,0 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Event;
use Flarum\User\User;
/**
* @deprecated beta 14, remove in beta 15. Use the User extender instead.
* The `PrepareUserGroups` event.
*/
class PrepareUserGroups
{
/**
* @var User
*/
public $user;
/**
* @var array
*/
public $groupIds;
/**
* @param User $user
* @param array $groupIds
*/
public function __construct(User $user, array &$groupIds)
{
$this->user = $user;
$this->groupIds = &$groupIds;
}
}

View File

@@ -153,50 +153,6 @@ class Application
$this->register(new EventServiceProvider($this->container));
}
/**
* Get the base path of the Laravel installation.
*
* @return string
* @deprecated Will be removed in Beta.15.
*/
public function basePath()
{
return $this->paths->base;
}
/**
* Get the path to the public / web directory.
*
* @return string
* @deprecated Will be removed in Beta.15.
*/
public function publicPath()
{
return $this->paths->public;
}
/**
* Get the path to the storage directory.
*
* @return string
* @deprecated Will be removed in Beta.15.
*/
public function storagePath()
{
return $this->paths->storage;
}
/**
* Get the path to the vendor directory where dependencies are installed.
*
* @return string
* @deprecated Will be removed in Beta.15.
*/
public function vendorPath()
{
return $this->paths->vendor;
}
/**
* Register a service provider with the application.
*

View File

@@ -25,7 +25,5 @@ interface MailableInterface
*
* @return string
*/
// TODO: This is temporarily commented out to avoid BC breaks between beta 13 and beta 14.
// It should be uncommented before beta 15.
// public function getEmailSubject(TranslatorInterface $translator);
public function getEmailSubject(TranslatorInterface $translator);
}

View File

@@ -1,72 +0,0 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\User;
use Flarum\User\Exception\NotAuthenticatedException;
use Flarum\User\Exception\PermissionDeniedException;
/**
* @deprecated beta 14, remove beta 15. Please use direct methods of the User class instead. E.g. $actor->assertCan($ability);
*/
trait AssertPermissionTrait
{
/**
* Ensure the current user is allowed to do something.
*
* If the condition is not met, an exception will be thrown that signals the
* lack of permissions. This is about *authorization*, i.e. retrying such a
* request / operation without a change in permissions (or using another
* user account) is pointless.
*
* @param bool $condition
* @throws PermissionDeniedException
*/
protected function assertPermission($condition)
{
if (! $condition) {
throw new PermissionDeniedException;
}
}
/**
* Ensure the given actor is authenticated.
*
* This will throw an exception for guest users, signaling that
* *authorization* failed. Thus, they could retry the operation after
* logging in (or using other means of authentication).
*
* @param User $actor
* @throws NotAuthenticatedException
*/
protected function assertRegistered(User $actor)
{
$actor->assertRegistered();
}
/**
* @param User $actor
* @param string $ability
* @param mixed $arguments
* @throws PermissionDeniedException
*/
protected function assertCan(User $actor, $ability, $arguments = [])
{
$actor->assertCan($ability, $arguments);
}
/**
* @param User $actor
* @throws PermissionDeniedException
*/
protected function assertAdmin(User $actor)
{
$actor->assertCan('administrate');
}
}

View File

@@ -1,31 +0,0 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\User\Event;
use Flarum\User\User;
/**
* @deprecated beta 14, remove in beta 15.
*/
class GetDisplayName
{
/**
* @var User
*/
public $user;
/**
* @param User $user
*/
public function __construct(User $user)
{
$this->user = $user;
}
}

View File

@@ -15,7 +15,6 @@ use Flarum\Database\AbstractModel;
use Flarum\Database\ScopeVisibilityTrait;
use Flarum\Discussion\Discussion;
use Flarum\Event\ConfigureUserPreferences;
use Flarum\Event\PrepareUserGroups;
use Flarum\Foundation\EventGeneratorTrait;
use Flarum\Group\Group;
use Flarum\Group\Permission;
@@ -30,7 +29,6 @@ use Flarum\User\Event\CheckingPassword;
use Flarum\User\Event\Deleted;
use Flarum\User\Event\EmailChanged;
use Flarum\User\Event\EmailChangeRequested;
use Flarum\User\Event\GetDisplayName;
use Flarum\User\Event\PasswordChanged;
use Flarum\User\Event\Registered;
use Flarum\User\Event\Renamed;
@@ -327,8 +325,7 @@ class User extends AbstractModel
*/
public function getDisplayNameAttribute()
{
// Event is deprecated in beta 14, remove in beta 15.
return static::$dispatcher->until(new GetDisplayName($this)) ?: static::$displayNameDriver->displayName($this);
return static::$displayNameDriver->displayName($this);
}
/**
@@ -722,9 +719,6 @@ class User extends AbstractModel
$groupIds = array_merge($groupIds, [Group::MEMBER_ID], $this->groups->pluck('id')->all());
}
/** @deprecated in beta 14, remove in beta 15 */
event(new PrepareUserGroups($this, $groupIds));
foreach (static::$groupProcessors as $processor) {
$groupIds = $processor($this, $groupIds);
}

View File

@@ -7,7 +7,6 @@
* LICENSE file that was distributed with this source code.
*/
use Flarum\Foundation\Paths;
use Illuminate\Container\Container;
if (! function_exists('app')) {
@@ -28,48 +27,6 @@ if (! function_exists('app')) {
}
}
if (! function_exists('base_path')) {
/**
* Get the path to the base of the install.
*
* @param string $path
* @return string
* @deprecated Will be removed in Beta.15.
*/
function base_path($path = '')
{
return app(Paths::class)->base.($path ? DIRECTORY_SEPARATOR.$path : $path);
}
}
if (! function_exists('public_path')) {
/**
* Get the path to the public folder.
*
* @param string $path
* @return string
* @deprecated Will be removed in Beta.15.
*/
function public_path($path = '')
{
return app(Paths::class)->public.($path ? DIRECTORY_SEPARATOR.$path : $path);
}
}
if (! function_exists('storage_path')) {
/**
* Get the path to the storage folder.
*
* @param string $path
* @return string
* @deprecated Will be removed in Beta.15.
*/
function storage_path($path = '')
{
return app(Paths::class)->storage.($path ? DIRECTORY_SEPARATOR.$path : $path);
}
}
if (! function_exists('event')) {
/**
* Fire an event and call the listeners.