Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • alpha
  • beta
  • develop
  • docs/fix-readme
  • docs/update-vitepress
  • draft/rss-feed
  • feat/dashboard
  • feat/episodes-page-ux
  • feat/generator-user-agent
  • feat/headliner
  • feat/new-languages
  • feat/plugins
  • fix/federation
  • fix/forms-ux
  • i18n
  • main
  • next
  • refactor/transcripts
  • v1.0.0
  • v1.0.0-alpha.1
  • v1.0.0-alpha.10
  • v1.0.0-alpha.11
  • v1.0.0-alpha.12
  • v1.0.0-alpha.13
  • v1.0.0-alpha.14
  • v1.0.0-alpha.15
  • v1.0.0-alpha.16
  • v1.0.0-alpha.17
  • v1.0.0-alpha.18
  • v1.0.0-alpha.19
  • v1.0.0-alpha.2
  • v1.0.0-alpha.20
  • v1.0.0-alpha.21
  • v1.0.0-alpha.22
  • v1.0.0-alpha.23
  • v1.0.0-alpha.24
  • v1.0.0-alpha.25
  • v1.0.0-alpha.26
  • v1.0.0-alpha.27
  • v1.0.0-alpha.28
  • v1.0.0-alpha.29
  • v1.0.0-alpha.3
  • v1.0.0-alpha.30
  • v1.0.0-alpha.31
  • v1.0.0-alpha.32
  • v1.0.0-alpha.33
  • v1.0.0-alpha.34
  • v1.0.0-alpha.35
  • v1.0.0-alpha.36
  • v1.0.0-alpha.37
  • v1.0.0-alpha.38
  • v1.0.0-alpha.39
  • v1.0.0-alpha.4
  • v1.0.0-alpha.40
  • v1.0.0-alpha.41
  • v1.0.0-alpha.42
  • v1.0.0-alpha.43
  • v1.0.0-alpha.44
  • v1.0.0-alpha.45
  • v1.0.0-alpha.46
  • v1.0.0-alpha.47
  • v1.0.0-alpha.48
  • v1.0.0-alpha.49
  • v1.0.0-alpha.5
  • v1.0.0-alpha.50
  • v1.0.0-alpha.51
  • v1.0.0-alpha.52
  • v1.0.0-alpha.53
  • v1.0.0-alpha.54
  • v1.0.0-alpha.55
  • v1.0.0-alpha.56
  • v1.0.0-alpha.57
  • v1.0.0-alpha.58
  • v1.0.0-alpha.59
  • v1.0.0-alpha.6
  • v1.0.0-alpha.60
  • v1.0.0-alpha.61
  • v1.0.0-alpha.62
  • v1.0.0-alpha.63
  • v1.0.0-alpha.64
  • v1.0.0-alpha.65
  • v1.0.0-alpha.66
  • v1.0.0-alpha.67
  • v1.0.0-alpha.68
  • v1.0.0-alpha.69
  • v1.0.0-alpha.7
  • v1.0.0-alpha.70
  • v1.0.0-alpha.71
  • v1.0.0-alpha.72
  • v1.0.0-alpha.73
  • v1.0.0-alpha.74
  • v1.0.0-alpha.75
  • v1.0.0-alpha.76
  • v1.0.0-alpha.77
  • v1.0.0-alpha.78
  • v1.0.0-alpha.79
  • v1.0.0-alpha.8
  • v1.0.0-alpha.80
  • v1.0.0-alpha.9
  • v1.0.0-beta.1
  • v1.0.0-beta.10
  • v1.0.0-beta.11
  • v1.0.0-beta.12
  • v1.0.0-beta.13
  • v1.0.0-beta.14
  • v1.0.0-beta.15
  • v1.0.0-beta.16
  • v1.0.0-beta.17
  • v1.0.0-beta.18
  • v1.0.0-beta.19
  • v1.0.0-beta.2
  • v1.0.0-beta.20
  • v1.0.0-beta.21
  • v1.0.0-beta.22
  • v1.0.0-beta.23
  • v1.0.0-beta.24
  • v1.0.0-beta.3
  • v1.0.0-beta.4
118 results

Target

Select target project
  • adaures/castopod
  • mkljczk/castopod-host
  • spaetz/castopod-host
  • PatrykMis/castopod
  • jonas/castopod
  • ajeremias/castopod
  • misuzu/castopod
  • KrzysztofDomanczyk/castopod
  • Behel/castopod
  • nebulon/castopod
  • ewen/castopod
  • NeoluxConsulting/castopod
  • nateritter/castopod-og
  • prcutler/castopod
14 results
Select Git revision
  • alpha
  • de
  • feat/external-chapters
  • feat/import-externals
  • main
  • master
  • refactor/base
  • v1.0.0-alpha.1
  • v1.0.0-alpha.10
  • v1.0.0-alpha.11
  • v1.0.0-alpha.12
  • v1.0.0-alpha.13
  • v1.0.0-alpha.14
  • v1.0.0-alpha.15
  • v1.0.0-alpha.16
  • v1.0.0-alpha.17
  • v1.0.0-alpha.18
  • v1.0.0-alpha.19
  • v1.0.0-alpha.2
  • v1.0.0-alpha.20
  • v1.0.0-alpha.21
  • v1.0.0-alpha.22
  • v1.0.0-alpha.23
  • v1.0.0-alpha.24
  • v1.0.0-alpha.25
  • v1.0.0-alpha.26
  • v1.0.0-alpha.27
  • v1.0.0-alpha.28
  • v1.0.0-alpha.29
  • v1.0.0-alpha.3
  • v1.0.0-alpha.30
  • v1.0.0-alpha.31
  • v1.0.0-alpha.32
  • v1.0.0-alpha.33
  • v1.0.0-alpha.34
  • v1.0.0-alpha.35
  • v1.0.0-alpha.36
  • v1.0.0-alpha.37
  • v1.0.0-alpha.38
  • v1.0.0-alpha.39
  • v1.0.0-alpha.4
  • v1.0.0-alpha.40
  • v1.0.0-alpha.41
  • v1.0.0-alpha.42
  • v1.0.0-alpha.43
  • v1.0.0-alpha.44
  • v1.0.0-alpha.45
  • v1.0.0-alpha.46
  • v1.0.0-alpha.47
  • v1.0.0-alpha.48
  • v1.0.0-alpha.49
  • v1.0.0-alpha.5
  • v1.0.0-alpha.50
  • v1.0.0-alpha.51
  • v1.0.0-alpha.52
  • v1.0.0-alpha.53
  • v1.0.0-alpha.54
  • v1.0.0-alpha.55
  • v1.0.0-alpha.56
  • v1.0.0-alpha.57
  • v1.0.0-alpha.6
  • v1.0.0-alpha.7
  • v1.0.0-alpha.8
  • v1.0.0-alpha.9
