Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'psr2' into psr2-config
* psr2:
  fix: throw RemoteAccessDeniedException if not admin
  feat(RemoteAPI): Add call to delete Users to the remote API ✨
  Make lexer/state stack more understandable - rename lexer $mode property to avoid two different uses of "mode"   variables in the lexer - clarify/improve comments
  removed obsolete language files
  translation update
  decrease php versions by one
  appveyor: updated PHP versions
  another try at fixing appveyor php downloads using curl
  • Loading branch information
splitbrain committed May 25, 2018
2 parents 91109d5 + 8eb28c6 commit 303ffdf
Show file tree
Hide file tree
Showing 16 changed files with 75 additions and 309 deletions.
15 changes: 9 additions & 6 deletions appveyor.yml
Expand Up @@ -8,12 +8,15 @@ version: '{build}.{branch}'

environment:
matrix:
- PHP_VERSION: '7.0.21'
- PHP_VERSION: '7.2.4'
VC: 'VC15'
PHPUNIT: '7'
- PHP_VERSION: '7.0.29'
VC: 'VC14'
PHPUNIT: '6.3'
- PHP_VERSION: '5.6.30'
PHPUNIT: '6'
- PHP_VERSION: '5.6.35'
VC: 'VC11'
PHPUNIT: '5.7'
PHPUNIT: '5'

cache:
- c:\php -> appveyor.yml
Expand All @@ -26,7 +29,7 @@ install:
- IF NOT EXIST c:\php mkdir c:\php
- IF NOT EXIST c:\php\%PHP_VERSION% mkdir c:\php\%PHP_VERSION%
- cd c:\php\%PHP_VERSION%
- IF NOT EXIST php-installed.txt appveyor DownloadFile https://windows.php.net/downloads/releases/archives/php-%PHP_VERSION%-Win32-%VC%-x86.zip
- IF NOT EXIST php-installed.txt curl -fsSL -o php-%PHP_VERSION%-Win32-%VC%-x86.zip https://windows.php.net/downloads/releases/archives/php-%PHP_VERSION%-Win32-%VC%-x86.zip
- IF NOT EXIST php-installed.txt 7z x php-%PHP_VERSION%-Win32-%VC%-x86.zip -y >nul
- IF NOT EXIST php-installed.txt del /Q *.zip
- IF NOT EXIST php-installed.txt copy /Y php.ini-development php.ini
Expand All @@ -38,7 +41,7 @@ install:
- IF NOT EXIST php-installed.txt echo extension=php_gd2.dll >> php.ini
- IF NOT EXIST php-installed.txt echo extension=php_bz2.dll >> php.ini
- IF NOT EXIST php-installed.txt echo extension=php_pdo_sqlite.dll >> php.ini
- IF NOT EXIST php-installed.txt appveyor DownloadFile https://phar.phpunit.de/phpunit-%PHPUNIT%.phar -FileName phpunit.phar
- IF NOT EXIST php-installed.txt curl -fsSL -o phpunit.phar https://phar.phpunit.de/phpunit-%PHPUNIT%.phar
- IF NOT EXIST php-installed.txt type nul >> php-installed.txt

test_script:
Expand Down
20 changes: 20 additions & 0 deletions inc/Parsing/Handler/CallWriterInterface.php
Expand Up @@ -4,7 +4,27 @@

