Skip to content

Commit

Permalink
Merge pull request #7 from gerardnico/alertbox
Browse files Browse the repository at this point in the history
SQlite release
  • Loading branch information
gerardnico authored Nov 9, 2018
2 parents 089f6b3 + 4631cb8 commit 1674653
Show file tree
Hide file tree
Showing 16 changed files with 1,017 additions and 399 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
######################
404managerRedirect.conf
Thumbs.db
404managerRedirect.conf.migrated
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

language: php
php:
- "5.5"
- "5.4"
- "5.3"
- "7.2"
- "7.1"
env:
- DOKUWIKI=stable
# - DOKUWIKI=master not needed
Expand Down
13 changes: 7 additions & 6 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Changes List


## v1.2.0 ()
* Pattern redirection modifications added
* Redirection Vote are done directly by user
* Redirection Validation threshold
* Status code is now dependent of the redirection validation
## v1.2.0 (2018-08-21)
* Redirections are now real redirections passing variable via the query string
* Sqlite has been added as database
* The redirection data and the log are now separated
* Php must be minimal 7.1
* During migration, the data store file 404managerRedirect.conf is renamed to 404managerRedirect.conf.migrated

## v1.1.0 (09-07-2016)
## v1.1.0 (2016-07-09)
* The page path is no more split by an underscore `_` for the best page name. This is to avoid that the algorithm will calculate a bigger score for a page in another namespace and before all, namespace are here to categorize pages. The plugin is based on same name page.
* The best name space page doesn't check all namespace if the page ID that gives a 404 has a existing namespace
* If the user is a Writer and their is a redirection, a redirection doesn't occur anymore. The writer is redirected in `edit mode` and can create directly the page.
Expand Down
47 changes: 47 additions & 0 deletions Message404.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Created by IntelliJ IDEA.
* User: gerard
* Date: 18/06/2018
* Time: 20:56
*/

class Message404
{


private $content = "";
private $type = self::TYPE_CLASSIC;

const TYPE_CLASSIC = 'Classic';
const TYPE_WARNING = 'Warning';

/**
* Message404 constructor.
*/
public function __construct()
{

}

public function addContent($message)
{
$this->content .= $message;
}

public function setType($type)
{
$this->type=$type;
}

public function getContent()
{
return $this->content;
}

public function getType()
{
return $this->type;
}

}
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ in order to move page around. The most important problem is that thus external l

## What can this plugin do ?

###For writers
### For writers
* Automatic redirection in edit mode
* A message is shown when the page name already exist in other pages.

Expand All @@ -41,6 +41,8 @@ Install the plugin using:

* the [Plugin Manager](https://www.dokuwiki.org/plugin:plugin)
* [manually](https://www.dokuwiki.org/plugin:Plugins) with the [download URL](http://github.com/gerardnico/dokuwiki-plugin-minimap/zipball/master), which points to latest version of the plugin.

on a server with minimal php 7.1

## Configuration settings

Expand Down Expand Up @@ -70,19 +72,7 @@ You will see the admin page for the 404 Manager Plugin. This page allow you to s
Action, you can perform :
* Add/Modify a redirect with the form Add/Modify
* Delete a redirect with the picture "delete"
* Validate the redirect with the picture validate in the column "Valid".

**Why I must validate a redirection ?**

When a redirection occurs, the 404manager plugin insert automatically the redirection in this list.

In this way :
* You can see thus which redirect occurs, when, where and how many time.
* The 404manager plugin uses it as a cache. If the same page is asked, it can retrieve easily the target page.

To be sure that the reader is not totally lost because he asks for one page and he have an other page, the 404 manager plugin fired a message. If you validate the redirection, this message disappears.

This action is always performed first in the process of redirection for a reader.

### Redirection by best name page

Expand Down Expand Up @@ -132,6 +122,15 @@ The query performed is an explode of the page asked.
* The page asked : namespace1:namespace2:pre_pagename
* The query asked : namespace1+namespace2+pre+pagename


## Data Store

You can find the meta data:
* for the last version: in the Sqlite Database DOKUWIKI_HOME/data/meta/404manager.sqlite3
* for the older version: in the file 404managerRedirect.conf or 404managerRedirect.conf.migrated in the directory DOKUWIKI_HOME\lib\plugins\404manager

With the SQLite plugin, the data can be queried directly through its admin page.

## Language
The plugin is only translated in English but you can translate it in your own language.

Expand Down
7 changes: 4 additions & 3 deletions _test/admin.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ public function test_expressionIsRegular()
// Not an expression
$inputExpression = "Hallo";
$isRegularExpression = admin_plugin_404manager::isRegularExpression($inputExpression);
$this->assertEquals(false,$isRegularExpression,"The term ("+$inputExpression+") is not a regular expression");
/** @noinspection PhpUndefinedMethodInspection */
$this->assertEquals(0,$isRegularExpression,"The term (".$inputExpression.") is not a regular expression");

// A basic expression
$inputExpression = "/Hallo/";
$isRegularExpression = admin_plugin_404manager::isRegularExpression($inputExpression);
$this->assertEquals(true,$isRegularExpression,"The term ("+$inputExpression+") is a regular expression");
$this->assertEquals(true,$isRegularExpression,"The term (".$inputExpression.") is a regular expression");

// A complicated expression
$inputExpression = "/(/path1/path2/)(.*)/";
$isRegularExpression = admin_plugin_404manager::isRegularExpression($inputExpression);
$this->assertEquals(true,$isRegularExpression,"The term ("+$inputExpression+") is a regular expression");
$this->assertEquals(true,$isRegularExpression,"The term (" . $inputExpression . ") is a regular expression");

}

Expand Down
12 changes: 0 additions & 12 deletions _test/constant_parameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ class constant_parameters
const NS_BRANCH_2 = 'ns_branch2';
const NS_BRANCH_WITH_PARENT_NAME_START_PAGE = 'ns_branch3';

// For a pattern test
const NS_BRANCH_PATTERN_1 = 'ns_pattern';
const NS_BRANCH_PATTERN_2 = 'ns_pattern2';

static $REDIRECT_WITH_PATTERN_DIRECTLY_SOURCE;
static $REDIRECT_WITH_PATTERN_DIRECTLY_TARGET;

static function init()
{
Expand Down Expand Up @@ -91,12 +85,6 @@ static function init()
self::$REDIRECT_TO_NAMESPACE_START_PAGE_PARENT_BAD_TARGET = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . self::NS_BRANCH_2 . self::PATH_SEPARATOR .'redirect_to_namespace_start_page';
self::$REDIRECT_TO_NAMESPACE_START_PAGE_PARENT_GOOD_TARGET = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . self::NS_BRANCH_WITH_PARENT_NAME_START_PAGE . self::PATH_SEPARATOR . self::NS_BRANCH_WITH_PARENT_NAME_START_PAGE;

// After the pattern transformation, the page exist, no page search
// The target goes one level back (ie NS_BRANCH_PATTERN_2 doesn't exist anymore)
self::$REDIRECT_WITH_PATTERN_DIRECTLY_SOURCE = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . self::NS_BRANCH_PATTERN_1 . self::PATH_SEPARATOR . self::NS_BRANCH_PATTERN_2 . self::PATH_SEPARATOR . self::$PAGE_EXIST_ID;
self::$REDIRECT_WITH_PATTERN_DIRECTLY_SOURCE = self::$MANAGER404_NAMESPACE . self::PATH_SEPARATOR . self::NS_BRANCH_PATTERN_1 . self::PATH_SEPARATOR . self::$PAGE_EXIST_ID;




}
Expand Down
Loading

0 comments on commit 1674653

Please sign in to comment.