64 results
Show changes
Showing
with 1553 additions and 1875 deletions
<?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;
use Override;
class BaseMigration extends Migration
{
/**
* Database Connection instance
*
* @var BaseConnection
*/
protected $db;
#[Override]
public function up(): void
{
}
#[Override]
public function down(): void
{
}
}
<?php <?php
declare(strict_types=1);
/** /**
* Class AppSeeder * Class AppSeeder Calls all required seeders for castopod to work properly
* Calls all required seeders for castopod to work properly
* *
* @copyright 2020 Podlibre * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/ * @link https://castopod.org/
*/ */
...@@ -12,14 +13,14 @@ ...@@ -12,14 +13,14 @@
namespace App\Database\Seeds; namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder; use CodeIgniter\Database\Seeder;
use Override;
class AppSeeder extends Seeder class AppSeeder extends Seeder
{ {
public function run() #[Override]
public function run(): void
{ {
$this->call('AuthSeeder');
$this->call('CategorySeeder'); $this->call('CategorySeeder');
$this->call('LanguageSeeder'); $this->call('LanguageSeeder');
$this->call('PlatformSeeder');
} }
} }
<?php
/**
* Class PermissionSeeder
* Inserts permissions
*
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
class AuthSeeder extends Seeder
{
protected $groups = [
[
'name' => 'superadmin',
'description' =>
'Somebody who has access to all the castopod instance features',
],
[
'name' => 'podcast_admin',
'description' =>
'Somebody who has access to all the features within a given podcast',
],
];
/** Build permissions array as a list of:
*
* ```
* context => [
* [action, description],
* [action, description],
* ...
* ]
* ```
*/
protected $permissions = [
'users' => [
[
'name' => 'create',
'description' => 'Create a user',
'has_permission' => ['superadmin'],
],
[
'name' => 'list',
'description' => 'List all users',
'has_permission' => ['superadmin'],
],
[
'name' => 'view',
'description' => 'View any user info',
'has_permission' => ['superadmin'],
],
[
'name' => 'manage_authorizations',
'description' => 'Add or remove roles/permissions to a user',
'has_permission' => ['superadmin'],
],
[
'name' => 'manage_bans',
'description' => 'Ban / unban a user',
'has_permission' => ['superadmin'],
],
[
'name' => 'force_pass_reset',
'description' =>
'Force a user to update his password upon next login',
'has_permission' => ['superadmin'],
],
[
'name' => 'delete',
'description' =>
'Delete user without removing him from database',
'has_permission' => ['superadmin'],
],
[
'name' => 'delete_permanently',
'description' =>
'Delete all occurrences of a user from the database',
'has_permission' => ['superadmin'],
],
],
'pages' => [
[
'name' => 'manage',
'description' => 'List / create / edit / delete pages',
'has_permission' => ['superadmin'],
],
],
'podcasts' => [
[
'name' => 'create',
'description' => 'Add a new podcast',
'has_permission' => ['superadmin'],
],
[
'name' => 'import',
'description' => 'Import a new podcast from an external feed',
'has_permission' => ['superadmin'],
],
[
'name' => 'list',
'description' => 'List all podcasts and their episodes',
'has_permission' => ['superadmin'],
],
[
'name' => 'view',
'description' => 'View any podcast and their contributors list',
'has_permission' => ['superadmin'],
],
[
'name' => 'delete',
'description' =>
'Delete a podcast without removing it from database',
'has_permission' => ['superadmin'],
],
[
'name' => 'delete_permanently',
'description' => 'Delete any podcast from the database',
'has_permission' => ['superadmin'],
],
],
'episodes' => [
[
'name' => 'list',
'description' => 'List all episodes of any podcast',
'has_permission' => ['superadmin'],
],
[
'name' => 'view',
'description' => 'View any episode of any podcast',
'has_permission' => ['superadmin'],
],
],
'podcast' => [
[
'name' => 'view',
'description' => 'View a podcast',
'has_permission' => ['podcast_admin'],
],
[
'name' => 'edit',
'description' => 'Edit a podcast',
'has_permission' => ['podcast_admin'],
],
[
'name' => 'manage_contributors',
'description' =>
'Add / remove contributors to a podcast and edit their roles',
'has_permission' => ['podcast_admin'],
],
[
'name' => 'manage_platforms',
'description' => 'Set / remove platform links of a podcast',
'has_permission' => ['podcast_admin'],
],
],
'podcast_episodes' => [
[
'name' => 'list',
'description' => 'List all episodes of a podcast',
'has_permission' => ['podcast_admin'],
],
[
'name' => 'view',
'description' => 'View any episode of a podcast',
'has_permission' => ['podcast_admin'],
],
[
'name' => 'create',
'description' => 'Add new episodes for a podcast',
'has_permission' => ['podcast_admin'],
],
[
'name' => 'edit',
'description' => 'Edit an episode of a podcast',
'has_permission' => ['podcast_admin'],
],
[
'name' => 'delete',
'description' =>
'Delete an episode of a podcast without removing it from the database',
'has_permission' => ['podcast_admin'],
],
[
'name' => 'delete_permanently',
'description' =>
'Delete all occurrences of an episode of a podcast from the database',
'has_permission' => ['podcast_admin'],
],
[
'name' => 'manage_publications',
'description' => 'Publish / unpublish episodes of a podcast',
'has_permission' => ['podcast_admin'],
],
],
'person' => [
[
'name' => 'create',
'description' => 'Add a new person',
'has_permission' => ['superadmin'],
],
[
'name' => 'list',
'description' => 'List all persons',
'has_permission' => ['superadmin'],
],
[
'name' => 'view',
'description' => 'View any person',
'has_permission' => ['superadmin'],
],
[
'name' => 'edit',
'description' => 'Edit a person',
'has_permission' => ['superadmin'],
],
[
'name' => 'delete_permanently',
'description' => 'Delete any person from the database',
'has_permission' => ['superadmin'],
],
],
];
static function getGroupIdByName($name, $dataGroups)
{
foreach ($dataGroups as $group) {
if ($group['name'] === $name) {
return $group['id'];
}
}
return null;
}
public function run()
{
$groupId = 0;
$dataGroups = [];
foreach ($this->groups as $group) {
array_push($dataGroups, [
'id' => ++$groupId,
'name' => $group['name'],
'description' => $group['description'],
]);
}
// Map permissions to a format the `auth_permissions` table expects
$dataPermissions = [];
$dataGroupsPermissions = [];
$permissionId = 0;
foreach ($this->permissions as $context => $actions) {
foreach ($actions as $action) {
array_push($dataPermissions, [
'id' => ++$permissionId,
'name' => $context . '-' . $action['name'],
'description' => $action['description'],
]);
foreach ($action['has_permission'] as $role) {
// link permission to specified groups
array_push($dataGroupsPermissions, [
'group_id' => $this->getGroupIdByName(
$role,
$dataGroups
),
'permission_id' => $permissionId,
]);
}
}
}
$this->db
->table('auth_permissions')
->ignore(true)
->insertBatch($dataPermissions);
$this->db
->table('auth_groups')
->ignore(true)
->insertBatch($dataGroups);
$this->db
->table('auth_groups_permissions')
->ignore(true)
->insertBatch($dataGroupsPermissions);
}
}
<?php <?php
declare(strict_types=1);
/** /**
* Class CategorySeeder * Class CategorySeeder Inserts values in categories table in database
* Inserts values in categories table in database
* *
* @copyright 2020 Podlibre * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/ * @link https://castopod.org/
*/ */
...@@ -12,794 +13,791 @@ ...@@ -12,794 +13,791 @@
namespace App\Database\Seeds; namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder; use CodeIgniter\Database\Seeder;
use Override;
class CategorySeeder extends Seeder class CategorySeeder extends Seeder
{ {
public function run() #[Override]
public function run(): void
{ {
$data = [ $data = [
[ [
'parent_id' => 0, 'id' => 1,
'id' => 0, 'parent_id' => null,
'code' => 'uncategorized', 'code' => 'arts',
'apple_category' => 'uncategorized', 'apple_category' => 'Arts',
'google_category' => 'uncategorized',
],
[
'parent_id' => 0,
'id' => 1,
'code' => 'arts',
'apple_category' => 'Arts',
'google_category' => 'Arts', 'google_category' => 'Arts',
], ],
[ [
'parent_id' => 0, 'id' => 2,
'id' => 2, 'parent_id' => null,
'code' => 'business', 'code' => 'business',
'apple_category' => 'Business', 'apple_category' => 'Business',
'google_category' => 'Business', 'google_category' => 'Business',
], ],
[ [
'parent_id' => 0, 'id' => 3,
'id' => 3, 'parent_id' => null,
'code' => 'comedy', 'code' => 'comedy',
'apple_category' => 'Comedy', 'apple_category' => 'Comedy',
'google_category' => 'Comedy', 'google_category' => 'Comedy',
], ],
[ [
'parent_id' => 0, 'id' => 4,
'id' => 4, 'parent_id' => null,
'code' => 'education', 'code' => 'education',
'apple_category' => 'Education', 'apple_category' => 'Education',
'google_category' => 'Education', 'google_category' => 'Education',
], ],
[ [
'parent_id' => 0, 'id' => 5,
'id' => 5, 'parent_id' => null,
'code' => 'fiction', 'code' => 'fiction',
'apple_category' => 'Fiction', 'apple_category' => 'Fiction',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 0, 'id' => 6,
'id' => 6, 'parent_id' => null,
'code' => 'government', 'code' => 'government',
'apple_category' => 'Government', 'apple_category' => 'Government',
'google_category' => 'Government & Organizations', 'google_category' => 'Government & Organizations',
], ],
[ [
'parent_id' => 0, 'id' => 7,
'id' => 7, 'parent_id' => null,
'code' => 'health_and_fitness', 'code' => 'health_and_fitness',
'apple_category' => 'Health & Fitness', 'apple_category' => 'Health & Fitness',
'google_category' => 'Health', 'google_category' => 'Health',
], ],
[ [
'parent_id' => 0, 'id' => 8,
'id' => 8, 'parent_id' => null,
'code' => 'history', 'code' => 'history',
'apple_category' => 'History', 'apple_category' => 'History',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 0, 'id' => 9,
'id' => 9, 'parent_id' => null,
'code' => 'kids_and_family', 'code' => 'kids_and_family',
'apple_category' => 'Kids & Family', 'apple_category' => 'Kids & Family',
'google_category' => 'Kids & Family', 'google_category' => 'Kids & Family',
], ],
[ [
'parent_id' => 0, 'id' => 10,
'id' => 10, 'parent_id' => null,
'code' => 'leisure', 'code' => 'leisure',
'apple_category' => 'Leisure', 'apple_category' => 'Leisure',
'google_category' => 'Games & Hobbies', 'google_category' => 'Games & Hobbies',
], ],
[ [
'parent_id' => 0, 'id' => 11,
'id' => 11, 'parent_id' => null,
'code' => 'music', 'code' => 'music',
'apple_category' => 'Music', 'apple_category' => 'Music',
'google_category' => 'Music', 'google_category' => 'Music',
], ],
[ [
'parent_id' => 0, 'id' => 12,
'id' => 12, 'parent_id' => null,
'code' => 'news', 'code' => 'news',
'apple_category' => 'News', 'apple_category' => 'News',
'google_category' => 'News & Politics', 'google_category' => 'News & Politics',
], ],
[ [
'parent_id' => 0, 'id' => 13,
'id' => 13, 'parent_id' => null,
'code' => 'religion_and_spirituality', 'code' => 'religion_and_spirituality',
'apple_category' => 'Religion & Spirituality', 'apple_category' => 'Religion & Spirituality',
'google_category' => 'Religion & Spirituality', 'google_category' => 'Religion & Spirituality',
], ],
[ [
'parent_id' => 0, 'id' => 14,
'id' => 14, 'parent_id' => null,
'code' => 'science', 'code' => 'science',
'apple_category' => 'Science', 'apple_category' => 'Science',
'google_category' => 'Science & Medicine', 'google_category' => 'Science & Medicine',
], ],
[ [
'parent_id' => 0, 'id' => 15,
'id' => 15, 'parent_id' => null,
'code' => 'society_and_culture', 'code' => 'society_and_culture',
'apple_category' => 'Society & Culture', 'apple_category' => 'Society & Culture',
'google_category' => 'Society & Culture', 'google_category' => 'Society & Culture',
], ],
[ [
'parent_id' => 0, 'id' => 16,
'id' => 16, 'parent_id' => null,
'code' => 'sports', 'code' => 'sports',
'apple_category' => 'Sports', 'apple_category' => 'Sports',
'google_category' => 'Sports & Recreation', 'google_category' => 'Sports & Recreation',
], ],
[ [
'parent_id' => 0, 'id' => 17,
'id' => 17, 'parent_id' => null,
'code' => 'technology', 'code' => 'technology',
'apple_category' => 'Technology', 'apple_category' => 'Technology',
'google_category' => 'Technology', 'google_category' => 'Technology',
], ],
[ [
'parent_id' => 0, 'id' => 18,
'id' => 18, 'parent_id' => null,
'code' => 'true_crime', 'code' => 'true_crime',
'apple_category' => 'True Crime', 'apple_category' => 'True Crime',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 0, 'id' => 19,
'id' => 19, 'parent_id' => null,
'code' => 'tv_and_film', 'code' => 'tv_and_film',
'apple_category' => 'TV & Film', 'apple_category' => 'TV & Film',
'google_category' => 'TV & Film', 'google_category' => 'TV & Film',
], ],
[ [
'parent_id' => 1, 'id' => 20,
'id' => 20, 'parent_id' => 1,
'code' => 'books', 'code' => 'books',
'apple_category' => 'Books', 'apple_category' => 'Books',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 1, 'id' => 21,
'id' => 21, 'parent_id' => 1,
'code' => 'design', 'code' => 'design',
'apple_category' => 'Design', 'apple_category' => 'Design',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 1, 'id' => 22,
'id' => 22, 'parent_id' => 1,
'code' => 'fashion_and_beauty', 'code' => 'fashion_and_beauty',
'apple_category' => 'Fashion & Beauty', 'apple_category' => 'Fashion & Beauty',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 1, 'id' => 23,
'id' => 23, 'parent_id' => 1,
'code' => 'food', 'code' => 'food',
'apple_category' => 'Food', 'apple_category' => 'Food',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 1, 'id' => 24,
'id' => 24, 'parent_id' => 1,
'code' => 'performing_arts', 'code' => 'performing_arts',
'apple_category' => 'Performing Arts', 'apple_category' => 'Performing Arts',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 1, 'id' => 25,
'id' => 25, 'parent_id' => 1,
'code' => 'visual_arts', 'code' => 'visual_arts',
'apple_category' => 'Visual Arts', 'apple_category' => 'Visual Arts',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 2, 'id' => 26,
'id' => 26, 'parent_id' => 2,
'code' => 'careers', 'code' => 'careers',
'apple_category' => 'Careers', 'apple_category' => 'Careers',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 2, 'id' => 27,
'id' => 27, 'parent_id' => 2,
'code' => 'entrepreneurship', 'code' => 'entrepreneurship',
'apple_category' => 'Entrepreneurship', 'apple_category' => 'Entrepreneurship',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 2, 'id' => 28,
'id' => 28, 'parent_id' => 2,
'code' => 'investing', 'code' => 'investing',
'apple_category' => 'Investing', 'apple_category' => 'Investing',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 2, 'id' => 29,
'id' => 29, 'parent_id' => 2,
'code' => 'management', 'code' => 'management',
'apple_category' => 'Management', 'apple_category' => 'Management',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 2, 'id' => 30,
'id' => 30, 'parent_id' => 2,
'code' => 'marketing', 'code' => 'marketing',
'apple_category' => 'Marketing', 'apple_category' => 'Marketing',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 2, 'id' => 31,
'id' => 31, 'parent_id' => 2,
'code' => 'non_profit', 'code' => 'non_profit',
'apple_category' => 'Non-Profit', 'apple_category' => 'Non-Profit',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 3, 'id' => 32,
'id' => 32, 'parent_id' => 3,
'code' => 'comedy_interviews', 'code' => 'comedy_interviews',
'apple_category' => 'Comedy Interviews', 'apple_category' => 'Comedy Interviews',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 3, 'id' => 33,
'id' => 33, 'parent_id' => 3,
'code' => 'improv', 'code' => 'improv',
'apple_category' => 'Improv', 'apple_category' => 'Improv',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 3, 'id' => 34,
'id' => 34, 'parent_id' => 3,
'code' => 'stand_up', 'code' => 'stand_up',
'apple_category' => 'Stand-Up', 'apple_category' => 'Stand-Up',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 4, 'id' => 35,
'id' => 35, 'parent_id' => 4,
'code' => 'courses', 'code' => 'courses',
'apple_category' => 'Courses', 'apple_category' => 'Courses',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 4, 'id' => 36,
'id' => 36, 'parent_id' => 4,
'code' => 'how_to', 'code' => 'how_to',
'apple_category' => 'How To', 'apple_category' => 'How To',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 4, 'id' => 37,
'id' => 37, 'parent_id' => 4,
'code' => 'language_learning', 'code' => 'language_learning',
'apple_category' => 'Language Learning', 'apple_category' => 'Language Learning',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 4, 'id' => 38,
'id' => 38, 'parent_id' => 4,
'code' => 'self_improvement', 'code' => 'self_improvement',
'apple_category' => 'Self-Improvement', 'apple_category' => 'Self-Improvement',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 5, 'id' => 39,
'id' => 39, 'parent_id' => 5,
'code' => 'comedy_fiction', 'code' => 'comedy_fiction',
'apple_category' => 'Comedy Fiction', 'apple_category' => 'Comedy Fiction',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 5, 'id' => 40,
'id' => 40, 'parent_id' => 5,
'code' => 'drama', 'code' => 'drama',
'apple_category' => 'Drama', 'apple_category' => 'Drama',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 5, 'id' => 41,
'id' => 41, 'parent_id' => 5,
'code' => 'science_fiction', 'code' => 'science_fiction',
'apple_category' => 'Science Fiction', 'apple_category' => 'Science Fiction',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 7, 'id' => 42,
'id' => 42, 'parent_id' => 7,
'code' => 'alternative_health', 'code' => 'alternative_health',
'apple_category' => 'Alternative Health', 'apple_category' => 'Alternative Health',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 7, 'id' => 43,
'id' => 43, 'parent_id' => 7,
'code' => 'fitness', 'code' => 'fitness',
'apple_category' => 'Fitness', 'apple_category' => 'Fitness',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 7, 'id' => 44,
'id' => 44, 'parent_id' => 7,
'code' => 'medicine', 'code' => 'medicine',
'apple_category' => 'Medicine', 'apple_category' => 'Medicine',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 7, 'id' => 45,
'id' => 45, 'parent_id' => 7,
'code' => 'mental_health', 'code' => 'mental_health',
'apple_category' => 'Mental Health', 'apple_category' => 'Mental Health',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 7, 'id' => 46,
'id' => 46, 'parent_id' => 7,
'code' => 'nutrition', 'code' => 'nutrition',
'apple_category' => 'Nutrition', 'apple_category' => 'Nutrition',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 7, 'id' => 47,
'id' => 47, 'parent_id' => 7,
'code' => 'sexuality', 'code' => 'sexuality',
'apple_category' => 'Sexuality', 'apple_category' => 'Sexuality',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 9, 'id' => 48,
'id' => 48, 'parent_id' => 9,
'code' => 'education_for_kids', 'code' => 'education_for_kids',
'apple_category' => 'Education for Kids', 'apple_category' => 'Education for Kids',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 9, 'id' => 49,
'id' => 49, 'parent_id' => 9,
'code' => 'parenting', 'code' => 'parenting',
'apple_category' => 'Parenting', 'apple_category' => 'Parenting',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 9, 'id' => 50,
'id' => 50, 'parent_id' => 9,
'code' => 'pets_and_animals', 'code' => 'pets_and_animals',
'apple_category' => 'Pets & Animals', 'apple_category' => 'Pets & Animals',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 9, 'id' => 51,
'id' => 51, 'parent_id' => 9,
'code' => 'stories_for_kids', 'code' => 'stories_for_kids',
'apple_category' => 'Stories for Kids', 'apple_category' => 'Stories for Kids',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 10, 'id' => 52,
'id' => 52, 'parent_id' => 10,
'code' => 'animation_and_manga', 'code' => 'animation_and_manga',
'apple_category' => 'Animation & Manga', 'apple_category' => 'Animation & Manga',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 10, 'id' => 53,
'id' => 53, 'parent_id' => 10,
'code' => 'automotive', 'code' => 'automotive',
'apple_category' => 'Automotive', 'apple_category' => 'Automotive',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 10, 'id' => 54,
'id' => 54, 'parent_id' => 10,
'code' => 'aviation', 'code' => 'aviation',
'apple_category' => 'Aviation', 'apple_category' => 'Aviation',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 10, 'id' => 55,
'id' => 55, 'parent_id' => 10,
'code' => 'crafts', 'code' => 'crafts',
'apple_category' => 'Crafts', 'apple_category' => 'Crafts',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 10, 'id' => 56,
'id' => 56, 'parent_id' => 10,
'code' => 'games', 'code' => 'games',
'apple_category' => 'Games', 'apple_category' => 'Games',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 10, 'id' => 57,
'id' => 57, 'parent_id' => 10,
'code' => 'hobbies', 'code' => 'hobbies',
'apple_category' => 'Hobbies', 'apple_category' => 'Hobbies',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 10, 'id' => 58,
'id' => 58, 'parent_id' => 10,
'code' => 'home_and_garden', 'code' => 'home_and_garden',
'apple_category' => 'Home & Garden', 'apple_category' => 'Home & Garden',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 10, 'id' => 59,
'id' => 59, 'parent_id' => 10,
'code' => 'video_games', 'code' => 'video_games',
'apple_category' => 'Video Games', 'apple_category' => 'Video Games',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 11, 'id' => 60,
'id' => 60, 'parent_id' => 11,
'code' => 'music_commentary', 'code' => 'music_commentary',
'apple_category' => 'Music Commentary', 'apple_category' => 'Music Commentary',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 11, 'id' => 61,
'id' => 61, 'parent_id' => 11,
'code' => 'music_history', 'code' => 'music_history',
'apple_category' => 'Music History', 'apple_category' => 'Music History',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 11, 'id' => 62,
'id' => 62, 'parent_id' => 11,
'code' => 'music_interviews', 'code' => 'music_interviews',
'apple_category' => 'Music Interviews', 'apple_category' => 'Music Interviews',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 12, 'id' => 63,
'id' => 63, 'parent_id' => 12,
'code' => 'business_news', 'code' => 'business_news',
'apple_category' => 'Business News', 'apple_category' => 'Business News',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 12, 'id' => 64,
'id' => 64, 'parent_id' => 12,
'code' => 'daily_news', 'code' => 'daily_news',
'apple_category' => 'Daily News', 'apple_category' => 'Daily News',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 12, 'id' => 65,
'id' => 65, 'parent_id' => 12,
'code' => 'entertainment_news', 'code' => 'entertainment_news',
'apple_category' => 'Entertainment News', 'apple_category' => 'Entertainment News',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 12, 'id' => 66,
'id' => 66, 'parent_id' => 12,
'code' => 'news_commentary', 'code' => 'news_commentary',
'apple_category' => 'News Commentary', 'apple_category' => 'News Commentary',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 12, 'id' => 67,
'id' => 67, 'parent_id' => 12,
'code' => 'politics', 'code' => 'politics',
'apple_category' => 'Politics', 'apple_category' => 'Politics',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 12, 'id' => 68,
'id' => 68, 'parent_id' => 12,
'code' => 'sports_news', 'code' => 'sports_news',
'apple_category' => 'Sports News', 'apple_category' => 'Sports News',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 12, 'id' => 69,
'id' => 69, 'parent_id' => 12,
'code' => 'tech_news', 'code' => 'tech_news',
'apple_category' => 'Tech News', 'apple_category' => 'Tech News',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 13, 'id' => 70,
'id' => 70, 'parent_id' => 13,
'code' => 'buddhism', 'code' => 'buddhism',
'apple_category' => 'Buddhism', 'apple_category' => 'Buddhism',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 13, 'id' => 71,
'id' => 71, 'parent_id' => 13,
'code' => 'christianity', 'code' => 'christianity',
'apple_category' => 'Christianity', 'apple_category' => 'Christianity',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 13, 'id' => 72,
'id' => 72, 'parent_id' => 13,
'code' => 'hinduism', 'code' => 'hinduism',
'apple_category' => 'Hinduism', 'apple_category' => 'Hinduism',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 13, 'id' => 73,
'id' => 73, 'parent_id' => 13,
'code' => 'islam', 'code' => 'islam',
'apple_category' => 'Islam', 'apple_category' => 'Islam',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 13, 'id' => 74,
'id' => 74, 'parent_id' => 13,
'code' => 'judaism', 'code' => 'judaism',
'apple_category' => 'Judaism', 'apple_category' => 'Judaism',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 13, 'id' => 75,
'id' => 75, 'parent_id' => 13,
'code' => 'religion', 'code' => 'religion',
'apple_category' => 'Religion', 'apple_category' => 'Religion',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 13, 'id' => 76,
'id' => 76, 'parent_id' => 13,
'code' => 'spirituality', 'code' => 'spirituality',
'apple_category' => 'Spirituality', 'apple_category' => 'Spirituality',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 14, 'id' => 77,
'id' => 77, 'parent_id' => 14,
'code' => 'astronomy', 'code' => 'astronomy',
'apple_category' => 'Astronomy', 'apple_category' => 'Astronomy',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 14, 'id' => 78,
'id' => 78, 'parent_id' => 14,
'code' => 'chemistry', 'code' => 'chemistry',
'apple_category' => 'Chemistry', 'apple_category' => 'Chemistry',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 14, 'id' => 79,
'id' => 79, 'parent_id' => 14,
'code' => 'earth_sciences', 'code' => 'earth_sciences',
'apple_category' => 'Earth Sciences', 'apple_category' => 'Earth Sciences',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 14, 'id' => 80,
'id' => 80, 'parent_id' => 14,
'code' => 'life_sciences', 'code' => 'life_sciences',
'apple_category' => 'Life Sciences', 'apple_category' => 'Life Sciences',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 14, 'id' => 81,
'id' => 81, 'parent_id' => 14,
'code' => 'mathematics', 'code' => 'mathematics',
'apple_category' => 'Mathematics', 'apple_category' => 'Mathematics',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 14, 'id' => 82,
'id' => 82, 'parent_id' => 14,
'code' => 'natural_sciences', 'code' => 'natural_sciences',
'apple_category' => 'Natural Sciences', 'apple_category' => 'Natural Sciences',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 14, 'id' => 83,
'id' => 83, 'parent_id' => 14,
'code' => 'nature', 'code' => 'nature',
'apple_category' => 'Nature', 'apple_category' => 'Nature',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 14, 'id' => 84,
'id' => 84, 'parent_id' => 14,
'code' => 'physics', 'code' => 'physics',
'apple_category' => 'Physics', 'apple_category' => 'Physics',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 14, 'id' => 85,
'id' => 85, 'parent_id' => 14,
'code' => 'social_sciences', 'code' => 'social_sciences',
'apple_category' => 'Social Sciences', 'apple_category' => 'Social Sciences',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 15, 'id' => 86,
'id' => 86, 'parent_id' => 15,
'code' => 'documentary', 'code' => 'documentary',
'apple_category' => 'Documentary', 'apple_category' => 'Documentary',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 15, 'id' => 87,
'id' => 87, 'parent_id' => 15,
'code' => 'personal_journals', 'code' => 'personal_journals',
'apple_category' => 'Personal Journals', 'apple_category' => 'Personal Journals',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 15, 'id' => 88,
'id' => 88, 'parent_id' => 15,
'code' => 'philosophy', 'code' => 'philosophy',
'apple_category' => 'Philosophy', 'apple_category' => 'Philosophy',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 15, 'id' => 89,
'id' => 89, 'parent_id' => 15,
'code' => 'places_and_travel', 'code' => 'places_and_travel',
'apple_category' => 'Places & Travel', 'apple_category' => 'Places & Travel',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 15, 'id' => 90,
'id' => 90, 'parent_id' => 15,
'code' => 'relationships', 'code' => 'relationships',
'apple_category' => 'Relationships', 'apple_category' => 'Relationships',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 91,
'id' => 91, 'parent_id' => 16,
'code' => 'baseball', 'code' => 'baseball',
'apple_category' => 'Baseball', 'apple_category' => 'Baseball',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 92,
'id' => 92, 'parent_id' => 16,
'code' => 'basketball', 'code' => 'basketball',
'apple_category' => 'Basketball', 'apple_category' => 'Basketball',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 93,
'id' => 93, 'parent_id' => 16,
'code' => 'cricket', 'code' => 'cricket',
'apple_category' => 'Cricket', 'apple_category' => 'Cricket',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 94,
'id' => 94, 'parent_id' => 16,
'code' => 'fantasy_sports', 'code' => 'fantasy_sports',
'apple_category' => 'Fantasy Sports', 'apple_category' => 'Fantasy Sports',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 95,
'id' => 95, 'parent_id' => 16,
'code' => 'football', 'code' => 'football',
'apple_category' => 'Football', 'apple_category' => 'Football',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 96,
'id' => 96, 'parent_id' => 16,
'code' => 'golf', 'code' => 'golf',
'apple_category' => 'Golf', 'apple_category' => 'Golf',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 97,
'id' => 97, 'parent_id' => 16,
'code' => 'hockey', 'code' => 'hockey',
'apple_category' => 'Hockey', 'apple_category' => 'Hockey',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 98,
'id' => 98, 'parent_id' => 16,
'code' => 'rugby', 'code' => 'rugby',
'apple_category' => 'Rugby', 'apple_category' => 'Rugby',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 99,
'id' => 99, 'parent_id' => 16,
'code' => 'running', 'code' => 'running',
'apple_category' => 'Running', 'apple_category' => 'Running',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 100,
'id' => 100, 'parent_id' => 16,
'code' => 'soccer', 'code' => 'soccer',
'apple_category' => 'Soccer', 'apple_category' => 'Soccer',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 101,
'id' => 101, 'parent_id' => 16,
'code' => 'swimming', 'code' => 'swimming',
'apple_category' => 'Swimming', 'apple_category' => 'Swimming',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 102,
'id' => 102, 'parent_id' => 16,
'code' => 'tennis', 'code' => 'tennis',
'apple_category' => 'Tennis', 'apple_category' => 'Tennis',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 103,
'id' => 103, 'parent_id' => 16,
'code' => 'volleyball', 'code' => 'volleyball',
'apple_category' => 'Volleyball', 'apple_category' => 'Volleyball',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 104,
'id' => 104, 'parent_id' => 16,
'code' => 'wilderness', 'code' => 'wilderness',
'apple_category' => 'Wilderness', 'apple_category' => 'Wilderness',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 16, 'id' => 105,
'id' => 105, 'parent_id' => 16,
'code' => 'wrestling', 'code' => 'wrestling',
'apple_category' => 'Wrestling', 'apple_category' => 'Wrestling',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 19, 'id' => 106,
'id' => 106, 'parent_id' => 19,
'code' => 'after_shows', 'code' => 'after_shows',
'apple_category' => 'After Shows', 'apple_category' => 'After Shows',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 19, 'id' => 107,
'id' => 107, 'parent_id' => 19,
'code' => 'film_history', 'code' => 'film_history',
'apple_category' => 'Film History', 'apple_category' => 'Film History',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 19, 'id' => 108,
'id' => 108, 'parent_id' => 19,
'code' => 'film_interviews', 'code' => 'film_interviews',
'apple_category' => 'Film Interviews', 'apple_category' => 'Film Interviews',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 19, 'id' => 109,
'id' => 109, 'parent_id' => 19,
'code' => 'film_reviews', 'code' => 'film_reviews',
'apple_category' => 'Film Reviews', 'apple_category' => 'Film Reviews',
'google_category' => '', 'google_category' => '',
], ],
[ [
'parent_id' => 19, 'id' => 110,
'id' => 110, 'parent_id' => 19,
'code' => 'tv_reviews', 'code' => 'tv_reviews',
'apple_category' => 'TV Reviews', 'apple_category' => 'TV Reviews',
'google_category' => '', 'google_category' => '',
], ],
]; ];
$this->db foreach ($data as $categoryLine) {
->table('categories') $this->db
->ignore(true) ->table('categories')
->insertBatch($data); ->ignore(true)
->insert($categoryLine);
}
} }
} }
<?php
declare(strict_types=1);
/**
* Class AppSeeder Calls all required seeders for castopod to work properly
*
* @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
use Override;
class DevSeeder extends Seeder
{
#[Override]
public function run(): void
{
$this->call('CategorySeeder');
$this->call('LanguageSeeder');
$this->call('DevSuperadminSeeder');
}
}
<?php
declare(strict_types=1);
/**
* Class TestSeeder Inserts a superadmin user in the database
*
* @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
use CodeIgniter\Shield\Entities\User;
use Modules\Auth\Models\UserModel;
use Override;
class DevSuperadminSeeder extends Seeder
{
#[Override]
public function run(): void
{
if ((new UserModel())->where('is_owner', true)->first() instanceof User) {
return;
}
/**
* Inserts an owner with the following credentials: admin: `admin@example.com` password: `castopod`
*/
// Get the User Provider (UserModel by default)
$users = auth()
->getProvider();
$user = new User([
'username' => 'admin',
'email' => 'admin@castopod.local',
'password' => 'castopod',
'is_owner' => true,
]);
$users->save($user);
// To get the complete user object with ID, we need to get from the database
$user = $users->findById($users->getInsertID());
$user->addGroup(setting('AuthGroups.mostPowerfulGroup'));
}
}
<?php <?php
declare(strict_types=1);
/** /**
* Class FakePodcastsAnalyticsSeeder * Class FakePodcastsAnalyticsSeeder Inserts Fake Analytics in the database
* Inserts Fake Analytics in the database
* *
* @copyright 2020 Podlibre * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/ * @link https://castopod.org/
*/ */
namespace App\Database\Seeds; namespace App\Database\Seeds;
use App\Models\PodcastModel;
use App\Models\EpisodeModel;
use App\Entities\Episode;
use App\Entities\Podcast;
use App\Models\EpisodeModel;
use App\Models\PodcastModel;
use CodeIgniter\Database\Seeder; use CodeIgniter\Database\Seeder;
use Exception;
use GeoIp2\Database\Reader;
use GeoIp2\Exception\AddressNotFoundException;
use Override;
class FakePodcastsAnalyticsSeeder extends Seeder class FakePodcastsAnalyticsSeeder extends Seeder
{ {
public function run() #[Override]
public function run(): void
{ {
$podcast = (new PodcastModel())->first();
$jsonUserAgents = json_decode( $jsonUserAgents = json_decode(
file_get_contents( file_get_contents('https://raw.githubusercontent.com/opawg/user-agents/master/src/user-agents.json'),
'https://raw.githubusercontent.com/opawg/user-agents/master/src/user-agents.json' true,
), 512,
true JSON_THROW_ON_ERROR,
); );
$jsonRSSUserAgents = json_decode( $jsonRSSUserAgents = json_decode(
file_get_contents( file_get_contents(
'https://raw.githubusercontent.com/opawg/podcast-rss-useragents/master/src/rss-ua.json' 'https://raw.githubusercontent.com/opawg/podcast-rss-useragents/master/src/rss-ua.json',
), ),
true true,
512,
JSON_THROW_ON_ERROR,
); );
if ($podcast) { $podcast = (new PodcastModel())->first();
$firstEpisode = (new EpisodeModel())
->selectMin('published_at') if (! $podcast instanceof Podcast) {
->first(); throw new Exception("COULD NOT POPULATE DATABASE:\n\tCreate a podcast with episodes first.\n");
}
for (
$date = strtotime($firstEpisode->published_at); $firstEpisode = (new EpisodeModel())
$date < strtotime('now'); ->selectMin('published_at')
$date = strtotime(date('Y-m-d', $date) . ' +1 day') ->first();
) {
$analytics_podcasts = []; if (! $firstEpisode instanceof Episode) {
$analytics_podcasts_by_hour = []; throw new Exception("COULD NOT POPULATE DATABASE:\n\tCreate an episode first.");
$analytics_podcasts_by_country = []; }
$analytics_podcasts_by_episode = [];
$analytics_podcasts_by_player = []; for (
$analytics_podcasts_by_region = []; $date = strtotime((string) $firstEpisode->published_at);
$date < strtotime('now');
$episodes = (new EpisodeModel()) $date = strtotime(date('Y-m-d', $date) . ' +1 day')
->where([ ) {
'podcast_id' => $podcast->id, $analyticsPodcasts = [];
'DATE(published_at) <=' => date('Y-m-d', $date), $analyticsPodcastsByHour = [];
]) $analyticsPodcastsByCountry = [];
->findAll(); $analyticsPodcastsByEpisode = [];
foreach ($episodes as $episode) { $analyticsPodcastsByPlayer = [];
$age = floor( $analyticsPodcastsByRegion = [];
($date - strtotime($episode->published_at)) / 86400
); $episodes = (new EpisodeModel())
$proba1 = floor(exp(3 - $age / 40)) + 1; ->where('podcast_id', $podcast->id)
->where('`published_at` <= UTC_TIMESTAMP()', null, false)
for ( ->findAll();
$num_line = 0; foreach ($episodes as $episode) {
$num_line < rand(1, $proba1); $age = floor(($date - strtotime((string) $episode->published_at)) / 86400);
$num_line++ $probability1 = floor(exp(3 - $age / 40)) + 1;
) {
$proba2 = floor(exp(6 - $age / 20)) + 10; for (
$lineNumber = 0;
$player = $lineNumber < random_int(1, (int) $probability1);
$jsonUserAgents[ ++$lineNumber
rand(1, count($jsonUserAgents) - 1) ) {
]; $probability2 = floor(exp(6 - $age / 20)) + 10;
$service =
$jsonRSSUserAgents[ $player =
rand(1, count($jsonRSSUserAgents) - 1) $jsonUserAgents[
]['slug']; random_int(1, count($jsonUserAgents) - 1)
$app = isset($player['app']) ? $player['app'] : '';
$device = isset($player['device'])
? $player['device']
: '';
$os = isset($player['os']) ? $player['os'] : '';
$isBot = isset($player['bot']) ? $player['bot'] : 0;
$fakeIp =
rand(0, 255) .
'.' .
rand(0, 255) .
'.' .
rand(0, 255) .
'.' .
rand(0, 255);
$cityReader = new \GeoIp2\Database\Reader(
WRITEPATH .
'uploads/GeoLite2-City/GeoLite2-City.mmdb'
);
$countryCode = 'N/A';
$regionCode = 'N/A';
$latitude = null;
$longitude = null;
try {
$city = $cityReader->city($fakeIp);
$countryCode = empty($city->country->isoCode)
? 'N/A'
: $city->country->isoCode;
$regionCode = empty($city->subdivisions[0]->isoCode)
? 'N/A'
: $city->subdivisions[0]->isoCode;
$latitude = round($city->location->latitude, 3);
$longitude = round($city->location->longitude, 3);
} catch (\GeoIp2\Exception\AddressNotFoundException $ex) {
//Bad luck, bad IP, nothing to do.
}
$hits = rand(0, $proba2);
$analytics_podcasts[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'duration' => rand(60, 3600),
'bandwidth' => rand(1000000, 10000000),
'hits' => $hits,
'unique_listeners' => $hits,
];
$analytics_podcasts_by_hour[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'hour' => rand(0, 23),
'hits' => $hits,
];
$analytics_podcasts_by_country[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'country_code' => $countryCode,
'hits' => $hits,
];
$analytics_podcasts_by_episode[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'episode_id' => $episode->id,
'age' => $age,
'hits' => $hits,
];
$analytics_podcasts_by_player[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'service' => $service,
'app' => $app,
'device' => $device,
'os' => $os,
'is_bot' => $isBot,
'hits' => $hits,
];
$analytics_podcasts_by_region[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'country_code' => $countryCode,
'region_code' => $regionCode,
'latitude' => $latitude,
'longitude' => $longitude,
'hits' => $hits,
]; ];
$service =
$jsonRSSUserAgents[
random_int(1, count($jsonRSSUserAgents) - 1)
]['slug'];
$app = $player['app'] ?? '';
$device = $player['device'] ?? '';
$os = $player['os'] ?? '';
$isBot = $player['bot'] ?? 0;
$fakeIp =
random_int(0, 255) .
'.' .
random_int(0, 255) .
'.' .
random_int(0, 255) .
'.' .
random_int(0, 255);
$cityReader = new Reader(WRITEPATH . 'uploads/GeoLite2-City/GeoLite2-City.mmdb');
$countryCode = 'N/A';
$regionCode = 'N/A';
$latitude = null;
$longitude = null;
try {
$city = $cityReader->city($fakeIp);
$countryCode = $city->country->isoCode ?? 'N/A';
$regionCode = $city->subdivisions === []
? 'N/A'
: $city->subdivisions[0]->isoCode;
$latitude = round((float) $city->location->latitude, 3);
$longitude = round((float) $city->location->longitude, 3);
} catch (AddressNotFoundException) {
//Bad luck, bad IP, nothing to do.
} }
$hits = random_int(0, (int) $probability2);
$analyticsPodcasts[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'duration' => random_int(60, 3600),
'bandwidth' => random_int(1000000, 10000000),
'hits' => $hits,
'unique_listeners' => $hits,
];
$analyticsPodcastsByHour[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'hour' => random_int(0, 23),
'hits' => $hits,
];
$analyticsPodcastsByCountry[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'country_code' => $countryCode,
'hits' => $hits,
];
$analyticsPodcastsByEpisode[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'episode_id' => $episode->id,
'age' => $age,
'hits' => $hits,
];
$analyticsPodcastsByPlayer[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'service' => $service,
'app' => $app,
'device' => $device,
'os' => $os,
'is_bot' => $isBot,
'hits' => $hits,
];
$analyticsPodcastsByRegion[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'country_code' => $countryCode,
'region_code' => $regionCode,
'latitude' => $latitude,
'longitude' => $longitude,
'hits' => $hits,
];
} }
$this->db
->table('analytics_podcasts')
->ignore(true)
->insertBatch($analytics_podcasts);
$this->db
->table('analytics_podcasts_by_hour')
->ignore(true)
->insertBatch($analytics_podcasts_by_hour);
$this->db
->table('analytics_podcasts_by_country')
->ignore(true)
->insertBatch($analytics_podcasts_by_country);
$this->db
->table('analytics_podcasts_by_episode')
->ignore(true)
->insertBatch($analytics_podcasts_by_episode);
$this->db
->table('analytics_podcasts_by_player')
->ignore(true)
->insertBatch($analytics_podcasts_by_player);
$this->db
->table('analytics_podcasts_by_region')
->ignore(true)
->insertBatch($analytics_podcasts_by_region);
} }
} else {
echo "Create one podcast and some episodes first.\n"; $this->db
->table('analytics_podcasts')
->ignore(true)
->insertBatch($analyticsPodcasts);
$this->db
->table('analytics_podcasts_by_hour')
->ignore(true)
->insertBatch($analyticsPodcastsByHour);
$this->db
->table('analytics_podcasts_by_country')
->ignore(true)
->insertBatch($analyticsPodcastsByCountry);
$this->db
->table('analytics_podcasts_by_episode')
->ignore(true)
->insertBatch($analyticsPodcastsByEpisode);
$this->db
->table('analytics_podcasts_by_player')
->ignore(true)
->insertBatch($analyticsPodcastsByPlayer);
$this->db
->table('analytics_podcasts_by_region')
->ignore(true)
->insertBatch($analyticsPodcastsByRegion);
} }
} }
} }
<?php <?php
declare(strict_types=1);
/** /**
* Class FakeWebsiteAnalyticsSeeder * Class FakeWebsiteAnalyticsSeeder Inserts Fake Analytics in the database
* Inserts Fake Analytics in the database
* *
* @copyright 2020 Podlibre * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/ * @link https://castopod.org/
*/ */
namespace App\Database\Seeds; namespace App\Database\Seeds;
use App\Models\PodcastModel;
use App\Models\EpisodeModel;
use App\Entities\Episode;
use App\Entities\Podcast;
use App\Models\EpisodeModel;
use App\Models\PodcastModel;
use CodeIgniter\Database\Seeder; use CodeIgniter\Database\Seeder;
use Exception;
use Override;
class FakeWebsiteAnalyticsSeeder extends Seeder class FakeWebsiteAnalyticsSeeder extends Seeder
{ {
protected $keywords = [ /**
* @var string[]
*/
protected array $keywords = [
'all the smoke podcast', 'all the smoke podcast',
'apple podcast', 'apple podcast',
'bad friends podcast', 'bad friends podcast',
...@@ -69,7 +77,11 @@ class FakeWebsiteAnalyticsSeeder extends Seeder ...@@ -69,7 +77,11 @@ class FakeWebsiteAnalyticsSeeder extends Seeder
'wind of change podcast', 'wind of change podcast',
'your own backyard podcast', 'your own backyard podcast',
]; ];
protected $domains = [
/**
* @var string[]
*/
protected array $domains = [
'360.cn ', '360.cn ',
'adobe.com ', 'adobe.com ',
'aliexpress.com ', 'aliexpress.com ',
...@@ -122,7 +134,10 @@ class FakeWebsiteAnalyticsSeeder extends Seeder ...@@ -122,7 +134,10 @@ class FakeWebsiteAnalyticsSeeder extends Seeder
'zoom.us ', 'zoom.us ',
]; ];
protected $browsers = [ /**
* @var string[]
*/
protected array $browsers = [
'Android Browser', 'Android Browser',
'Avast Secure Browser', 'Avast Secure Browser',
'BlackBerry Browser', 'BlackBerry Browser',
...@@ -167,94 +182,95 @@ class FakeWebsiteAnalyticsSeeder extends Seeder ...@@ -167,94 +182,95 @@ class FakeWebsiteAnalyticsSeeder extends Seeder
'WOSBrowser', 'WOSBrowser',
]; ];
public function run() #[Override]
public function run(): void
{ {
$podcast = (new PodcastModel())->first(); $podcast = (new PodcastModel())->first();
if ($podcast) { if (! $podcast instanceof Podcast) {
$firstEpisode = (new EpisodeModel()) throw new Exception("COULD NOT POPULATE DATABASE:\n\tCreate a podcast with episodes first.\n");
->selectMin('published_at') }
->first();
for ( $firstEpisode = (new EpisodeModel())
$date = strtotime($firstEpisode->published_at); ->selectMin('published_at')
$date < strtotime('now'); ->first();
$date = strtotime(date('Y-m-d', $date) . ' +1 day')
) {
$website_by_browser = [];
$website_by_entry_page = [];
$website_by_referer = [];
$episodes = (new EpisodeModel()) if (! $firstEpisode instanceof Episode) {
->where([ throw new Exception("COULD NOT POPULATE DATABASE:\n\tCreate an episode first.");
'podcast_id' => $podcast->id, }
'DATE(published_at) <=' => date('Y-m-d', $date),
])
->findAll();
foreach ($episodes as $episode) {
$age = floor(
($date - strtotime($episode->published_at)) / 86400
);
$proba1 = floor(exp(3 - $age / 40)) + 1;
for ( for (
$num_line = 0; $date = strtotime((string) $firstEpisode->published_at);
$num_line < rand(1, $proba1); $date < strtotime('now');
$num_line++ $date = strtotime(date('Y-m-d', $date) . ' +1 day')
) { ) {
$proba2 = floor(exp(6 - $age / 20)) + 10; $websiteByBrowser = [];
$websiteByEntryPage = [];
$websiteByReferer = [];
$domain = $episodes = (new EpisodeModel())
$this->domains[rand(0, count($this->domains) - 1)]; ->where('podcast_id', $podcast->id)
$keyword = ->where('`published_at` <= UTC_TIMESTAMP()', null, false)
$this->keywords[ ->findAll();
rand(0, count($this->keywords) - 1) foreach ($episodes as $episode) {
]; $age = floor(($date - strtotime((string) $episode->published_at)) / 86400);
$browser = $probability1 = (int) floor(exp(3 - $age / 40)) + 1;
$this->browsers[
rand(0, count($this->browsers) - 1)
];
$hits = rand(0, $proba2); for (
$lineNumber = 0;
$lineNumber < random_int(1, $probability1);
++$lineNumber
) {
$probability2 = (int) floor(exp(6 - $age / 20)) + 10;
$website_by_browser[] = [ $domain =
'podcast_id' => $podcast->id, $this->domains[random_int(0, count($this->domains) - 1)];
'date' => date('Y-m-d', $date), $keyword =
'browser' => $browser, $this->keywords[
'hits' => $hits, random_int(0, count($this->keywords) - 1)
]; ];
$website_by_entry_page[] = [ $browser =
'podcast_id' => $podcast->id, $this->browsers[
'date' => date('Y-m-d', $date), random_int(0, count($this->browsers) - 1)
'entry_page_url' => $episode->link,
'hits' => $hits,
]; ];
$website_by_referer[] = [
'podcast_id' => $podcast->id, $hits = random_int(0, $probability2);
'date' => date('Y-m-d', $date),
'referer_url' => $websiteByBrowser[] = [
'http://' . $domain . '/?q=' . $keyword, 'podcast_id' => $podcast->id,
'domain' => $domain, 'date' => date('Y-m-d', $date),
'keywords' => $keyword, 'browser' => $browser,
'hits' => $hits, 'hits' => $hits,
]; ];
} $websiteByEntryPage[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'entry_page_url' => $episode->link,
'hits' => $hits,
];
$websiteByReferer[] = [
'podcast_id' => $podcast->id,
'date' => date('Y-m-d', $date),
'referer_url' => 'http://' . $domain . '/?q=' . $keyword,
'domain' => $domain,
'keywords' => $keyword,
'hits' => $hits,
];
} }
$this->db
->table('analytics_website_by_browser')
->ignore(true)
->insertBatch($website_by_browser);
$this->db
->table('analytics_website_by_entry_page')
->ignore(true)
->insertBatch($website_by_entry_page);
$this->db
->table('analytics_website_by_referer')
->ignore(true)
->insertBatch($website_by_referer);
} }
} else {
echo "Create one podcast and some episodes first.\n"; $this->db
->table('analytics_website_by_browser')
->ignore(true)
->insertBatch($websiteByBrowser);
$this->db
->table('analytics_website_by_entry_page')
->ignore(true)
->insertBatch($websiteByEntryPage);
$this->db
->table('analytics_website_by_referer')
->ignore(true)
->insertBatch($websiteByReferer);
} }
} }
} }
<?php <?php
declare(strict_types=1);
/** /**
* Class LanguageSeeder * Class LanguageSeeder Inserts values in languages table in database
* Inserts values in languages table in database
* *
* @copyright 2020 Podlibre * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/ * @link https://castopod.org/
*/ */
/** /**
* From https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes * From https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes (cc) Creative Commons Attribution-ShareAlike 3.0
* (cc) Creative Commons Attribution-ShareAlike 3.0
* 2020-06-07 * 2020-06-07
*/ */
namespace App\Database\Seeds; namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder; use CodeIgniter\Database\Seeder;
use Override;
class LanguageSeeder extends Seeder class LanguageSeeder extends Seeder
{ {
public function run() #[Override]
public function run(): void
{ {
$data = [ $data = [
['code' => 'aa', 'native_name' => 'Afaraf'],
[ [
'code' => 'ab', 'code' => 'aa',
'native_name' => 'Afaraf',
],
[
'code' => 'ab',
'native_name' => 'аҧсуа бызшәа, аҧсшәа', 'native_name' => 'аҧсуа бызшәа, аҧсшәа',
], ],
['code' => 'ae', 'native_name' => 'avesta'],
[ [
'code' => 'af', 'code' => 'ae',
'native_name' => 'Avesta',
],
[
'code' => 'af',
'native_name' => 'Afrikaans', 'native_name' => 'Afrikaans',
], ],
['code' => 'ak', 'native_name' => 'Akan'],
['code' => 'am', 'native_name' => 'አማርኛ'],
[ [
'code' => 'an', 'code' => 'ak',
'native_name' => 'aragonés', 'native_name' => 'Akan',
],
[
'code' => 'am',
'native_name' => 'አማርኛ',
],
[
'code' => 'an',
'native_name' => 'Aragonés',
],
[
'code' => 'ar',
'native_name' => 'العربية',
],
[
'code' => 'as',
'native_name' => 'অসমীয়া',
], ],
['code' => 'ar', 'native_name' => 'العربية'],
['code' => 'as', 'native_name' => 'অসমীয়া'],
[ [
'code' => 'av', 'code' => 'av',
'native_name' => 'авар мацӀ, магӀарул мацӀ', 'native_name' => 'авар мацӀ, магӀарул мацӀ',
], ],
['code' => 'ay', 'native_name' => 'aymar aru'],
[ [
'code' => 'az', 'code' => 'ay',
'native_name' => 'Aymar aru',
],
[
'code' => 'az',
'native_name' => 'azərbaycan dili', 'native_name' => 'azərbaycan dili',
], ],
[ [
'code' => 'ba', 'code' => 'ba',
'native_name' => 'башҡорт теле', 'native_name' => 'башҡорт теле',
], ],
[ [
'code' => 'be', 'code' => 'be',
'native_name' => 'беларуская мова', 'native_name' => 'беларуская мова',
], ],
[ [
'code' => 'bg', 'code' => 'bg',
'native_name' => 'български език', 'native_name' => 'български език',
], ],
[ [
'code' => 'bh', 'code' => 'bh',
'native_name' => 'भोजपुरी', 'native_name' => 'भोजपुरी',
], ],
['code' => 'bi', 'native_name' => 'Bislama'],
[ [
'code' => 'bm', 'code' => 'bi',
'native_name' => 'bamanankan', 'native_name' => 'Bislama',
],
[
'code' => 'bm',
'native_name' => 'Bamanankan',
],
[
'code' => 'bn',
'native_name' => 'বাংলা',
],
[
'code' => 'bo',
'native_name' => 'བོད་ཡིག',
],
[
'code' => 'br',
'native_name' => 'Brezhoneg',
], ],
['code' => 'bn', 'native_name' => 'বাংলা'],
['code' => 'bo', 'native_name' => 'བོད་ཡིག'],
['code' => 'br', 'native_name' => 'brezhoneg'],
[ [
'code' => 'bs', 'code' => 'bs',
'native_name' => 'bosanski jezik', 'native_name' => 'Bosanski jezik',
], ],
[ [
'code' => 'ca', 'code' => 'ca',
'native_name' => 'català, valencià', 'native_name' => 'Català, valencià',
], ],
[ [
'code' => 'ce', 'code' => 'ce',
'native_name' => 'нохчийн мотт', 'native_name' => 'нохчийн мотт',
], ],
['code' => 'ch', 'native_name' => 'Chamoru'],
[ [
'code' => 'co', 'code' => 'ch',
'native_name' => 'corsu, lingua corsa', 'native_name' => 'Chamoru',
],
[
'code' => 'co',
'native_name' => 'Corsu, lingua corsa',
], ],
['code' => 'cr', 'native_name' => 'ᓀᐦᐃᔭᐍᐏᐣ'],
[ [
'code' => 'cs', 'code' => 'cr',
'native_name' => 'ᓀᐦᐃᔭᐍᐏᐣ',
],
[
'code' => 'cs',
'native_name' => 'čeština, český jazyk', 'native_name' => 'čeština, český jazyk',
], ],
[ [
'code' => 'cu', 'code' => 'cu',
'native_name' => 'ѩзыкъ словѣньскъ', 'native_name' => 'ѩзыкъ словѣньскъ',
], ],
[ [
'code' => 'cv', 'code' => 'cv',
'native_name' => 'чӑваш чӗлхи', 'native_name' => 'чӑваш чӗлхи',
], ],
['code' => 'cy', 'native_name' => 'Cymraeg'],
['code' => 'da', 'native_name' => 'dansk'],
['code' => 'de', 'native_name' => 'Deutsch'],
[ [
'code' => 'dv', 'code' => 'cy',
'native_name' => 'Cymraeg',
],
[
'code' => 'da',
'native_name' => 'Dansk',
],
[
'code' => 'de',
'native_name' => 'Deutsch',
],
[
'code' => 'dv',
'native_name' => 'ދިވެހި', 'native_name' => 'ދިވެހި',
], ],
['code' => 'dz', 'native_name' => 'རྫོང་ཁ'],
['code' => 'ee', 'native_name' => 'Eʋegbe'],
[ [
'code' => 'el', 'code' => 'dz',
'native_name' => 'རྫོང་ཁ',
],
[
'code' => 'ee',
'native_name' => 'Eʋegbe',
],
[
'code' => 'el',
'native_name' => 'ελληνικά', 'native_name' => 'ελληνικά',
], ],
['code' => 'en', 'native_name' => 'English'],
[ [
'code' => 'eo', 'code' => 'en',
'native_name' => 'English',
],
[
'code' => 'eo',
'native_name' => 'Esperanto', 'native_name' => 'Esperanto',
], ],
[ [
'code' => 'es', 'code' => 'es',
'native_name' => 'Español', 'native_name' => 'Español',
], ],
[ [
'code' => 'et', 'code' => 'et',
'native_name' => 'eesti, eesti keel', 'native_name' => 'eesti, eesti keel',
], ],
[ [
'code' => 'eu', 'code' => 'eu',
'native_name' => 'euskara, euskera', 'native_name' => 'Euskara, euskera',
],
[
'code' => 'fa',
'native_name' => 'فارسی',
], ],
['code' => 'fa', 'native_name' => 'فارسی'],
[ [
'code' => 'ff', 'code' => 'ff',
'native_name' => 'Fulfulde, Pulaar, Pular', 'native_name' => 'Fulfulde, Pulaar, Pular',
], ],
[ [
'code' => 'fi', 'code' => 'fi',
'native_name' => 'suomi, suomen kieli', 'native_name' => 'Suomi, suomen kieli',
],
[
'code' => 'fj',
'native_name' => 'Vosa Vakaviti',
], ],
[ [
'code' => 'fj', 'code' => 'fo',
'native_name' => 'vosa Vakaviti', 'native_name' => 'Føroyskt',
], ],
['code' => 'fo', 'native_name' => 'føroyskt'],
[ [
'code' => 'fr', 'code' => 'fr',
'native_name' => 'français, langue française', 'native_name' => 'Français, langue française',
], ],
[ [
'code' => 'fy', 'code' => 'fy',
'native_name' => 'Frysk', 'native_name' => 'Frysk',
], ],
['code' => 'ga', 'native_name' => 'Gaeilge'],
[ [
'code' => 'gd', 'code' => 'ga',
'native_name' => 'Gaeilge',
],
[
'code' => 'gd',
'native_name' => 'Gàidhlig', 'native_name' => 'Gàidhlig',
], ],
['code' => 'gl', 'native_name' => 'Galego'],
['code' => 'gn', 'native_name' => 'Avañe\'ẽ'],
['code' => 'gu', 'native_name' => 'ગુજરાતી'],
[ [
'code' => 'gv', 'code' => 'gl',
'native_name' => 'Galego',
],
[
'code' => 'gn',
'native_name' => "Avañe'ẽ",
],
[
'code' => 'gu',
'native_name' => 'ગુજરાતી',
],
[
'code' => 'gv',
'native_name' => 'Gaelg, Gailck', 'native_name' => 'Gaelg, Gailck',
], ],
[ [
'code' => 'ha', 'code' => 'ha',
'native_name' => '(Hausa) هَوُسَ', 'native_name' => '(Hausa) هَوُسَ',
], ],
['code' => 'he', 'native_name' => 'עברית'],
[ [
'code' => 'hi', 'code' => 'he',
'native_name' => 'עברית',
],
[
'code' => 'hi',
'native_name' => 'हिन्दी, हिंदी', 'native_name' => 'हिन्दी, हिंदी',
], ],
[ [
'code' => 'ho', 'code' => 'ho',
'native_name' => 'Hiri Motu', 'native_name' => 'Hiri Motu',
], ],
[ [
'code' => 'hr', 'code' => 'hr',
'native_name' => 'hrvatski jezik', 'native_name' => 'Hrvatski jezik',
], ],
[ [
'code' => 'ht', 'code' => 'ht',
'native_name' => 'Kreyòl ayisyen', 'native_name' => 'Kreyòl ayisyen',
], ],
['code' => 'hu', 'native_name' => 'magyar'],
['code' => 'hy', 'native_name' => 'Հայերեն'],
['code' => 'hz', 'native_name' => 'Otjiherero'],
[ [
'code' => 'ia', 'code' => 'hu',
'native_name' => 'Magyar',
],
[
'code' => 'hy',
'native_name' => 'Հայերեն',
],
[
'code' => 'hz',
'native_name' => 'Otjiherero',
],
[
'code' => 'ia',
'native_name' => 'Interlingua', 'native_name' => 'Interlingua',
], ],
[ [
'code' => 'id', 'code' => 'id',
'native_name' => 'Bahasa Indonesia', 'native_name' => 'Bahasa Indonesia',
], ],
[ [
'code' => 'ie', 'code' => 'ie',
'native_name' => 'native_name' => 'Interlingue, formerly Occidental',
'(originally:) Occidental, (after WWII:) Interlingue', ],
[
'code' => 'ig',
'native_name' => 'Asụsụ Igbo',
], ],
['code' => 'ig', 'native_name' => 'Asụsụ Igbo'],
[ [
'code' => 'ii', 'code' => 'ii',
'native_name' => 'ꆈꌠ꒿ Nuosuhxop', 'native_name' => 'ꆈꌠ꒿ Nuosuhxop',
], ],
[ [
'code' => 'ik', 'code' => 'ik',
'native_name' => 'Iñupiaq, Iñupiatun', 'native_name' => 'Iñupiaq, Iñupiatun',
], ],
['code' => 'io', 'native_name' => 'Ido'],
[ [
'code' => 'is', 'code' => 'io',
'native_name' => 'Ido',
],
[
'code' => 'is',
'native_name' => 'Íslenska', 'native_name' => 'Íslenska',
], ],
['code' => 'it', 'native_name' => 'Italiano'],
['code' => 'iu', 'native_name' => 'ᐃᓄᒃᑎᑐᑦ'],
[ [
'code' => 'ja', 'code' => 'it',
'native_name' => 'Italiano',
],
[
'code' => 'iu',
'native_name' => 'ᐃᓄᒃᑎᑐᑦ',
],
[
'code' => 'ja',
'native_name' => '日本語 (にほんご)', 'native_name' => '日本語 (にほんご)',
], ],
[ [
'code' => 'jv', 'code' => 'jv',
'native_name' => 'ꦧꦱꦗꦮ, Basa Jawa', 'native_name' => 'ꦧꦱꦗꦮ, Basa Jawa',
], ],
['code' => 'ka', 'native_name' => 'ქართული'],
['code' => 'kg', 'native_name' => 'Kikongo'],
[ [
'code' => 'ki', 'code' => 'ka',
'native_name' => 'ქართული',
],
[
'code' => 'kg',
'native_name' => 'Kikongo',
],
[
'code' => 'ki',
'native_name' => 'Gĩkũyũ', 'native_name' => 'Gĩkũyũ',
], ],
[ [
'code' => 'kj', 'code' => 'kj',
'native_name' => 'Kuanyama', 'native_name' => 'Kuanyama',
], ],
['code' => 'kk', 'native_name' => 'қазақ тілі'],
[ [
'code' => 'kl', 'code' => 'kk',
'native_name' => 'kalaallisut, kalaallit oqaasii', 'native_name' => 'қазақ тілі',
],
[
'code' => 'kl',
'native_name' => 'Kalaallisut, kalaallit oqaasii',
], ],
[ [
'code' => 'km', 'code' => 'km',
'native_name' => 'ខ្មែរ, ខេមរភាសា, ភាសាខ្មែរ', 'native_name' => 'ខ្មែរ, ខេមរភាសា, ភាសាខ្មែរ',
], ],
['code' => 'kn', 'native_name' => 'ಕನ್ನಡ'],
['code' => 'ko', 'native_name' => '한국어'],
['code' => 'kr', 'native_name' => 'Kanuri'],
[ [
'code' => 'ks', 'code' => 'kn',
'native_name' => 'ಕನ್ನಡ',
],
[
'code' => 'ko',
'native_name' => '한국어',
],
[
'code' => 'kr',
'native_name' => 'Kanuri',
],
[
'code' => 'ks',
'native_name' => 'कश्मीरी, كشميري', 'native_name' => 'कश्मीरी, كشميري',
], ],
[ [
'code' => 'ku', 'code' => 'ku',
'native_name' => 'Kurdî, کوردی', 'native_name' => 'Kurdî, کوردی',
], ],
['code' => 'kv', 'native_name' => 'коми кыв'],
['code' => 'kw', 'native_name' => 'Kernewek'],
[ [
'code' => 'ky', 'code' => 'kv',
'native_name' => 'коми кыв',
],
[
'code' => 'kw',
'native_name' => 'Kernewek',
],
[
'code' => 'ky',
'native_name' => 'Кыргызча, Кыргыз тили', 'native_name' => 'Кыргызча, Кыргыз тили',
], ],
[ [
'code' => 'la', 'code' => 'la',
'native_name' => 'latine, lingua latina', 'native_name' => 'Latine, lingua latina',
], ],
[ [
'code' => 'lb', 'code' => 'lb',
'native_name' => 'Lëtzebuergesch', 'native_name' => 'Lëtzebuergesch',
], ],
['code' => 'lg', 'native_name' => 'Luganda'],
[ [
'code' => 'li', 'code' => 'lg',
'native_name' => 'Luganda',
],
[
'code' => 'li',
'native_name' => 'Limburgs', 'native_name' => 'Limburgs',
], ],
['code' => 'ln', 'native_name' => 'Lingála'],
['code' => 'lo', 'native_name' => 'ພາສາລາວ'],
[ [
'code' => 'lt', 'code' => 'ln',
'native_name' => 'lietuvių kalba', 'native_name' => 'Lingála',
], ],
[ [
'code' => 'lu', 'code' => 'lo',
'native_name' => 'ພາສາລາວ',
],
[
'code' => 'lt',
'native_name' => 'Lietuvių kalba',
],
[
'code' => 'lu',
'native_name' => 'Kiluba', 'native_name' => 'Kiluba',
], ],
[ [
'code' => 'lv', 'code' => 'lv',
'native_name' => 'latviešu valoda', 'native_name' => 'Latviešu valoda',
], ],
[ [
'code' => 'mg', 'code' => 'mg',
'native_name' => 'fiteny malagasy', 'native_name' => 'Fiteny malagasy',
], ],
[ [
'code' => 'mh', 'code' => 'mh',
'native_name' => 'Kajin M̧ajeļ', 'native_name' => 'Kajin M̧ajeļ',
], ],
[ [
'code' => 'mi', 'code' => 'mi',
'native_name' => 'te reo Māori', 'native_name' => 'Te reo Māori',
], ],
[ [
'code' => 'mk', 'code' => 'mk',
'native_name' => 'македонски јазик', 'native_name' => 'македонски јазик',
], ],
['code' => 'ml', 'native_name' => 'മലയാളം'],
[ [
'code' => 'mn', 'code' => 'ml',
'native_name' => 'മലയാളം',
],
[
'code' => 'mn',
'native_name' => 'Монгол хэл', 'native_name' => 'Монгол хэл',
], ],
['code' => 'mr', 'native_name' => 'मराठी'],
[ [
'code' => 'ms', 'code' => 'mr',
'native_name' => 'मराठी',
],
[
'code' => 'ms',
'native_name' => 'Bahasa Melayu, بهاس ملايو', 'native_name' => 'Bahasa Melayu, بهاس ملايو',
], ],
['code' => 'mt', 'native_name' => 'Malti'],
['code' => 'my', 'native_name' => 'ဗမာစာ'],
[ [
'code' => 'na', 'code' => 'mt',
'native_name' => 'Malti',
],
[
'code' => 'my',
'native_name' => 'ဗမာစာ',
],
[
'code' => 'na',
'native_name' => 'Dorerin Naoero', 'native_name' => 'Dorerin Naoero',
], ],
[ [
'code' => 'nb', 'code' => 'nb',
'native_name' => 'Norsk Bokmål', 'native_name' => 'Norsk Bokmål',
], ],
[ [
'code' => 'nd', 'code' => 'nd',
'native_name' => 'isiNdebele', 'native_name' => 'isiNdebele',
], ],
['code' => 'ne', 'native_name' => 'नेपाली'],
['code' => 'ng', 'native_name' => 'Owambo'],
[ [
'code' => 'nl', 'code' => 'ne',
'native_name' => 'नेपाली',
],
[
'code' => 'ng',
'native_name' => 'Owambo',
],
[
'code' => 'nl',
'native_name' => 'Nederlands, Vlaams', 'native_name' => 'Nederlands, Vlaams',
], ],
[ [
'code' => 'nn', 'code' => 'nn',
'native_name' => 'Norsk Nynorsk', 'native_name' => 'Norsk Nynorsk',
], ],
['code' => 'no', 'native_name' => 'Norsk'],
[ [
'code' => 'nr', 'code' => 'no',
'native_name' => 'Norsk',
],
[
'code' => 'nr',
'native_name' => 'isiNdebele', 'native_name' => 'isiNdebele',
], ],
[ [
'code' => 'nv', 'code' => 'nv',
'native_name' => 'Diné bizaad', 'native_name' => 'Diné bizaad',
], ],
[ [
'code' => 'ny', 'code' => 'ny',
'native_name' => 'chiCheŵa, chinyanja', 'native_name' => 'Chicheŵa, chinyanja',
],
[
'code' => 'oc',
'native_name' => 'Occitan, lenga d’òc',
], ],
[ [
'code' => 'oc', 'code' => 'oj',
'native_name' => 'occitan, lenga d’òc', 'native_name' => 'ᐊᓂᔑᓈᐯᒧᐎᓐ',
], ],
['code' => 'oj', 'native_name' => 'ᐊᓂᔑᓈᐯᒧᐎᓐ'],
[ [
'code' => 'om', 'code' => 'om',
'native_name' => 'Afaan Oromoo', 'native_name' => 'Afaan Oromoo',
], ],
['code' => 'or', 'native_name' => 'ଓଡ଼ିଆ'],
[ [
'code' => 'os', 'code' => 'or',
'native_name' => 'ଓଡ଼ିଆ',
],
[
'code' => 'os',
'native_name' => 'ирон æвзаг', 'native_name' => 'ирон æвзаг',
], ],
[ [
'code' => 'pa', 'code' => 'pa',
'native_name' => 'ਪੰਜਾਬੀ, پنجابی', 'native_name' => 'ਪੰਜਾਬੀ, پنجابی',
], ],
['code' => 'pi', 'native_name' => 'पालि, पाळि'],
[ [
'code' => 'pl', 'code' => 'pi',
'native_name' => 'पालि, पाळि',
],
[
'code' => 'pl',
'native_name' => 'język polski, polszczyzna', 'native_name' => 'język polski, polszczyzna',
], ],
[ [
'code' => 'ps', 'code' => 'ps',
'native_name' => 'پښتو', 'native_name' => 'پښتو',
], ],
[ [
'code' => 'pt', 'code' => 'pt',
'native_name' => 'Português', 'native_name' => 'Português',
], ],
[ [
'code' => 'qu', 'code' => 'qu',
'native_name' => 'Runa Simi, Kichwa', 'native_name' => 'Runa Simi, Kichwa',
], ],
[ [
'code' => 'rm', 'code' => 'rm',
'native_name' => 'Rumantsch Grischun', 'native_name' => 'Rumantsch Grischun',
], ],
['code' => 'rn', 'native_name' => 'Ikirundi'],
[ [
'code' => 'ro', 'code' => 'rn',
'native_name' => 'Ikirundi',
],
[
'code' => 'ro',
'native_name' => 'Română', 'native_name' => 'Română',
], ],
['code' => 'ru', 'native_name' => 'русский'],
[ [
'code' => 'rw', 'code' => 'ru',
'native_name' => 'Pусский',
],
[
'code' => 'rw',
'native_name' => 'Ikinyarwanda', 'native_name' => 'Ikinyarwanda',
], ],
[ [
'code' => 'sa', 'code' => 'sa',
'native_name' => 'संस्कृतम्', 'native_name' => 'संस्कृतम्',
], ],
['code' => 'sc', 'native_name' => 'sardu'],
[ [
'code' => 'sd', 'code' => 'sc',
'native_name' => 'Sardu',
],
[
'code' => 'sd',
'native_name' => 'सिन्धी, سنڌي، سندھی', 'native_name' => 'सिन्धी, سنڌي، سندھی',
], ],
[ [
'code' => 'se', 'code' => 'se',
'native_name' => 'Davvisámegiella', 'native_name' => 'Davvisámegiella',
], ],
[ [
'code' => 'sg', 'code' => 'sg',
'native_name' => 'yângâ tî sängö', 'native_name' => 'Yângâ tî sängö',
], ],
[ [
'code' => 'si', 'code' => 'si',
'native_name' => 'සිංහල', 'native_name' => 'සිංහල',
], ],
[ [
'code' => 'sk', 'code' => 'sk',
'native_name' => 'Slovenčina, Slovenský Jazyk', 'native_name' => 'Slovenčina, Slovenský Jazyk',
], ],
[ [
'code' => 'sl', 'code' => 'sl',
'native_name' => 'Slovenski Jezik, Slovenščina', 'native_name' => 'Slovenski Jezik, Slovenščina',
], ],
[ [
'code' => 'sm', 'code' => 'sm',
'native_name' => 'gagana fa\'a Samoa', 'native_name' => "Gagana fa'a Samoa",
], ],
['code' => 'sn', 'native_name' => 'chiShona'],
[ [
'code' => 'so', 'code' => 'sn',
'native_name' => 'chiShona',
],
[
'code' => 'so',
'native_name' => 'Soomaaliga, af Soomaali', 'native_name' => 'Soomaaliga, af Soomaali',
], ],
['code' => 'sq', 'native_name' => 'Shqip'],
[ [
'code' => 'sr', 'code' => 'sq',
'native_name' => 'Shqip',
],
[
'code' => 'sr',
'native_name' => 'српски језик', 'native_name' => 'српски језик',
], ],
['code' => 'ss', 'native_name' => 'SiSwati'],
[ [
'code' => 'st', 'code' => 'ss',
'native_name' => 'SiSwati',
],
[
'code' => 'st',
'native_name' => 'Sesotho', 'native_name' => 'Sesotho',
], ],
[ [
'code' => 'su', 'code' => 'su',
'native_name' => 'Basa Sunda', 'native_name' => 'Basa Sunda',
], ],
['code' => 'sv', 'native_name' => 'Svenska'],
['code' => 'sw', 'native_name' => 'Kiswahili'],
['code' => 'ta', 'native_name' => 'தமிழ்'],
['code' => 'te', 'native_name' => 'తెలుగు'],
[ [
'code' => 'tg', 'code' => 'sv',
'native_name' => 'Svenska',
],
[
'code' => 'sw',
'native_name' => 'Kiswahili',
],
[
'code' => 'ta',
'native_name' => 'தமிழ்',
],
[
'code' => 'te',
'native_name' => 'తెలుగు',
],
[
'code' => 'tg',
'native_name' => 'тоҷикӣ, toçikī, تاجیکی', 'native_name' => 'тоҷикӣ, toçikī, تاجیکی',
], ],
['code' => 'th', 'native_name' => 'ไทย'],
['code' => 'ti', 'native_name' => 'ትግርኛ'],
[ [
'code' => 'tk', 'code' => 'th',
'native_name' => 'ไทย',
],
[
'code' => 'ti',
'native_name' => 'ትግርኛ',
],
[
'code' => 'tk',
'native_name' => 'Türkmen, Түркмен', 'native_name' => 'Türkmen, Түркмен',
], ],
[ [
'code' => 'tl', 'code' => 'tl',
'native_name' => 'Wikang Tagalog', 'native_name' => 'Wikang Tagalog',
], ],
['code' => 'tn', 'native_name' => 'Setswana'],
[ [
'code' => 'to', 'code' => 'tn',
'native_name' => 'Setswana',
],
[
'code' => 'to',
'native_name' => 'Faka Tonga', 'native_name' => 'Faka Tonga',
], ],
['code' => 'tr', 'native_name' => 'Türkçe'],
['code' => 'ts', 'native_name' => 'Xitsonga'],
[ [
'code' => 'tt', 'code' => 'tr',
'native_name' => 'Türkçe',
],
[
'code' => 'ts',
'native_name' => 'Xitsonga',
],
[
'code' => 'tt',
'native_name' => 'татар теле, tatar tele', 'native_name' => 'татар теле, tatar tele',
], ],
['code' => 'tw', 'native_name' => 'Twi'],
[ [
'code' => 'ty', 'code' => 'tw',
'native_name' => 'Twi',
],
[
'code' => 'ty',
'native_name' => 'Reo Tahiti', 'native_name' => 'Reo Tahiti',
], ],
[ [
'code' => 'ug', 'code' => 'ug',
'native_name' => 'ئۇيغۇرچە, Uyghurche', 'native_name' => 'ئۇيغۇرچە, Uyghurche',
], ],
[ [
'code' => 'uk', 'code' => 'uk',
'native_name' => 'Українська', 'native_name' => 'Українська',
], ],
['code' => 'ur', 'native_name' => 'اردو'],
[ [
'code' => 'uz', 'code' => 'ur',
'native_name' => 'اردو',
],
[
'code' => 'uz',
'native_name' => 'Oʻzbek, Ўзбек, أۇزبېك', 'native_name' => 'Oʻzbek, Ўзбек, أۇزبېك',
], ],
['code' => 've', 'native_name' => 'Tshivenḓa'],
[ [
'code' => 'vi', 'code' => 've',
'native_name' => 'Tshivenḓa',
],
[
'code' => 'vi',
'native_name' => 'Tiếng Việt', 'native_name' => 'Tiếng Việt',
], ],
['code' => 'vo', 'native_name' => 'Volapük'],
['code' => 'wa', 'native_name' => 'Walon'],
['code' => 'wo', 'native_name' => 'Wollof'],
['code' => 'xh', 'native_name' => 'isiXhosa'],
['code' => 'yi', 'native_name' => 'ייִדיש'],
['code' => 'yo', 'native_name' => 'Yorùbá'],
[ [
'code' => 'za', 'code' => 'vo',
'native_name' => 'Volapük',
],
[
'code' => 'wa',
'native_name' => 'Walon',
],
[
'code' => 'wo',
'native_name' => 'Wollof',
],
[
'code' => 'xh',
'native_name' => 'isiXhosa',
],
[
'code' => 'yi',
'native_name' => 'ייִדיש',
],
[
'code' => 'yo',
'native_name' => 'Yorùbá',
],
[
'code' => 'za',
'native_name' => 'Saɯ cueŋƅ, Saw cuengh', 'native_name' => 'Saɯ cueŋƅ, Saw cuengh',
], ],
[ [
'code' => 'zh', 'code' => 'zh',
'native_name' => '中文 (Zhōngwén), 汉语, 漢語', 'native_name' => '中文 (Zhōngwén), 汉语, 漢語',
], ],
['code' => 'zu', 'native_name' => 'isiZulu'], [
'code' => 'zu',
'native_name' => 'isiZulu',
],
]; ];
$this->db foreach ($data as $languageLine) {
->table('languages') $this->db
->ignore(true) ->table('languages')
->insertBatch($data); ->ignore(true)
->insert($languageLine);
}
} }
} }
<?php
/**
* Class PlatformsSeeder
* Inserts values in platforms table in database
*
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
class PlatformSeeder extends Seeder
{
public function run()
{
$data = [
[
'slug' => 'amazon',
'type' => 'podcasting',
'label' => 'Amazon Music and Audible',
'home_url' => 'https://music.amazon.com/podcasts',
'submit_url' => 'http://amazon.com/podcasters',
],
[
'slug' => 'antennapod',
'type' => 'podcasting',
'label' => 'AntennaPod',
'home_url' => 'https://antennapod.org/',
'submit_url' => 'https://api.podcastindex.org/signup',
],
[
'slug' => 'apple',
'type' => 'podcasting',
'label' => 'Apple Podcasts',
'home_url' => 'https://www.apple.com/itunes/podcasts/',
'submit_url' =>
'https://podcastsconnect.apple.com/my-podcasts/new-feed',
],
[
'slug' => 'blubrry',
'type' => 'podcasting',
'label' => 'Blubrry',
'home_url' => 'https://www.blubrry.com/',
'submit_url' => 'https://www.blubrry.com/addpodcast.php',
],
[
'slug' => 'breaker',
'type' => 'podcasting',
'label' => 'Breaker',
'home_url' => 'https://www.breaker.audio/',
'submit_url' => 'https://podcasters.breaker.audio/',
],
[
'slug' => 'castbox',
'type' => 'podcasting',
'label' => 'Castbox',
'home_url' => 'https://castbox.fm/',
'submit_url' =>
'https://helpcenter.castbox.fm/portal/kb/articles/submit-my-podcast',
],
[
'slug' => 'castopod',
'type' => 'podcasting',
'label' => 'Castopod',
'home_url' => 'https://castopod.org/',
'submit_url' => 'https://castopod.org/instances',
],
[
'slug' => 'castro',
'type' => 'podcasting',
'label' => 'Castro',
'home_url' => 'http://castro.fm/',
'submit_url' =>
'https://castro.fm/support/link-to-your-podcast-in-castro',
],
[
'slug' => 'chartable',
'type' => 'podcasting',
'label' => 'Chartable',
'home_url' => 'https://chartable.com/',
'submit_url' => 'https://chartable.com/podcasts/submit',
],
[
'slug' => 'deezer',
'type' => 'podcasting',
'label' => 'Deezer',
'home_url' => 'https://www.deezer.com/',
'submit_url' => 'https://podcasters.deezer.com/submission',
],
[
'slug' => 'fyyd',
'type' => 'podcasting',
'label' => 'fyyd',
'home_url' => 'https://fyyd.de/',
'submit_url' => 'https://fyyd.de/add-feed',
],
[
'slug' => 'google',
'type' => 'podcasting',
'label' => 'Google Podcasts',
'home_url' => 'https://podcasts.google.com/about',
'submit_url' =>
'https://search.google.com/search-console/about',
],
[
'slug' => 'ivoox',
'type' => 'podcasting',
'label' => 'Ivoox',
'home_url' => 'https://www.ivoox.com/',
'submit_url' => 'http://www.ivoox.com/upload-podcast_u.html',
],
[
'slug' => 'listennotes',
'type' => 'podcasting',
'label' => 'ListenNotes',
'home_url' => 'https://www.listennotes.com/',
'submit_url' => 'https://www.listennotes.com/submit/',
],
[
'slug' => 'overcast',
'type' => 'podcasting',
'label' => 'Overcast',
'home_url' => 'https://overcast.fm/',
'submit_url' => 'https://overcast.fm/podcasterinfo',
],
[
'slug' => 'playerfm',
'type' => 'podcasting',
'label' => 'Player.Fm',
'home_url' => 'https://player.fm/',
'submit_url' => 'https://player.fm/importer/feed',
],
[
'slug' => 'pocketcasts',
'type' => 'podcasting',
'label' => 'Pocketcasts',
'home_url' => 'https://www.pocketcasts.com/',
'submit_url' => 'https://www.pocketcasts.com/submit/',
],
[
'slug' => 'podbean',
'type' => 'podcasting',
'label' => 'Podbean',
'home_url' => 'https://www.podbean.com/',
'submit_url' => 'https://www.podbean.com/site/submitPodcast',
],
[
'slug' => 'podcastaddict',
'type' => 'podcasting',
'label' => 'Podcast Addict',
'home_url' => 'https://podcastaddict.com/',
'submit_url' => 'https://podcastaddict.com/submit',
],
[
'slug' => 'podcastindex',
'type' => 'podcasting',
'label' => 'Podcast Index',
'home_url' => 'https://podcastindex.org/',
'submit_url' => 'https://api.podcastindex.org/signup',
],
[
'slug' => 'podchaser',
'type' => 'podcasting',
'label' => 'Podchaser',
'home_url' => 'https://www.podchaser.com/',
'submit_url' => 'https://www.podchaser.com/creators/edit',
],
[
'slug' => 'podcloud',
'type' => 'podcasting',
'label' => 'podCloud',
'home_url' => 'https://podcloud.fr/',
'submit_url' => 'https://podcloud.fr/studio/podcasts/new',
],
[
'slug' => 'podinstall',
'type' => 'podcasting',
'label' => 'Podinstall',
'home_url' => 'https://www.podinstall.com/',
'submit_url' => 'https://www.podinstall.com/claim.html',
],
[
'slug' => 'podlink',
'type' => 'podcasting',
'label' => 'pod.link',
'home_url' => 'https://pod.link/',
'submit_url' => 'https://pod.link',
],
[
'slug' => 'podtail',
'type' => 'podcasting',
'label' => 'Podtail',
'home_url' => 'https://podtail.com/',
'submit_url' => 'https://podtail.com/about/faq/',
],
[
'slug' => 'podfriend',
'type' => 'podcasting',
'label' => 'Podfriend',
'home_url' => 'https://www.podfriend.com/',
'submit_url' => 'https://api.podcastindex.org/signup',
],
[
'slug' => 'podverse',
'type' => 'podcasting',
'label' => 'Podverse',
'home_url' => 'https://podverse.fm/',
'submit_url' =>
'https://docs.google.com/forms/d/e/1FAIpQLSdewKP-YrE8zGjDPrkmoJEwCxPl_gizEkmzAlTYsiWAuAk1Ng/viewform',
],
[
'slug' => 'radiopublic',
'type' => 'podcasting',
'label' => 'RadioPublic',
'home_url' => 'https://radiopublic.com/',
'submit_url' => 'https://podcasters.radiopublic.com/signup',
],
[
'slug' => 'spotify',
'type' => 'podcasting',
'label' => 'Spotify',
'home_url' => 'https://www.spotify.com/',
'submit_url' => 'https://podcasters.spotify.com/submit',
],
[
'slug' => 'spreaker',
'type' => 'podcasting',
'label' => 'Spreaker',
'home_url' => 'https://www.spreaker.com/',
'submit_url' => 'https://www.spreaker.com/cms/shows/rss-import',
],
[
'slug' => 'stitcher',
'type' => 'podcasting',
'label' => 'Stitcher',
'home_url' => 'https://www.stitcher.com/',
'submit_url' => 'https://partners.stitcher.com/join',
],
[
'slug' => 'tunein',
'type' => 'podcasting',
'label' => 'TuneIn',
'home_url' => 'https://tunein.com/',
'submit_url' =>
'https://help.tunein.com/contact/add-podcast-S19TR3Sdf',
],
[
'slug' => 'paypal',
'type' => 'funding',
'label' => 'Paypal',
'home_url' => 'https://www.paypal.com/',
'submit_url' => 'https://www.paypal.com/paypalme/my/grab',
],
[
'slug' => 'gofundme',
'type' => 'funding',
'label' => 'GoFundMe',
'home_url' => 'https://www.gofundme.com/',
'submit_url' => 'https://www.gofundme.com/sign-up',
],
[
'slug' => 'helloasso',
'type' => 'funding',
'label' => 'helloasso',
'home_url' => 'https://www.helloasso.com/',
'submit_url' => 'https://auth.helloasso.com/inscription',
],
[
'slug' => 'indiegogo',
'type' => 'funding',
'label' => 'Indiegogo',
'home_url' => 'https://www.indiegogo.com/',
'submit_url' => 'https://www.indiegogo.com/start-a-campaign#/',
],
[
'slug' => 'kickstarter',
'type' => 'funding',
'label' => 'Kickstarter',
'home_url' => 'https://www.kickstarter.com/',
'submit_url' => 'https://www.kickstarter.com/learn',
],
[
'slug' => 'kisskissbankbank',
'type' => 'funding',
'label' => 'KissKissBankBank',
'home_url' => 'https://www.kisskissbankbank.com/',
'submit_url' =>
'https://www.kisskissbankbank.com/en/financer-mon-projet',
],
[
'slug' => 'liberapay',
'type' => 'funding',
'label' => 'Liberapay',
'home_url' => 'https://liberapay.com/',
'submit_url' => 'https://liberapay.com/sign-up',
],
[
'slug' => 'patreon',
'type' => 'funding',
'label' => 'Patreon',
'home_url' => 'https://www.patreon.com/',
'submit_url' => 'https://www.patreon.com/create',
],
[
'slug' => 'tipeee',
'type' => 'funding',
'label' => 'Tipeee',
'home_url' => 'https://tipeee.com/',
'submit_url' => 'https://tipeee.com/register/',
],
[
'slug' => 'ulule',
'type' => 'funding',
'label' => 'Ulule',
'home_url' => 'https://www.ulule.com/',
'submit_url' => 'https://www.ulule.com/projects/create/#/',
],
[
'slug' => 'discord',
'type' => 'social',
'label' => 'Discord',
'home_url' => 'https://discord.com/',
'submit_url' => 'https://discord.com/register',
],
[
'slug' => 'facebook',
'type' => 'social',
'label' => 'Facebook',
'home_url' => 'https://www.facebook.com/',
'submit_url' =>
'https://www.facebook.com/pages/creation/?ref_type=comet_home',
],
[
'slug' => 'funkwhale',
'type' => 'social',
'label' => 'Funkwhale',
'home_url' => 'https://funkwhale.audio/',
'submit_url' => 'https://network.funkwhale.audio/dashboards/',
],
[
'slug' => 'instagram',
'type' => 'social',
'label' => 'Instagram',
'home_url' => 'https://www.instagram.com/',
'submit_url' =>
'https://www.instagram.com/accounts/emailsignup/',
],
[
'slug' => 'linkedin',
'type' => 'social',
'label' => 'LinkedIn',
'home_url' => 'https://www.linkedin.com/',
'submit_url' => 'https://www.linkedin.com/company/setup/new/',
],
[
'slug' => 'mastodon',
'type' => 'social',
'label' => 'Mastodon',
'home_url' => 'https://joinmastodon.org/',
'submit_url' => 'https://joinmastodon.org/communities',
],
[
'slug' => 'mobilizon',
'type' => 'social',
'label' => 'Mobilizon',
'home_url' => 'https://joinmobilizon.org/',
'submit_url' => 'https://instances.joinmobilizon.org/instances',
],
[
'slug' => 'peertube',
'type' => 'social',
'label' => 'PeerTube',
'home_url' => 'https://joinpeertube.org/',
'submit_url' => 'https://joinpeertube.org/instances',
],
[
'slug' => 'pixelfed',
'type' => 'social',
'label' => 'Pixelfed',
'home_url' => 'https://pixelfed.org/',
'submit_url' => 'https://beta.joinpixelfed.org/',
],
[
'slug' => 'plume',
'type' => 'social',
'label' => 'Plume',
'home_url' => 'https://joinplu.me/',
'submit_url' => 'https://joinplu.me/#instances',
],
[
'slug' => 'slack',
'type' => 'social',
'label' => 'Slack',
'home_url' => 'https://slack.com/',
'submit_url' => 'https://slack.com/get-started#/create',
],
[
'slug' => 'twitch',
'type' => 'social',
'label' => 'Twitch',
'home_url' => 'https://www.twitch.tv/',
'submit_url' => 'https://www.twitch.tv/signup',
],
[
'slug' => 'twitter',
'type' => 'social',
'label' => 'Twitter',
'home_url' => 'https://twitter.com/',
'submit_url' => 'https://twitter.com/i/flow/signup',
],
[
'slug' => 'writefreely',
'type' => 'social',
'label' => 'WriteFreely',
'home_url' => 'https://writefreely.org/',
'submit_url' => 'https://writefreely.org/instances',
],
[
'slug' => 'youtube',
'type' => 'social',
'label' => 'Youtube',
'home_url' => 'https://www.youtube.com/',
'submit_url' => 'https://creatoracademy.youtube.com/page/home',
],
];
$this->db
->table('platforms')
->ignore(true)
->insertBatch($data);
}
}
<?php
/**
* Class TestSeeder
* Inserts a superadmin user in the database
*
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
class TestSeeder extends Seeder
{
public function run()
{
/** Inserts an active user with the following credentials:
* username: admin
* password: AGUehL3P
*/
$this->db->table('users')->insert([
'id' => 1,
'username' => 'admin',
'email' => 'admin@example.com',
'password_hash' =>
'$2y$10$TXJEHX/djW8jtzgpDVf7dOOCGo5rv1uqtAYWdwwwkttQcDkAeB2.6',
'active' => 1,
]);
$this->db
->table('auth_groups_users')
->insert(['group_id' => 1, 'user_id' => 1]);
}
}
<?php
declare(strict_types=1);
/**
* @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Entities;
use App\Models\PodcastModel;
use Modules\Fediverse\Entities\Actor as FediverseActor;
use Override;
use RuntimeException;
/**
* @property Podcast|null $podcast
* @property boolean $is_podcast
*/
class Actor extends FediverseActor
{
protected ?Podcast $podcast = null;
protected bool $is_podcast = false;
public function getIsPodcast(): bool
{
return $this->getPodcast() instanceof Podcast;
}
public function getPodcast(): ?Podcast
{
if ($this->id === null) {
throw new RuntimeException('Podcast id must be set before getting associated podcast.');
}
if (! $this->podcast instanceof Podcast) {
$this->podcast = (new PodcastModel())->getPodcastByActorId($this->id);
}
return $this->podcast;
}
#[Override]
public function getAvatarImageUrl(): string
{
if ($this->podcast instanceof Podcast) {
return $this->podcast->cover->thumbnail_url;
}
return parent::getAvatarImageUrl();
}
#[Override]
public function getAvatarImageMimetype(): string
{
if ($this->podcast instanceof Podcast) {
return $this->podcast->cover->thumbnail_mimetype;
}
return parent::getAvatarImageMimetype();
}
}
<?php
/**
* Class AnalyticsPodcastsByHour
* Entity for AnalyticsPodcastsByHour
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Entities;
use CodeIgniter\Entity;
class AnalyticsPodcastsByHour extends Entity
{
protected $casts = [
'podcast_id' => 'integer',
'date' => 'datetime',
'hour' => 'integer',
'hits' => 'integer',
];
}
<?php
/**
* Class AnalyticsPodcastsByPlayer
* Entity for AnalyticsPodcastsByPlayer
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Entities;
use CodeIgniter\Entity;
class AnalyticsPodcastsByPlayer extends Entity
{
protected $casts = [
'podcast_id' => 'integer',
'app' => '?string',
'device' => '?string',
'os' => '?string',
'is_bot' => 'boolean',
'date' => 'datetime',
'hits' => 'integer',
];
}
<?php
/**
* Class AnalyticsPodcastsByRegion
* Entity for AnalyticsPodcastsByRegion
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Entities;
use CodeIgniter\Entity;
class AnalyticsPodcastsByRegion extends Entity
{
protected $casts = [
'podcast_id' => 'integer',
'country_code' => 'string',
'region_code' => '?string',
'latitude' => '?float',
'longitude' => '?float',
'date' => 'datetime',
'hits' => 'integer',
];
public function getCountryCode()
{
return lang('Countries.' . $this->attributes['country_code']);
}
}
<?php
/**
* Class AnalyticsPodcastsByService
* Entity for AnalyticsPodcastsByService
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Entities;
use CodeIgniter\Entity;
class AnalyticsPodcastsByService extends Entity
{
/**
* @var string
*/
protected $labels;
protected $casts = [
'podcast_id' => 'integer',
'app' => '?string',
'device' => '?string',
'os' => '?string',
'is_bot' => 'boolean',
'date' => 'datetime',
'hits' => 'integer',
];
public function getLabels()
{
return \Opawg\UserAgentsPhp\UserAgentsRSS::getName(
$this->attributes['labels']
) ?? $this->attributes['labels'];
}
}
<?php
/**
* Class AnalyticsWebsiteByEntryPage
* Entity for AnalyticsWebsiteByEntryPage
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Entities;
use CodeIgniter\Entity;
class AnalyticsWebsiteByEntryPage extends Entity
{
protected $casts = [
'podcast_id' => 'integer',
'entry_page_url' => 'string',
'date' => 'datetime',
'hits' => 'integer',
];
}
<?php
/**
* Class class AnalyticsWebsiteByReferer
* Entity for AnalyticsWebsiteByReferer
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Entities;
use CodeIgniter\Entity;
class AnalyticsWebsiteByReferer extends Entity
{
protected $casts = [
'podcast_id' => 'integer',
'referer_url' => 'string',
'date' => 'datetime',
'hits' => 'integer',
];
}
<?php <?php
declare(strict_types=1);
/** /**
* @copyright 2020 Podlibre * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/ * @link https://castopod.org/
*/ */
...@@ -9,29 +11,37 @@ ...@@ -9,29 +11,37 @@
namespace App\Entities; namespace App\Entities;
use App\Models\CategoryModel; use App\Models\CategoryModel;
use CodeIgniter\Entity; use CodeIgniter\Entity\Entity;
/**
* @property int $id
* @property int $parent_id
* @property Category|null $parent
* @property string $code
* @property string $apple_category
* @property string $google_category
*/
class Category extends Entity class Category extends Entity
{ {
protected ?Category $parent = null;
/** /**
* @var \App\Entity\Category|null * @var array<string, string>
*/ */
protected $parent;
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'parent_id' => 'integer', 'parent_id' => '?integer',
'code' => 'string', 'code' => 'string',
'apple_category' => 'string', 'apple_category' => 'string',
'google_category' => 'string', 'google_category' => 'string',
]; ];
public function getParent() public function getParent(): ?self
{ {
$parentId = $this->attributes['parent_id']; if ($this->parent_id === null) {
return null;
}
return $parentId != 0 return (new CategoryModel())->getCategoryById($this->parent_id);
? (new CategoryModel())->findParent($parentId)
: null;
} }
} }
<?php
declare(strict_types=1);
/**
* @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Entities\Clip;
use App\Entities\Episode;
use App\Entities\Podcast;
use App\Models\EpisodeModel;
use App\Models\PodcastModel;
use CodeIgniter\Entity\Entity;
use CodeIgniter\Files\File;
use CodeIgniter\I18n\Time;
use CodeIgniter\Shield\Entities\User;
use Modules\Auth\Models\UserModel;
use Modules\Media\Entities\Audio;
use Modules\Media\Entities\Video;
use Modules\Media\Models\MediaModel;
/**
* @property int $id
* @property int $podcast_id
* @property Podcast $podcast
* @property int $episode_id
* @property Episode $episode
* @property string $title
* @property double $start_time
* @property double $end_time
* @property double $duration
* @property string $type
* @property int|null $media_id
* @property Video|Audio|null $media
* @property array<mixed>|null $metadata
* @property string $status
* @property string $logs
* @property User $user
* @property int $created_by
* @property int $updated_by
* @property Time|null $job_started_at
* @property Time|null $job_ended_at
*/
class BaseClip extends Entity
{
/**
* @var Video|Audio|null
*/
protected $media;
protected ?int $job_duration = null;
protected ?float $end_time = null;
/**
* @var array<int, string>
* @phpstan-var list<string>
*/
protected $dates = ['created_at', 'updated_at', 'job_started_at', 'job_ended_at'];
/**
* @var array<string, string>
*/
protected $casts = [
'id' => 'integer',
'podcast_id' => 'integer',
'episode_id' => 'integer',
'title' => 'string',
'start_time' => 'double',
'duration' => 'double',
'type' => 'string',
'media_id' => '?integer',
'metadata' => '?json-array',
'status' => 'string',
'logs' => 'string',
'created_by' => 'integer',
'updated_by' => 'integer',
];
/**
* @param array<string, mixed>|null $data
*/
public function __construct(?array $data = null)
{
parent::__construct($data);
}
public function getJobDuration(): ?int
{
if ($this->job_duration === null && $this->job_started_at && $this->job_ended_at) {
$this->job_duration = ($this->job_started_at->difference($this->job_ended_at))
->getSeconds();
}
return $this->job_duration;
}
public function getEndTime(): float
{
if ($this->end_time === null) {
$this->end_time = $this->start_time + $this->duration;
}
return $this->end_time;
}
public function getPodcast(): ?Podcast
{
return (new PodcastModel())->getPodcastById($this->podcast_id);
}
public function getEpisode(): ?Episode
{
return (new EpisodeModel())->getEpisodeById($this->episode_id);
}
public function getUser(): ?User
{
/** @var ?User */
return (new UserModel())->find($this->created_by);
}
public function setMedia(File $file, string $fileKey): static
{
if ($this->media_id !== null) {
$this->getMedia()
->setFile($file);
$this->getMedia()
->updated_by = $this->attributes['updated_by'];
(new MediaModel('audio'))->updateMedia($this->getMedia());
} else {
$media = new Audio([
'file_key' => $fileKey,
'language_code' => $this->getPodcast()
->language_code,
'uploaded_by' => $this->attributes['updated_by'],
'updated_by' => $this->attributes['updated_by'],
]);
$media->setFile($file);
$this->attributes['media_id'] = (new MediaModel())->saveMedia($media);
}
return $this;
}
public function getMedia(): Audio | Video | null
{
if ($this->media_id !== null && $this->media === null) {
$this->media = (new MediaModel($this->type))->getMediaById($this->media_id);
}
return $this->media;
}
}