mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-12 03:06:43 +02:00
style(ecs): add easy-coding-standard to enforce coding style rules for php
- update .devcontainer settings: remove auto-formatting for php + set intelephense as default formatter - remove prettier php plugin as it lacks php 8 support - add captain hook action for checking style pre-commit - fix style with ecs on all files except views
This commit is contained in:
parent
fb3593f828
commit
aa1612342e
230 changed files with 3420 additions and 5884 deletions
|
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Class SoundbiteModel
|
||||
* Model for podcasts_soundbites table in database
|
||||
* Class SoundbiteModel Model for podcasts_soundbites table in database
|
||||
*
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -11,8 +10,8 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Database\BaseResult;
|
||||
use App\Entities\Soundbite;
|
||||
use CodeIgniter\Database\BaseResult;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class SoundbiteModel extends Model
|
||||
|
|
@ -21,6 +20,7 @@ class SoundbiteModel extends Model
|
|||
* @var string
|
||||
*/
|
||||
protected $table = 'soundbites';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
|
@ -43,6 +43,7 @@ class SoundbiteModel extends Model
|
|||
* @var string
|
||||
*/
|
||||
protected $returnType = Soundbite::class;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
|
|
@ -57,16 +58,18 @@ class SoundbiteModel extends Model
|
|||
* @var string[]
|
||||
*/
|
||||
protected $afterInsert = ['clearCache'];
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
protected $afterUpdate = ['clearCache'];
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
protected $beforeDelete = ['clearCache'];
|
||||
|
||||
public function deleteSoundbite(int $podcastId, int $episodeId, int $soundbiteId): BaseResult|bool
|
||||
public function deleteSoundbite(int $podcastId, int $episodeId, int $soundbiteId): BaseResult | bool
|
||||
{
|
||||
return $this->delete([
|
||||
'podcast_id' => $podcastId,
|
||||
|
|
@ -83,14 +86,15 @@ class SoundbiteModel extends Model
|
|||
public function getEpisodeSoundbites(int $podcastId, int $episodeId): array
|
||||
{
|
||||
$cacheName = "podcast#{$podcastId}_episode#{$episodeId}_soundbites";
|
||||
if (!($found = cache($cacheName))) {
|
||||
if (! ($found = cache($cacheName))) {
|
||||
$found = $this->where([
|
||||
'episode_id' => $episodeId,
|
||||
'podcast_id' => $podcastId,
|
||||
])
|
||||
->orderBy('start_time')
|
||||
->findAll();
|
||||
cache()->save($cacheName, $found, DECADE);
|
||||
cache()
|
||||
->save($cacheName, $found, DECADE);
|
||||
}
|
||||
return $found;
|
||||
}
|
||||
|
|
@ -107,16 +111,15 @@ class SoundbiteModel extends Model
|
|||
: $data['id']['episode_id'],
|
||||
);
|
||||
|
||||
cache()->delete(
|
||||
"podcast#{$episode->podcast_id}_episode#{$episode->id}_soundbites",
|
||||
);
|
||||
cache()
|
||||
->delete("podcast#{$episode->podcast_id}_episode#{$episode->id}_soundbites",);
|
||||
|
||||
// delete cache for rss feed
|
||||
cache()->deleteMatching("podcast#{$episode->podcast_id}_feed*");
|
||||
cache()
|
||||
->deleteMatching("podcast#{$episode->podcast_id}_feed*");
|
||||
|
||||
cache()->deleteMatching(
|
||||
"page_podcast#{$episode->podcast_id}_episode#{$episode->id}_*",
|
||||
);
|
||||
cache()
|
||||
->deleteMatching("page_podcast#{$episode->podcast_id}_episode#{$episode->id}_*",);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue