Skip to content

Commit

Permalink
Add operation modes to the scheduler (#13)
Browse files Browse the repository at this point in the history
* WIP Add scheduler & config

* Apply fixes from StyleCI

* Create default setting

* Clear the sitemap cache if mode is runtime

* Register provider, add frequency selection, define defaults

* Apply fixes from StyleCI

* Add translations for freqency

* Cleanup

* Apply fixes from StyleCI

* Add warning and link to info on setting up the scheduler

* Add link to info on scheduler

* Tidy

* Build JS
  • Loading branch information
Ian Morland authored Jun 8, 2020
1 parent d7554a2 commit a3ca707
Show file tree
Hide file tree
Showing 30 changed files with 506 additions and 46 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ return [
```
That's it.

## Scheduling

If the size of your forum requires one of the cache modes - either in-memory or disk, consider setting up the Flarum scheduler. Read more information about this [here](https://discuss.flarum.org/d/24118)

## Commissioned

The initial version of this extension was sponsored by [profesionalreview.com](https://www.profesionalreview.com/).
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
"source": "https://github.com/FriendsOfFlarum/sitemap"
},
"require": {
"flarum/core": ">=0.1.0-beta.12 <0.1.0-beta.14"
"flarum/core": ">=0.1.0-beta.13 <0.1.0-beta.14",
"fof/console": "^0.5.3",
"fof/components": "^0.1.1"
},
"extra": {
"flarum-extension": {
Expand Down
32 changes: 25 additions & 7 deletions extend.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
<?php

/*
* This file is part of fof/sitemap.
*
* Copyright (c) 2020 FriendsOfFlarum.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*
*/

namespace FoF\Sitemap;

use FoF\Sitemap\Controllers\SitemapController;
use Flarum\Console\Event\Configuring;
use Flarum\Extend;
use Flarum\Foundation\Application;
use FoF\Sitemap\Controllers\SitemapController;
use Illuminate\Contracts\Events\Dispatcher;

return [
new \FoF\Components\Extend\AddFofComponents(),

new \FoF\Console\Extend\EnableConsole(),

(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js'),

(new Extend\Routes('forum'))
->get('/sitemap.xml', 'fof-sitemap-index', SitemapController::class),

new Extend\Locales(__DIR__.'/resources/locale'),

function (Application $app, Dispatcher $events) {
$app->register(Providers\ResourceProvider::class);
$app->register(Providers\ViewProvider::class);

$events->listen(Configuring::class, function (Configuring $event) {
$event->addCommand(Commands\CacheSitemapCommand::class);
$event->addCommand(Commands\MultiPageSitemapCommand::class);
});
$app->register(Providers\ConsoleProvider::class);
},

(new Extend\Console())->command(Commands\CacheSitemapCommand::class),
(new Extend\Console())->command(Commands\MultiPageSitemapCommand::class),
];
1 change: 1 addition & 0 deletions js/admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './src/admin';
2 changes: 2 additions & 0 deletions js/dist/admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions js/dist/admin.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@fof/sitemap",
"version": "0.0.0",
"private": true,
"dependencies": {
"flarum-webpack-config": "^0.1.0-beta.10",
"webpack": "^4.26.0",
"webpack-cli": "^3.0.7"
},
"scripts": {
"dev": "webpack --mode development --watch",
"build": "webpack --mode production",
"lint": "prettier --single-quote --trailing-comma es5 --print-width 150 --tab-width 4 --write src/**/*"
},
"devDependencies": {
"prettier": "^1.19.1"
}
}
Loading

0 comments on commit a3ca707

Please sign in to comment.