# Wiki statistics
wikistats Plugin for DokuWiki
## General informations
| Title | |
| - | - |
| Last updated on | 2017-06-28 |
| Provides | [Syntax](https://www.dokuwiki.org/plugins?plugintype=1#extension__table "List all Syntax plugins"), [Helper](https://www.dokuwiki.org/plugins?plugintype=16#extension__table "List all Helper plugins"), [Action](https://www.dokuwiki.org/plugins?plugintype=4#extension__table "List all Action plugins") |
| Conflicts with | N/A |
| Requires | N/A |
| Optionally requires | [tag](https://www.dokuwiki.org/plugin:tag "plugin tag") (for displaying tag related stats) |
| Similar to | [numberof](https://www.dokuwiki.org/plugin:numberof "plugin numberof"), [stats](https://www.dokuwiki.org/plugin:stats "plugin stats") |
| Tagged with | [report](https://www.dokuwiki.org/plugins?plugintag=report#extension__table "List all plugins with this tag"), [statistics](https://www.dokuwiki.org/plugins?plugintag=statistics#extension__table "List all plugins with this tag") |
| Compatible with Dokuwiki | [Release 2017-02-19b "Frusterick Manners"](https://download.dokuwiki.org/src/dokuwiki/dokuwiki-2017-02-19b.tgz "Release 2017-02-19b - Frusterick Manners"),
[Release 2016-06-26b "Elenor of Tsort"](https://download.dokuwiki.org/src/dokuwiki/dokuwiki-2016-06-26b.tgz "Release 2016-06-26b - Elenor of Tsort"),
[Release 2015-08-10 "Detritus"](https://download.dokuwiki.org/src/dokuwiki/dokuwiki-2015-08-10.tgz "Release 2015-08-10 - Detritus"),
[Release 2014-09-29d "Hrun"](https://download.dokuwiki.org/src/dokuwiki/dokuwiki-2014-09-29d.tgz "Release 2014-09-29d - Hrun"),
[Release 2014-05-05a "Ponder Stibbons"](https://download.dokuwiki.org/src/dokuwiki/dokuwiki-2014-05-05a.tgz "Release 2014-05-05a - Ponder Stibbons") |
| License | [GNU GPL v2](http://www.opensource.org/licenses/gpl-license.php "GNU GPL v2") |
All documentation for this plugin can be found at
[wikistats plugin page at Dokuwiki](https://www.dokuwiki.org/plugin:wikistats)
## Installation
Download the wikistats archive from the [git repo](https://github.com/4x4-chris/wikistats).
If you install this plugin manually, make sure it is installed in
`lib/plugins/wikistats/` - if the folder is called different it
will not work!
Please refer to [Dokuwiki plugin general page](https://www.dokuwiki.org/plugins) or [Dokuwiki plugin installation instructions](https://www.dokuwiki.org/plugin_installation_instructions) for additional info
on how to install plugins in DokuWiki.
### Add Stat Link to your Template
This plugin requires the modification of the template (often `main.php`).
Decide where you want to insert the *Stats* link in your template and
insert the following code:
```php
if (!plugin_isdisabled('wikistats') &&
($wikistats =& plugin_load('helper', 'wikistats'))) {
$wikistats->add_stats_link();
}
```
Most likely you want to do that in the `/lib/tpl/default/main.php` inside the
`
` as follows:
```html
add_stats_link(); ?>
```
For Dokuwiki "**Release 2017-02-19b Frusterick Manners**", you should process as follows:
```html
```
Now, you have to create the **stats page** following the namespace and name given in the plugin admin configuration (```wiki:statistiques``` is the default value).
To create this page, do as usual :smile:
And add some code within, for example:
```
====== Statistiques ======
{{wikistats>ns = -wiki & type = stats}}
```
## Usage
### Type of stats displayed
To display only topic (pages) stats
```
{{wikistats>type = pages}}
```
To display only resources stats
```
{{wikistats>type = medias}}
```
To display all stats (including namspaces and tags (if tag plugin is installed))
```
{{wikistats>type = all}}
```
> Note that the type parameter is mandatory
### Whitelist/blacklist by namespace
By default plugin shows the stats of the entire wiki. To restrict the statistics
to a given namespace and its sub-namespaces you can specify its name
either directly or using `ns` parameter:
```
{{wikistats>foo & type = pages}}
{{wikistats>ns = foo & type = pages}}
```
The `ns` parameter supports both inclusion and exclusion of the namespaces.
If a namespace name starts with a minus sign that namespace will be excluded.
Also you can assign a number of namespaces as a comma separated list:
```
{{wikistats>ns = -foo & type = pages}}
{{wikistats>ns = foo, bar, -bar:baz & type = pages}}
```
The first example will show the pages stats in all namespaces except of “foo”,
the second one will include “foo” and “bar” namespaces except of “bar:baz”
sub-namespace.
> Note that namespaces restrictions are not supported for tags and
> namespaces stats
### Multiple parameters syntax
If you want to pass a number of parameters to the plugin they should be
separated with an ampersand (`&`), for example:
```
{{wikistats>ns = -foo & type = pages}}
```
The above syntax would display pages stats for the entire wiki except for
the “foo” namespace.
## Development
### Git repository
A public git repository is available [here](https://github.com/4x4-chris/wikistats)
### Bugs and features request
Please report issues in the [bug tracker](https://github.com/4x4-chris/wikistats/issues)
### Languages
* English
* French
* Spanish
* German
### ToDo / Wish list
* Add bargraph display
* Allow configuration of bar color
* Support namespaces restrictions for tags stats
* Handle namespaces with medias and without pages as an error (could be configured)
* Color for namespace errors could be configured
* Add Docker support for development environnement
* Add total for resources and namespaces stats
* Add Travis-CI support
* Add unit tests: plugin.info.txt compliance
### Changelog
* 2017-06-30
* Add screenshot for dokuwiki plugin page
* 2017-06-29
* Add TOC support
* TOC display could be desactivated in plugin administration
* 2017-06-28
* **2017-06-28 release**
* 2017-06-27
* Add option to change render style
* Add resources types translations
* Namespace stats now show medias counts
* Update General Informations and Installation instructions
* Plugin now display stats even if Tag plugin is not installed
* Namespaces are sorted in ascending alphabetical order
* Code refactoring
* 2017-06-22
* Add stats icon to wiki template
* 2017-06-20
* **Initial release**
## FAQ
_None actually_
----
Copyright (C) Chris4x4 <4x4.chris@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
See the COPYING file in your DokuWiki folder for details