Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions bin/create-uploads-dir
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ $entityManager = $container->get(EntityManager::class);
$postRepository = $entityManager->getRepository(Post::class);

/**
* Index every file anywhere under public/ by basename, so we can locate the
* source file for each image referenced from a template or markdown
* article - including images already sitting in some other article's
* uploads/article/{uuid}/ directory (e.g. left over from before a post's
* UUID changed), not just loose files dropped outside uploads/article/.
*
* @return array<string, string>
*/
function indexUploadSources(string $publicDir): array
Expand All @@ -65,11 +59,6 @@ function indexUploadSources(string $publicDir): array
}

/**
* Extract every (uuid, filename) pair referenced via an
* "uploads/article/{uuid}/{filename}" path in Markdown article content -
* these are hardcoded literally in .md files, unlike the dynamic
* `~ article.id ~` expression used in .html.twig templates.
*
* @return list<array{uuid: string, filename: string}>
*/
function extractArticleImageRefs(string $contents): array
Expand Down Expand Up @@ -99,7 +88,6 @@ function extractArticleImageRefs(string $contents): array

$sourceIndex = indexUploadSources($publicDir);

// Matches the filename in: asset('uploads/article/' ~ article.id ~ '/filename.ext')
$pattern = '/~\s*article\.id\s*~\s*\'\/([^\']+)\'/';

$filesProcessed = 0;
Expand Down Expand Up @@ -171,16 +159,6 @@ foreach ($templateIterator as $file) {
}
}

/**
* Markdown articles (public/md-articles/{category-slug}/{article-slug}.md)
* embed uploads/article/{uuid}/{filename} paths as literal text, unlike
* .html.twig templates whose `~ article.id ~` is resolved dynamically. Since
* a Post's UUID (uuid7) is generated fresh the first time its slug is
* fixture-inserted in a given environment, a UUID hardcoded in a .md file
* drifts from the Post's real UUID as soon as that slug is (re)seeded
* elsewhere. This pass detects that drift, rewrites the file to the real
* UUID, and makes sure the image is available under the corrected path.
*/
$mdArticlesDir = 'public/md-articles';

$mdFilesProcessed = 0;
Expand All @@ -200,10 +178,6 @@ if (is_dir($mdArticlesDir)) {
}

$path = $file->getPathname();

// Only handle files one level under a category directory, i.e.
// public/md-articles/{category-slug}/{article-slug}.md - skips
// stray top-level files such as md-articles/index.md.
$relative = ltrim(substr($path, strlen($mdArticlesDir)), '/');
if (substr_count($relative, '/') !== 1) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Let's take a practical view on software security in Dotkernel.

You should never trust that the user inputs correct data by passing it directly into your business logic. By defining the configuration for an input filter, you ensure that a field is both present, and of the correct type.

[Dotkernel API](https://www.dotkernel.org) makes use of [laminas/laminas-inputfilter](https://github.com/laminas/laminas-inputfilter) for this purpose.
[Dotkernel API](https://www.dotkernel.com/api/) makes use of [laminas/laminas-inputfilter](https://github.com/laminas/laminas-inputfilter) for this purpose.

In addition to the above filtering, Dotkernel Admin also makes use of [laminas/laminas-form](https://github.com/laminas/laminas-form). laminas-form contains:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ It's intended to highlight the differences between the two and also to showcase

| | **API Tools (formerly Apigility)** | **Dotkernel API** |
| --- | --- | --- |
| URL | [api-tools](https://api-tools.getlaminas.org/) | [Dotkernel API](https://www.dotkernel.org) |
| URL | [api-tools](https://api-tools.getlaminas.org/) | [Dotkernel API](https://www.dotkernel.com/api/) |
| First Release | 2012 | 2018 |
| PHP Version | <= 8.2 | ![PHP Version](https://img.shields.io/packagist/php-v/dotkernel/api) |
| Architecture | MVC, Event Driven | Middleware |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,6 @@ A: Both live in src/App/templates/layout/default.html.twig: the top menu items a

## Resources

- [dotkernel.org](https://www.dotkernel.org) - a working example
- [dotkernel.org](https://www.dotkernel.com/api/) - a working example
- [Dotkernel Light](https://github.com/dotkernel/light)
- [More from Dotkernel](https://github.com/dotkernel)
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Using both together, sharing a common Core module, gives consistent entities and

The Dotkernel Headless Platform contains two major components:

- [Dotkernel API](https://www.dotkernel.org) - a REST API based on the [Mezzio skeleton](https://github.com/mezzio/mezzio-skeleton).
- [Dotkernel API](https://www.dotkernel.com/api/) - a REST API based on the [Mezzio skeleton](https://github.com/mezzio/mezzio-skeleton).
- [Dotkernel Admin](https://github.com/dotkernel/admin) - a complementary component aimed at quickly setting up a backend for your platform.

The Admin is not bundled by default but is available as a first-party, installable application designed to work seamlessly alongside your API.
Expand Down
2 changes: 1 addition & 1 deletion src/App/templates/partial/left-menu.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
</a>
</li>
<li>
<a href="https://www.dotkernel.org" target="_blank" rel="noopener">
<a href="https://www.dotkernel.com/api/" target="_blank" rel="noopener">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M8 4 3 12l5 8M16 4l5 8-5 8"/></svg>
Dotkernel API
</a>
Expand Down