interface CallWriterInterface
{
/**
* Add a call to our call list
*
* @param $call the call to be added
*/
public function writeCall($call);

/**
* Append a list of calls to our call list
*
* @param $calls list of calls to be appended
*/
public function writeCalls($calls);

/**
* Explicit request to finish up and clean up NOW!
* (probably because document end has been reached)
*
* If part of a CallWriter chain, call finalise on
* the original call writer
*
*/
public function finalise();
}
2 changes: 1 addition & 1 deletion inc/Parsing/Handler/Nest.php
Expand Up @@ -20,7 +20,7 @@ class Nest implements ReWriterInterface
/**
* @inheritdoc
*
* @param CallWriterInterface $CallWriter the renderers current call writer
* @param CallWriterInterface $CallWriter the parser's current call writer, i.e. the one above us in the chain
* @param string $close closing instruction name, this is required to properly terminate the
* syntax mode if the document ends without a closing pattern
*/
Expand Down
20 changes: 10 additions & 10 deletions inc/Parsing/Lexer/Lexer.php
Expand Up @@ -30,7 +30,7 @@ class Lexer
/** @var \Doku_Handler */
protected $handler;
/** @var StateStack */
protected $mode;
protected $modeStack;
/** @var array mode "rewrites" */
protected $mode_handlers;
/** @var bool case sensitive? */
Expand All @@ -48,7 +48,7 @@ public function __construct($handler, $start = "accept", $case = false)
$this->case = $case;
$this->regexes = array();
$this->handler = $handler;
$this->mode = new StateStack($start);
$this->modeStack = new StateStack($start);
$this->mode_handlers = array();
}

