Skip to content

Commit

Permalink
use blog package
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Nov 9, 2024
1 parent be32c7b commit 3bd4ade
Show file tree
Hide file tree
Showing 17 changed files with 431 additions and 1,486 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ RUN chmod +x /var/www/html/bin/psx
RUN cd /var/www/html && ./bin/psx migration:migrate --no-interaction
RUN cd /var/www/html && ./bin/psx app:fetch_adapter
RUN cd /var/www/html && ./bin/psx app:fetch_release
RUN cd /var/www/html && ./bin/psx app:update_blog
RUN cd /var/www/html && ./bin/psx blog:update

RUN chmod 777 -R /var/www/html/cache
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"symfony/dotenv": "^6.0",
"symfony/mailer": "^6.0",
"symfony/sendgrid-mailer": "^6.0",
"fusio/marketplace": "^0.1.4"
"fusio/marketplace": "^0.1.4",
"chriskapp/blog": "^0.1.2"
},
"require-dev": {
"vimeo/psalm": "^5.9"
Expand Down
938 changes: 411 additions & 527 deletions composer.lock

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,17 @@
'recaptcha_key' => env('APP_RECAPTCHA_KEY')->string(),
'recaptcha_secret' => env('APP_RECAPTCHA_SECRET')->string(),

// File which contains an atom feed with blog entries
// the blog source xml file containing all posts
'blog_file' => __DIR__ . '/resources/blog.xml',
'blog_title' => 'Fusio',

// the default author of the blog posts
'blog_author_name' => 'chriskapp',
'blog_author_uri' => 'https://chrisk.app/',

// the blog template files
'blog_template_index' => 'blog.php',
'blog_template_detail' => 'blog/detail.php',

// GIT repo data
'git_api' => 'https://api.github.com',
Expand Down
1 change: 1 addition & 0 deletions container.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
__DIR__,
true,
__DIR__ . '/vendor/psx/framework/resources/container.php',
__DIR__ . '/vendor/chriskapp/blog/resources/container.php',
__DIR__ . '/resources/container.php',
);
4 changes: 2 additions & 2 deletions resources/template/inc/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<link rel="dns-prefetch" href="https://www.googletagmanager.com/">
<link rel="icon" href="<?php echo $base; ?>/img/fusio_32px.png" type="image/png" />
<link rel="stylesheet" href="<?php echo $base; ?>/dist/app.min.css" />
<link rel="alternate" href="https://www.fusio-project.org/blog/feed" type="application/atom+xml" title="Fusio Blog" />
<link rel="alternate" href="<?php echo $router->getAbsolutePath([\Chriskapp\Blog\Controller\Feed::class, 'show']); ?>" type="application/atom+xml" title="Fusio Blog" />
<?php if(isset($canonical)): ?><link rel="canonical" href="<?php echo $canonical; ?>" />
<?php endif; ?>
<?php if(isset($bootstrap_icons)): ?><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
Expand Down Expand Up @@ -84,7 +84,7 @@ function gtag(){dataLayer.push(arguments);}
<a href="<?php echo $router->getAbsolutePath([\App\Controller\Partner::class, 'show']); ?>" class="nav-link">Partner</a>
</li>
<li class="nav-item">
<a href="<?php echo $router->getAbsolutePath([\App\Controller\Blog::class, 'show']); ?>" class="nav-link">Blog</a>
<a href="<?php echo $router->getAbsolutePath([\Chriskapp\Blog\Controller\Index::class, 'show']); ?>" class="nav-link">Blog</a>
</li>
</ul>
</div>
Expand Down
53 changes: 0 additions & 53 deletions src/Command/ShowBlogCommand.php

This file was deleted.

38 changes: 0 additions & 38 deletions src/Command/UpdateBlogCommand.php

This file was deleted.

79 changes: 0 additions & 79 deletions src/Controller/Blog.php

This file was deleted.

32 changes: 2 additions & 30 deletions src/Controller/Blog/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,15 @@

namespace App\Controller\Blog;

use App\Table;
use App\Table\Generated\BlogRow;
use PSX\Api\Attribute\Get;
use PSX\Api\Attribute\Path;
use PSX\Framework\Controller\ControllerAbstract;
use PSX\Framework\Http\Writer\Template;
use PSX\Framework\Loader\ReverseRouter;
use PSX\Http\Environment\HttpContextInterface;
use PSX\Http\Exception as StatusCode;

class Detail extends ControllerAbstract
class Detail extends \Chriskapp\Blog\Controller\Detail
{
private Table\Blog $blogTable;
private ReverseRouter $reverseRouter;

public function __construct(Table\Blog $blogTable, ReverseRouter $reverseRouter)
{
$this->blogTable = $blogTable;
$this->reverseRouter = $reverseRouter;
}

#[Get]
#[Path('/blog/post/:title')]
public function show(string $title): mixed
{
$entry = $this->blogTable->findOneByTitleSlug($title);
if (!$entry instanceof BlogRow) {
throw new StatusCode\NotFoundException('Entry not found');
}

$data = [
'title' => $entry->getTitle() . ' | Fusio',
'canonical' => $this->reverseRouter->getUrl([self::class, 'show'], [$entry->getTitleSlug()]),
'entry' => $entry,
];

$templateFile = __DIR__ . '/../../../resources/template/blog/detail.php';
return new Template($data, $templateFile, $this->reverseRouter);
return parent::show($title);
}
}
33 changes: 0 additions & 33 deletions src/Controller/Blog/Feed.php

This file was deleted.

13 changes: 2 additions & 11 deletions src/Migrations/Version20230513181334.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Migrations;

use Chriskapp\Blog\Service\BlogSchema;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

Expand All @@ -19,17 +20,7 @@ public function getDescription(): string

public function up(Schema $schema): void
{
$table = $schema->createTable('app_blog');
$table->addColumn('id', 'string', ['length' => 64]);
$table->addColumn('title', 'string');
$table->addColumn('title_slug', 'string');
$table->addColumn('author_name', 'string', ['length' => 128]);
$table->addColumn('author_uri', 'string');
$table->addColumn('updated', 'datetime');
$table->addColumn('summary', 'text');
$table->addColumn('category', 'string');
$table->addColumn('content', 'text');
$table->setPrimaryKey(['id']);
BlogSchema::build($schema);

$table = $schema->createTable('app_release');
$table->addColumn('id', 'string', ['length' => 64]);
Expand Down
Loading

0 comments on commit 3bd4ade

Please sign in to comment.