Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b230c75aa |
No files matched your search
@@ -4,6 +4,10 @@ Every release has a section here, named after its version (for example `v0.1.0 -
|
|||||||
heading). The release pull request to `production` is stopped by PR CI when its section is missing, and the text of
|
heading). The release pull request to `production` is stopped by PR CI when its section is missing, and the text of
|
||||||
the section is the text of the release in Gitea.
|
the section is the text of the release in Gitea.
|
||||||
|
|
||||||
|
## v0.9.1 - 2026-12-04
|
||||||
|
|
||||||
|
- Statistics and numbers can name a page: `manager.statistics.names` (`'/about' => 'About us'`) and, for a kind of page with many of them (services, projects), a resolver `app(PageNames::class)->register(fn ($path) => ...)`. A post keeps its title; the address stays the fallback.
|
||||||
|
|
||||||
## v0.9.0 - 2026-12-04
|
## v0.9.0 - 2026-12-04
|
||||||
|
|
||||||
- The page builder, first layer: a page can hold blocks (`pages.blocks`, an ordered list of `{id, type, data, style, hidden}`). A page with a definition says `'blocks' => true` (or a list of block types); `manager.blocks.free_pages` does the same for pages without one. `Support\Blocks` knows the block types that ship (hero, page title, text, text with picture, picture, box with points, gallery, before and after, quote, numbers, tags, questions and answers, cards from a list, call to action, request form, line, space), the ones a site adds in `manager.blocks.types` or with `Blocks::register()`, and the choices of the style options (`manager.blocks.tokens`). Saving cleans every block with the fields of its type; `Blocks::for('home')` gives the public site the visible blocks in order, with the records of a list for a block that shows one (a block of a feature that is off is left out); the pages API gives the screen the blocks and the types. Design and decision: `docs/design/page-builder.md` and ADR-0012 (in the repository, not in the package).
|
- The page builder, first layer: a page can hold blocks (`pages.blocks`, an ordered list of `{id, type, data, style, hidden}`). A page with a definition says `'blocks' => true` (or a list of block types); `manager.blocks.free_pages` does the same for pages without one. `Support\Blocks` knows the block types that ship (hero, page title, text, text with picture, picture, box with points, gallery, before and after, quote, numbers, tags, questions and answers, cards from a list, call to action, request form, line, space), the ones a site adds in `manager.blocks.types` or with `Blocks::register()`, and the choices of the style options (`manager.blocks.tokens`). Saving cleans every block with the fields of its type; `Blocks::for('home')` gives the public site the visible blocks in order, with the records of a list for a block that shows one (a block of a feature that is off is left out); the pages API gives the screen the blocks and the types. Design and decision: `docs/design/page-builder.md` and ADR-0012 (in the repository, not in the package).
|
||||||
|
|||||||
@@ -368,6 +368,7 @@ scheduled daily), so a code cannot be traced back afterwards. A browser that sen
|
|||||||
`app(IriksIT\Manager\Modules\Statistics\CountedPages::class)->register(fn (string $path) => ...)`.
|
`app(IriksIT\Manager\Modules\Statistics\CountedPages::class)->register(fn (string $path) => ...)`.
|
||||||
- **Programs**: the pages served to search engines, crawlers and previews are counted per day, program and page (no address, no browser
|
- **Programs**: the pages served to search engines, crawlers and previews are counted per day, program and page (no address, no browser
|
||||||
line), by a middleware the module adds to the `web` group (`manager.statistics.count_bots`).
|
line), by a middleware the module adds to the `web` group (`manager.statistics.count_bots`).
|
||||||
|
A page without a title of its own is named by `manager.statistics.names` (`'/about' => 'About us'`) or a resolver (`app(PageNames::class)->register(fn ($path) => ...)`); the address is the fallback.
|
||||||
- **The report** (`statistics.view`): visitors, visits, page views, time, bounce rate, a comparison with another period, pages, posts,
|
- **The report** (`statistics.view`): visitors, visits, page views, time, bounce rate, a comparison with another period, pages, posts,
|
||||||
sources and channels, devices, heatmap, programs; `GET /manager/statistics?range=30d` and a CSV per sheet
|
sources and channels, devices, heatmap, programs; `GET /manager/statistics?range=30d` and a CSV per sheet
|
||||||
(`/manager/statistics/export?sheet=days|pages|sources|bots`).
|
(`/manager/statistics/export?sheet=days|pages|sources|bots`).
|
||||||
|
|||||||
@@ -165,6 +165,10 @@ return [
|
|||||||
// The address under which the posts live (`/blog` for `/blog/my-post`); null: posts are not counted.
|
// The address under which the posts live (`/blog` for `/blog/my-post`); null: posts are not counted.
|
||||||
'posts_path' => null,
|
'posts_path' => null,
|
||||||
|
|
||||||
|
// What a page is called on the screens when it has no title of its own (a post has): `'/about' => 'About us'`. A kind of page with many
|
||||||
|
// of them (services, projects) is named by a resolver: app(PageNames::class)->register(fn ($path) => ...). The address is the fallback.
|
||||||
|
'names' => [],
|
||||||
|
|
||||||
// Where the public pages report a view (POST {pulse_path}/view and {pulse_path}/leave).
|
// Where the public pages report a view (POST {pulse_path}/view and {pulse_path}/leave).
|
||||||
'pulse_path' => 'pulse',
|
'pulse_path' => 'pulse',
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace IriksIT\Manager\Modules\Statistics;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What a page is called on the statistics and numbers screens, when it has no title of its own (a post has). The address is the fallback.
|
||||||
|
* A site names its pages in `manager.statistics.names` (`'/over-ons' => 'About us'`), and a kind of page with many of them (a service,
|
||||||
|
* a project) with a resolver: `app(PageNames::class)->register(fn (string $path) => ...)` returns the name, or null for "not mine".
|
||||||
|
*/
|
||||||
|
final class PageNames
|
||||||
|
{
|
||||||
|
/** @var list<Closure(string): ?string> */
|
||||||
|
private array $resolvers = [];
|
||||||
|
|
||||||
|
/** @param Closure(string): ?string $resolver gets an address like `/over-ons` */
|
||||||
|
public function register(Closure $resolver): void
|
||||||
|
{
|
||||||
|
$this->resolvers[] = $resolver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function name(string $path): ?string
|
||||||
|
{
|
||||||
|
$names = (array) config('manager.statistics.names', []);
|
||||||
|
$name = $names[$path] ?? $names['/'.trim($path, '/')] ?? null;
|
||||||
|
|
||||||
|
if (is_string($name) && $name !== '') {
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->resolvers as $resolver) {
|
||||||
|
$name = $resolver($path);
|
||||||
|
|
||||||
|
if (is_string($name) && $name !== '') {
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -486,7 +486,7 @@ final class Statistics
|
|||||||
|
|
||||||
$pages[] = [
|
$pages[] = [
|
||||||
'path' => is_string($row->path) ? $row->path : '',
|
'path' => is_string($row->path) ? $row->path : '',
|
||||||
'title' => is_string($title) ? $title : null,
|
'title' => is_string($title) ? $title : app(PageNames::class)->name(is_string($row->path) ? $row->path : ''),
|
||||||
'views' => $views,
|
'views' => $views,
|
||||||
'average_seconds' => $views > 0 ? (int) round(self::number($row->seconds) / $views) : 0,
|
'average_seconds' => $views > 0 ? (int) round(self::number($row->seconds) / $views) : 0,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ class StatisticsModule extends BaseModule
|
|||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
app()->singleton(CountedPages::class);
|
app()->singleton(CountedPages::class);
|
||||||
|
app()->singleton(PageNames::class);
|
||||||
|
|
||||||
// A person opens a few pages a minute; this only stops someone from flooding the statistics.
|
// A person opens a few pages a minute; this only stops someone from flooding the statistics.
|
||||||
RateLimiter::for('manager-pulse', fn (Request $request) => Limit::perMinute(max(1, (int) config('manager.statistics.per_minute', 120)))->by((string) $request->ip()));
|
RateLimiter::for('manager-pulse', fn (Request $request) => Limit::perMinute(max(1, (int) config('manager.statistics.per_minute', 120)))->by((string) $request->ip()));
|
||||||
|
|||||||
Reference in new issue
Block a user