Expand Down Expand Up @@ -179,7 +179,7 @@ public function parse($raw)
* @param int $matchPos Current byte index location in raw doc thats being parsed
* @return boolean False if there was any error from the parser.
*/
protected function dispatchTokens($unmatched, $matched, $mode = false, $initialPos, $matchPos)
protected function dispatchTokens($unmatched, $matched, $mode, $initialPos, $matchPos)
{
if (! $this->invokeHandler($unmatched, DOKU_LEXER_UNMATCHED, $initialPos)) {
return false;
Expand All @@ -188,17 +188,17 @@ protected function dispatchTokens($unmatched, $matched, $mode = false, $initialP
if (! $this->invokeHandler($matched, DOKU_LEXER_EXIT, $matchPos)) {
return false;
}
return $this->mode->leave();
return $this->modeStack->leave();
}
if ($this->isSpecialMode($mode)) {
$this->mode->enter($this->decodeSpecial($mode));
$this->modeStack->enter($this->decodeSpecial($mode));
if (! $this->invokeHandler($matched, DOKU_LEXER_SPECIAL, $matchPos)) {
return false;
}
return $this->mode->leave();
return $this->modeStack->leave();
}
if (is_string($mode)) {
$this->mode->enter($mode);
$this->modeStack->enter($mode);
return $this->invokeHandler($matched, DOKU_LEXER_ENTER, $matchPos);
}
return $this->invokeHandler($matched, DOKU_LEXER_MATCHED, $matchPos);
Expand Down Expand Up @@ -256,7 +256,7 @@ protected function invokeHandler($content, $is_match, $pos)
if (($content === "") || ($content === false)) {
return true;
}
$handler = $this->mode->getCurrent();
$handler = $this->modeStack->getCurrent();
if (isset($this->mode_handlers[$handler])) {
$handler = $this->mode_handlers[$handler];
}
Expand All @@ -282,13 +282,13 @@ protected function invokeHandler($content, $is_match, $pos)
*/
protected function reduce(&$raw)
{
if (! isset($this->regexes[$this->mode->getCurrent()])) {
if (! isset($this->regexes[$this->modeStack->getCurrent()])) {
return false;
}
if ($raw === "") {
return true;
}
if ($action = $this->regexes[$this->mode->getCurrent()]->split($raw, $split)) {
if ($action = $this->regexes[$this->modeStack->getCurrent()]->split($raw, $split)) {
list($unparsed, $match, $raw) = $split;
return array($unparsed, $match, $action);
}
Expand Down
2 changes: 1 addition & 1 deletion inc/Parsing/Lexer/StateStack.php
Expand Up @@ -47,7 +47,7 @@ public function enter($state)
/**
* Leaves the current state and reverts
* to the previous one.
* @return boolean False if we drop off the bottom of the list.
* @return boolean false if we attempt to drop off the bottom of the list.
*/
public function leave()
{
Expand Down
25 changes: 24 additions & 1 deletion inc/Remote/ApiCore.php
Expand Up @@ -77,7 +77,11 @@ public function __getRemoteInfo()
'args' => array('string', 'string', 'array'),
'return' => 'bool',
'doc' => 'Append text to a wiki page.'
), 'wiki.getPage' => array(
), 'dokuwiki.deleteUsers' => array(
'args' => array('array'),
'return' => 'bool',
'doc' => 'Remove one or more users from the list of registered users.'
), 'wiki.getPage' => array(
'args' => array('string'),
'return' => 'string',
'doc' => 'Get the raw Wiki text of page, latest version.',
Expand Down Expand Up @@ -576,6 +580,25 @@ public function appendPage($id, $text, $params)
return $this->putPage($id, $currentpage . $text, $params);
}

/**
* Remove one or more users from the list of registered users
*
* @param string[] $usernames List of usernames to remove
*
* @return bool
*
* @throws AccessDeniedException
*/
public function deleteUsers($usernames)
{
if (!auth_isadmin()) {
throw new AccessDeniedException('Only admins are allowed to delete users', 114);
}
/** @var DokuWiki_Auth_Plugin $auth */
global $auth;
return (bool)$auth->triggerUserMod('deleteUsers', $usernames);
}

/**
* Uploads a file to the wiki.
*
Expand Down
19 changes: 10 additions & 9 deletions inc/lang/de/lang.php
Expand Up @@ -3,6 +3,7 @@
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*
* @author Sebastian Engel <mail@engel-s.de>
* @author Karl_de_Hall <Karl.Grohmueller@sonnenhof-sha.de>
* @author Michael Bohn <mjbohn@gmail.com>
* @author Joel Strasser <strasser999@gmail.com>
Expand Down Expand Up @@ -139,15 +140,15 @@
$lang['js']['media_drop'] = 'Dateien hier hinziehen um sie hochzuladen';
$lang['js']['media_cancel'] = 'Entfernen';
$lang['js']['media_overwrt'] = 'Existierende Dateien überschreiben';
$lang['search_exact_match'] = 'genaue Treffer';
$lang['search_starts_with'] = 'beginnt mit';
$lang['search_ends_with'] = 'endet mit';
$lang['search_contains'] = 'enthält';
$lang['search_custom_match'] = 'angepasst ';
$lang['search_any_ns'] = 'alle Kategorien';
$lang['search_any_time'] = 'jederzeit';
$lang['search_past_7_days'] = 'letzte Woche';
$lang['search_past_month'] = 'letzter Monat';
$lang['search_exact_match'] = 'Genaue Treffer';
$lang['search_starts_with'] = 'Beginnt mit';
$lang['search_ends_with'] = 'Endet mit';
$lang['search_contains'] = 'Enthält';
$lang['search_custom_match'] = 'Angepasst ';
$lang['search_any_ns'] = 'Alle Namensräume';
$lang['search_any_time'] = 'Jederzeit';
$lang['search_past_7_days'] = 'Letzte Woche';
$lang['search_past_month'] = 'Letzter Monat';
$lang['search_past_year'] = 'letztes Jahr';
$lang['search_sort_by_hits'] = 'Sortiere nach Treffer';
$lang['search_sort_by_mtime'] = 'Sortiere nach letzter Änderung';
Expand Down
11 changes: 0 additions & 11 deletions lib/plugins/authmysql/lang/cs/lang.php

This file was deleted.

43 changes: 0 additions & 43 deletions lib/plugins/authmysql/lang/cs/settings.php

This file was deleted.

11 changes: 0 additions & 11 deletions lib/plugins/authmysql/lang/it/lang.php

This file was deleted.

46 changes: 0 additions & 46 deletions lib/plugins/authmysql/lang/it/settings.php

This file was deleted.

11 changes: 0 additions & 11 deletions lib/plugins/authmysql/lang/ja/lang.php

This file was deleted.

0 comments on commit 303ffdf

Please sign in to comment.