mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-23 16:05:34 +00:00
refactor: fix some of phpstan's ignored errors
This commit is contained in:
parent
0de9c1ad23
commit
4c1a3e5015
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace App\Controllers;
|
namespace App\Controllers;
|
||||||
|
|
||||||
use CodeIgniter\Controller;
|
use CodeIgniter\Controller;
|
||||||
|
use CodeIgniter\HTTP\IncomingRequest;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
@ -20,6 +21,13 @@ use ViewThemes\Theme;
|
|||||||
*/
|
*/
|
||||||
abstract class BaseController extends Controller
|
abstract class BaseController extends Controller
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Instance of the main Request object.
|
||||||
|
*
|
||||||
|
* @var IncomingRequest
|
||||||
|
*/
|
||||||
|
protected $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -16,6 +16,7 @@ use App\Models\EpisodeModel;
|
|||||||
use App\Models\PodcastModel;
|
use App\Models\PodcastModel;
|
||||||
use CodeIgniter\Controller;
|
use CodeIgniter\Controller;
|
||||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||||
|
use CodeIgniter\HTTP\IncomingRequest;
|
||||||
use CodeIgniter\HTTP\RedirectResponse;
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
@ -27,6 +28,13 @@ use Psr\Log\LoggerInterface;
|
|||||||
|
|
||||||
class EpisodeAudioController extends Controller
|
class EpisodeAudioController extends Controller
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Instance of the main Request object.
|
||||||
|
*
|
||||||
|
* @var IncomingRequest
|
||||||
|
*/
|
||||||
|
protected $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of helpers to be loaded automatically upon class instantiation. These helpers will be available to all
|
* An array of helpers to be loaded automatically upon class instantiation. These helpers will be available to all
|
||||||
* other controllers that extend Analytics.
|
* other controllers that extend Analytics.
|
||||||
|
@ -166,16 +166,24 @@ class EpisodeCommentController extends BaseController
|
|||||||
|
|
||||||
public function attemptLike(): RedirectResponse
|
public function attemptLike(): RedirectResponse
|
||||||
{
|
{
|
||||||
|
if (! ($interactAsActor = interact_as_actor()) instanceof Actor) {
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
model(LikeModel::class)
|
model(LikeModel::class)
|
||||||
->toggleLike(interact_as_actor(), $this->comment);
|
->toggleLike($interactAsActor, $this->comment);
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function attemptReply(): RedirectResponse
|
public function attemptReply(): RedirectResponse
|
||||||
{
|
{
|
||||||
|
if (! ($interactAsActor = interact_as_actor()) instanceof Actor) {
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
model(LikeModel::class)
|
model(LikeModel::class)
|
||||||
->toggleLike(interact_as_actor(), $this->comment);
|
->toggleLike($interactAsActor, $this->comment);
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Controllers;
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Entities\Podcast;
|
||||||
use App\Models\EpisodeModel;
|
use App\Models\EpisodeModel;
|
||||||
use App\Models\PodcastModel;
|
use App\Models\PodcastModel;
|
||||||
use CodeIgniter\Controller;
|
use CodeIgniter\Controller;
|
||||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||||
|
use CodeIgniter\HTTP\IncomingRequest;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Modules\PremiumPodcasts\Entities\Subscription;
|
use Modules\PremiumPodcasts\Entities\Subscription;
|
||||||
@ -22,13 +24,20 @@ use Opawg\UserAgentsPhp\UserAgentsRSS;
|
|||||||
|
|
||||||
class FeedController extends Controller
|
class FeedController extends Controller
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Instance of the main Request object.
|
||||||
|
*
|
||||||
|
* @var IncomingRequest
|
||||||
|
*/
|
||||||
|
protected $request;
|
||||||
|
|
||||||
public function index(string $podcastHandle): ResponseInterface
|
public function index(string $podcastHandle): ResponseInterface
|
||||||
{
|
{
|
||||||
helper(['rss', 'premium_podcasts', 'misc']);
|
helper(['rss', 'premium_podcasts', 'misc']);
|
||||||
|
|
||||||
$podcast = (new PodcastModel())->where('handle', $podcastHandle)
|
$podcast = (new PodcastModel())->where('handle', $podcastHandle)
|
||||||
->first();
|
->first();
|
||||||
if (! $podcast) {
|
if (! $podcast instanceof Podcast) {
|
||||||
throw PageNotFoundException::forPageNotFound();
|
throw PageNotFoundException::forPageNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,8 @@ class PageController extends BaseController
|
|||||||
throw PageNotFoundException::forPageNotFound();
|
throw PageNotFoundException::forPageNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
$page = (new PageModel())->where('slug', $params[0])->first();
|
||||||
($page = (new PageModel())->where('slug', $params[0])->first()) === null
|
if (! $page instanceof Page) {
|
||||||
) {
|
|
||||||
throw PageNotFoundException::forPageNotFound();
|
throw PageNotFoundException::forPageNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddCategories extends BaseMigration
|
||||||
|
|
||||||
class AddCategories extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddLanguages extends BaseMigration
|
||||||
|
|
||||||
class AddLanguages extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddPodcasts extends BaseMigration
|
||||||
|
|
||||||
class AddPodcasts extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddEpisodes extends BaseMigration
|
||||||
|
|
||||||
class AddEpisodes extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddPlatforms extends BaseMigration
|
||||||
|
|
||||||
class AddPlatforms extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddPodcastsPlatforms extends BaseMigration
|
||||||
|
|
||||||
class AddPodcastsPlatforms extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddEpisodeComments extends BaseMigration
|
||||||
|
|
||||||
class AddEpisodeComments extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddLikes extends BaseMigration
|
||||||
|
|
||||||
class AddLikes extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddPages extends BaseMigration
|
||||||
|
|
||||||
class AddPages extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddPodcastsCategories extends BaseMigration
|
||||||
|
|
||||||
class AddPodcastsCategories extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddClips extends BaseMigration
|
||||||
|
|
||||||
class AddClips extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddPersons extends BaseMigration
|
||||||
|
|
||||||
class AddPersons extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddPodcastsPersons extends BaseMigration
|
||||||
|
|
||||||
class AddPodcastsPersons extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddEpisodesPersons extends BaseMigration
|
||||||
|
|
||||||
class AddEpisodesPersons extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddCreditsView extends BaseMigration
|
||||||
|
|
||||||
class AddCreditsView extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddEpisodeIdToPosts extends BaseMigration
|
||||||
|
|
||||||
class AddEpisodeIdToPosts extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddCreatedByToPosts extends BaseMigration
|
||||||
|
|
||||||
class AddCreatedByToPosts extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
34
app/Database/Migrations/BaseMigration.php
Normal file
34
app/Database/Migrations/BaseMigration.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AddCreatedByToPosts Adds created_by field to posts table in database
|
||||||
|
*
|
||||||
|
* @copyright 2020 Ad Aures
|
||||||
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||||
|
* @link https://castopod.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\BaseConnection;
|
||||||
|
use CodeIgniter\Database\Migration;
|
||||||
|
|
||||||
|
class BaseMigration extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Database Connection instance
|
||||||
|
*
|
||||||
|
* @var BaseConnection
|
||||||
|
*/
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -12,9 +12,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Seeds;
|
namespace App\Database\Seeds;
|
||||||
|
|
||||||
|
use App\Entities\Episode;
|
||||||
|
use App\Entities\Podcast;
|
||||||
use App\Models\EpisodeModel;
|
use App\Models\EpisodeModel;
|
||||||
use App\Models\PodcastModel;
|
use App\Models\PodcastModel;
|
||||||
use CodeIgniter\Database\Seeder;
|
use CodeIgniter\Database\Seeder;
|
||||||
|
use Exception;
|
||||||
use GeoIp2\Database\Reader;
|
use GeoIp2\Database\Reader;
|
||||||
|
|
||||||
use GeoIp2\Exception\AddressNotFoundException;
|
use GeoIp2\Exception\AddressNotFoundException;
|
||||||
@ -41,11 +44,18 @@ class FakePodcastsAnalyticsSeeder extends Seeder
|
|||||||
|
|
||||||
$podcast = (new PodcastModel())->first();
|
$podcast = (new PodcastModel())->first();
|
||||||
|
|
||||||
if ($podcast !== null) {
|
if (! $podcast instanceof Podcast) {
|
||||||
|
throw new Exception("COULD NOT POPULATE DATABASE:\n\tCreate a podcast with episodes first.\n");
|
||||||
|
}
|
||||||
|
|
||||||
$firstEpisode = (new EpisodeModel())
|
$firstEpisode = (new EpisodeModel())
|
||||||
->selectMin('published_at')
|
->selectMin('published_at')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
if (! $firstEpisode instanceof Episode) {
|
||||||
|
throw new Exception("COULD NOT POPULATE DATABASE:\n\tCreate an episode first.");
|
||||||
|
}
|
||||||
|
|
||||||
for (
|
for (
|
||||||
$date = strtotime((string) $firstEpisode->published_at);
|
$date = strtotime((string) $firstEpisode->published_at);
|
||||||
$date < strtotime('now');
|
$date < strtotime('now');
|
||||||
@ -195,8 +205,5 @@ class FakePodcastsAnalyticsSeeder extends Seeder
|
|||||||
->ignore(true)
|
->ignore(true)
|
||||||
->insertBatch($analyticsPodcastsByRegion);
|
->insertBatch($analyticsPodcastsByRegion);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
echo "COULD NOT POPULATE DATABASE:\n\tCreate a podcast with episodes first.\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Seeds;
|
namespace App\Database\Seeds;
|
||||||
|
|
||||||
|
use App\Entities\Episode;
|
||||||
|
use App\Entities\Podcast;
|
||||||
use App\Models\EpisodeModel;
|
use App\Models\EpisodeModel;
|
||||||
use App\Models\PodcastModel;
|
use App\Models\PodcastModel;
|
||||||
|
|
||||||
use CodeIgniter\Database\Seeder;
|
use CodeIgniter\Database\Seeder;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
class FakeWebsiteAnalyticsSeeder extends Seeder
|
class FakeWebsiteAnalyticsSeeder extends Seeder
|
||||||
{
|
{
|
||||||
@ -183,11 +186,18 @@ class FakeWebsiteAnalyticsSeeder extends Seeder
|
|||||||
{
|
{
|
||||||
$podcast = (new PodcastModel())->first();
|
$podcast = (new PodcastModel())->first();
|
||||||
|
|
||||||
if ($podcast) {
|
if (! $podcast instanceof Podcast) {
|
||||||
|
throw new Exception("COULD NOT POPULATE DATABASE:\n\tCreate a podcast with episodes first.\n");
|
||||||
|
}
|
||||||
|
|
||||||
$firstEpisode = (new EpisodeModel())
|
$firstEpisode = (new EpisodeModel())
|
||||||
->selectMin('published_at')
|
->selectMin('published_at')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
if (! $firstEpisode instanceof Episode) {
|
||||||
|
throw new Exception("COULD NOT POPULATE DATABASE:\n\tCreate an episode first.");
|
||||||
|
}
|
||||||
|
|
||||||
for (
|
for (
|
||||||
$date = strtotime((string) $firstEpisode->published_at);
|
$date = strtotime((string) $firstEpisode->published_at);
|
||||||
$date < strtotime('now');
|
$date < strtotime('now');
|
||||||
@ -261,8 +271,5 @@ class FakeWebsiteAnalyticsSeeder extends Seeder
|
|||||||
->ignore(true)
|
->ignore(true)
|
||||||
->insertBatch($websiteByReferer);
|
->insertBatch($websiteByReferer);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
echo "COULD NOT POPULATE DATABASE:\n\tCreate a podcast with episodes first.\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,6 +119,7 @@ class BaseClip extends Entity
|
|||||||
|
|
||||||
public function getUser(): ?User
|
public function getUser(): ?User
|
||||||
{
|
{
|
||||||
|
/** @var ?User */
|
||||||
return (new UserModel())->find($this->created_by);
|
return (new UserModel())->find($this->created_by);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ class Credit extends Entity
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
return lang("PersonsTaxonomy.persons.{$this->person_group}.label");
|
return lang("PersonsTaxonomy.persons.{$this->person_group}.label");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +112,7 @@ class Credit extends Entity
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
return lang("PersonsTaxonomy.persons.{$this->person_group}.roles.{$this->person_role}.label");
|
return lang("PersonsTaxonomy.persons.{$this->person_group}.roles.{$this->person_role}.label");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ use Modules\Media\Entities\Image;
|
|||||||
use Modules\Media\Entities\Transcript;
|
use Modules\Media\Entities\Transcript;
|
||||||
use Modules\Media\Models\MediaModel;
|
use Modules\Media\Models\MediaModel;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
use SimpleXMLElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
@ -619,13 +620,19 @@ class Episode extends Entity
|
|||||||
}
|
}
|
||||||
|
|
||||||
helper('rss');
|
helper('rss');
|
||||||
$customRssArray = rss_to_array(
|
|
||||||
simplexml_load_string(
|
$customXML = simplexml_load_string(
|
||||||
'<?xml version="1.0" encoding="utf-8"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:podcast="https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><item>' .
|
'<?xml version="1.0" encoding="utf-8"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:podcast="https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><item>' .
|
||||||
$customRssString .
|
$customRssString .
|
||||||
'</item></channel></rss>',
|
'</item></channel></rss>',
|
||||||
),
|
);
|
||||||
)['elements'][0]['elements'][0];
|
|
||||||
|
if (! $customXML instanceof SimpleXMLElement) {
|
||||||
|
// TODO: Failed to parse custom xml, should return error?
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
$customRssArray = rss_to_array($customXML)['elements'][0]['elements'][0];
|
||||||
|
|
||||||
if (array_key_exists('elements', $customRssArray)) {
|
if (array_key_exists('elements', $customRssArray)) {
|
||||||
$this->attributes['custom_rss'] = json_encode($customRssArray['elements']);
|
$this->attributes['custom_rss'] = json_encode($customRssArray['elements']);
|
||||||
|
@ -21,6 +21,7 @@ use CodeIgniter\Files\File;
|
|||||||
use CodeIgniter\HTTP\Files\UploadedFile;
|
use CodeIgniter\HTTP\Files\UploadedFile;
|
||||||
use CodeIgniter\I18n\Time;
|
use CodeIgniter\I18n\Time;
|
||||||
use CodeIgniter\Shield\Entities\User;
|
use CodeIgniter\Shield\Entities\User;
|
||||||
|
use Exception;
|
||||||
use League\CommonMark\Environment\Environment;
|
use League\CommonMark\Environment\Environment;
|
||||||
use League\CommonMark\Extension\Autolink\AutolinkExtension;
|
use League\CommonMark\Extension\Autolink\AutolinkExtension;
|
||||||
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
|
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
|
||||||
@ -260,7 +261,13 @@ class Podcast extends Entity
|
|||||||
public function getCover(): Image
|
public function getCover(): Image
|
||||||
{
|
{
|
||||||
if (! $this->cover instanceof Image) {
|
if (! $this->cover instanceof Image) {
|
||||||
$this->cover = (new MediaModel('image'))->getMediaById($this->cover_id);
|
$cover = (new MediaModel('image'))->getMediaById($this->cover_id);
|
||||||
|
|
||||||
|
if (! $cover instanceof Image) {
|
||||||
|
throw new Exception('Could not retrieve podcast cover.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->cover = $cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->cover;
|
return $this->cover;
|
||||||
|
@ -40,7 +40,9 @@ if (! function_exists('current_domain')) {
|
|||||||
*/
|
*/
|
||||||
function current_domain(): string
|
function current_domain(): string
|
||||||
{
|
{
|
||||||
|
/** @var URI $uri */
|
||||||
$uri = current_url(true);
|
$uri = current_url(true);
|
||||||
|
|
||||||
return $uri->getHost() . ($uri->getPort() ? ':' . $uri->getPort() : '');
|
return $uri->getHost() . ($uri->getPort() ? ':' . $uri->getPort() : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Entities\Actor;
|
||||||
|
use App\Entities\Episode;
|
||||||
use App\Entities\EpisodeComment;
|
use App\Entities\EpisodeComment;
|
||||||
use App\Libraries\CommentObject;
|
use App\Libraries\CommentObject;
|
||||||
use CodeIgniter\Database\BaseBuilder;
|
use CodeIgniter\Database\BaseBuilder;
|
||||||
@ -297,7 +299,15 @@ class EpisodeCommentModel extends UuidModel
|
|||||||
$episode = model(EpisodeModel::class, false)
|
$episode = model(EpisodeModel::class, false)
|
||||||
->find((int) $data['data']['episode_id']);
|
->find((int) $data['data']['episode_id']);
|
||||||
|
|
||||||
$data['data']['uri'] = url_to('episode-comment', esc($actor->username), $episode->slug, $uuid4->toString());
|
if (! $episode instanceof Episode) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $actor instanceof Actor) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['data']['uri'] = url_to('episode-comment', $actor->username, $episode->slug, $uuid4->toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -15,6 +15,7 @@ use App\Entities\Like;
|
|||||||
use Michalsn\Uuid\UuidModel;
|
use Michalsn\Uuid\UuidModel;
|
||||||
use Modules\Fediverse\Activities\LikeActivity;
|
use Modules\Fediverse\Activities\LikeActivity;
|
||||||
use Modules\Fediverse\Activities\UndoActivity;
|
use Modules\Fediverse\Activities\UndoActivity;
|
||||||
|
use Modules\Fediverse\Entities\Activity;
|
||||||
use Modules\Fediverse\Entities\Actor;
|
use Modules\Fediverse\Entities\Actor;
|
||||||
use Modules\Fediverse\Models\ActivityModel;
|
use Modules\Fediverse\Models\ActivityModel;
|
||||||
|
|
||||||
@ -113,6 +114,11 @@ class LikeModel extends UuidModel
|
|||||||
])
|
])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
if (! $activity instanceof Activity) {
|
||||||
|
// no like activity found, do nothing
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$likeActivity = new LikeActivity();
|
$likeActivity = new LikeActivity();
|
||||||
$likeActivity
|
$likeActivity
|
||||||
->set('id', url_to('activity', esc($actor->username), $activity->id))
|
->set('id', url_to('activity', esc($actor->username), $activity->id))
|
||||||
|
@ -439,13 +439,15 @@ class PodcastModel extends Model
|
|||||||
if ($podcast instanceof Podcast) {
|
if ($podcast instanceof Podcast) {
|
||||||
$podcastActor = (new ActorModel())->find($podcast->actor_id);
|
$podcastActor = (new ActorModel())->find($podcast->actor_id);
|
||||||
|
|
||||||
if ($podcastActor) {
|
if (! $podcastActor instanceof Actor) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
$podcastActor->avatar_image_url = $podcast->cover->federation_url;
|
$podcastActor->avatar_image_url = $podcast->cover->federation_url;
|
||||||
$podcastActor->avatar_image_mimetype = $podcast->cover->federation_mimetype;
|
$podcastActor->avatar_image_mimetype = $podcast->cover->federation_mimetype;
|
||||||
|
|
||||||
(new ActorModel())->update($podcast->actor_id, $podcastActor);
|
(new ActorModel())->update($podcast->actor_id, $podcastActor);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsPodcasts extends Migration
|
class AddAnalyticsPodcasts extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsPodcastsByEpisode extends Migration
|
class AddAnalyticsPodcastsByEpisode extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsPodcastsByHour extends Migration
|
class AddAnalyticsPodcastsByHour extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsPodcastsByPlayer extends Migration
|
class AddAnalyticsPodcastsByPlayer extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsPodcastsByCountry extends Migration
|
class AddAnalyticsPodcastsByCountry extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsPodcastsByRegion extends Migration
|
class AddAnalyticsPodcastsByRegion extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsWebsiteByBrowser extends Migration
|
class AddAnalyticsWebsiteByBrowser extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsWebsiteByReferer extends Migration
|
class AddAnalyticsWebsiteByReferer extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsWebsiteByEntryPage extends Migration
|
class AddAnalyticsWebsiteByEntryPage extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsUnknownUseragents extends Migration
|
class AddAnalyticsUnknownUseragents extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsPodcastsBySubscription extends Migration
|
class AddAnalyticsPodcastsBySubscription extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsPodcastsProcedure extends Migration
|
class AddAnalyticsPodcastsProcedure extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsUnknownUseragentsProcedure extends Migration
|
class AddAnalyticsUnknownUseragentsProcedure extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Analytics\Database\Migrations;
|
namespace Modules\Analytics\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddAnalyticsWebsiteProcedure extends Migration
|
class AddAnalyticsWebsiteProcedure extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -4,9 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddIsOwnerToUsers extends BaseMigration
|
||||||
|
|
||||||
class AddIsOwnerToUsers extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -68,15 +68,15 @@ if (! function_exists('interact_as_actor')) {
|
|||||||
/**
|
/**
|
||||||
* Get the actor the user is currently interacting as
|
* Get the actor the user is currently interacting as
|
||||||
*/
|
*/
|
||||||
function interact_as_actor(): Actor | false
|
function interact_as_actor(): ?Actor
|
||||||
{
|
{
|
||||||
if (! auth()->loggedIn()) {
|
if (! auth()->loggedIn()) {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$session = session();
|
$session = session();
|
||||||
if (! $session->has('interact_as_actor_id')) {
|
if (! $session->has('interact_as_actor_id')) {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return model(ActorModel::class, false)->getActorById($session->get('interact_as_actor_id'));
|
return model(ActorModel::class, false)->getActorById($session->get('interact_as_actor_id'));
|
||||||
|
@ -12,6 +12,7 @@ namespace Modules\Fediverse\Controllers;
|
|||||||
|
|
||||||
use CodeIgniter\Controller;
|
use CodeIgniter\Controller;
|
||||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||||
|
use CodeIgniter\HTTP\IncomingRequest;
|
||||||
use CodeIgniter\HTTP\RedirectResponse;
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
use CodeIgniter\HTTP\Response;
|
use CodeIgniter\HTTP\Response;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
@ -23,6 +24,13 @@ use Modules\Fediverse\Objects\OrderedCollectionPage;
|
|||||||
|
|
||||||
class PostController extends Controller
|
class PostController extends Controller
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Instance of the main Request object.
|
||||||
|
*
|
||||||
|
* @var IncomingRequest
|
||||||
|
*/
|
||||||
|
protected $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
|
@ -47,8 +47,8 @@ abstract class AbstractObject
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toJSON(): string | bool
|
public function toJSON(): string
|
||||||
{
|
{
|
||||||
return json_encode($this->toArray(), JSON_UNESCAPED_UNICODE);
|
return (string) json_encode($this->toArray(), JSON_UNESCAPED_UNICODE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Fediverse\Database\Migrations;
|
namespace Modules\Fediverse\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddActors extends Migration
|
class AddActors extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Fediverse\Database\Migrations;
|
namespace Modules\Fediverse\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddPosts extends Migration
|
class AddPosts extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Fediverse\Database\Migrations;
|
namespace Modules\Fediverse\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddActivities extends Migration
|
class AddActivities extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Fediverse\Database\Migrations;
|
namespace Modules\Fediverse\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddFavourites extends Migration
|
class AddFavourites extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Fediverse\Database\Migrations;
|
namespace Modules\Fediverse\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddFollowers extends Migration
|
class AddFollowers extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Fediverse\Database\Migrations;
|
namespace Modules\Fediverse\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddPreviewCards extends Migration
|
class AddPreviewCards extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Fediverse\Database\Migrations;
|
namespace Modules\Fediverse\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddPostsPreviewCards extends Migration
|
class AddPostsPreviewCards extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\Fediverse\Database\Migrations;
|
namespace Modules\Fediverse\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddBlockedDomains extends Migration
|
class AddBlockedDomains extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Database\Migrations;
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
class AddNotifications extends BaseMigration
|
||||||
|
|
||||||
class AddNotifications extends Migration
|
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Media\Database\Migrations;
|
namespace Media\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddMedia extends Migration
|
class AddMedia extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Media\Database\Migrations;
|
namespace Media\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class RenameMediafileKey extends Migration
|
class RenameMediafileKey extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\PremiumPodcasts\Database\Migrations;
|
namespace Modules\PremiumPodcasts\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddSubscriptions extends Migration
|
class AddSubscriptions extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\WebSub\Database\Migrations;
|
namespace Modules\WebSub\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddIsPublishedOnHubsToPodcasts extends Migration
|
class AddIsPublishedOnHubsToPodcasts extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Modules\WebSub\Database\Migrations;
|
namespace Modules\WebSub\Database\Migrations;
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
use App\Database\Migrations\BaseMigration;
|
||||||
|
|
||||||
class AddIsPublishedOnHubsToEpisodes extends Migration
|
class AddIsPublishedOnHubsToEpisodes extends BaseMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,4 @@ parameters:
|
|||||||
- ENVIRONMENT
|
- ENVIRONMENT
|
||||||
- SODIUM_LIBRARY_VERSION
|
- SODIUM_LIBRARY_VERSION
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
- '#Cannot access property [\$a-z_]+ on ((array\|)?object)#'
|
|
||||||
- '#^Call to an undefined method CodeIgniter\\Database\\ConnectionInterface#'
|
|
||||||
- '#^Access to an undefined property Modules\\Media\\Entities\\Image#'
|
- '#^Access to an undefined property Modules\\Media\\Entities\\Image#'
|
||||||
- '#^Call to an undefined method CodeIgniter\\HTTP\\RequestInterface#'
|
|
||||||
|
@ -36,6 +36,11 @@ class ExampleDatabaseTest extends CIUnitTestCase
|
|||||||
$this->setPrivateProperty($model, 'tempUseSoftDeletes', true);
|
$this->setPrivateProperty($model, 'tempUseSoftDeletes', true);
|
||||||
|
|
||||||
$object = $model->first();
|
$object = $model->first();
|
||||||
|
|
||||||
|
if (! is_object($object)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$model->delete($object->id);
|
$model->delete($object->id);
|
||||||
|
|
||||||
// The model should no longer find it
|
// The model should no longer find it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user