Commit Graph

109 Commits

Author SHA1 Message Date
Andreas Gohr 413313a155 Merge branch 'logging'
* logging:
  added JavaScript based filter mechanism
  added logging configuration
  replaced out calls to dbglog with new Logger calls
  added convenience methods to log to our default facilities
  added logviwer admin plugin
  added log dir to git
  central logging mechanism
2020-12-03 20:01:57 +01:00
Syntaxseed 8368419bb5 Fix proper param order and use main function name instead of alias 'join'. 2020-10-13 13:59:35 +02:00
Andreas Gohr 96da53f636
Merge pull request #2443 from splitbrain/fixGetVersion
🐛 make getVersion() show the commit date, not checkout date
2020-10-13 13:15:56 +02:00
Andreas Gohr cad4fbf6e2 added logging configuration
Log facitlities can now be disabled. By default only debug is disabled.
It might make sense to by default disable deprecated as well?

Debug logging is now independend of the allowdebug method. allowdebug
was often used in two ways: for displaying errors directly to the user
and for logging to the debug log. Now it only controls the former.
2020-08-13 20:28:52 +02:00
Andreas Gohr 31667ec678 replaced out calls to dbglog with new Logger calls 2020-08-13 20:04:34 +02:00
Andreas Gohr 0ecde6ce23 central logging mechanism
This introduces a logger mechanism and a new data/log directory. This is
a first proof of concept. It's built on top of the new global error
handling mechanism

Things to discuss:

* should we adopt PSR-3 somehow? if yes, how and should plugins be able
  to drop-in other psr3 loggers?
* how to configure which facilities shall be logged?
* should we implement a log deletion feature?
* is the log format sensible?
* should we implement a log viewer admin plugin?
* should logging trigger events (it should maybe replace the
  deprecation event)
2020-08-13 13:28:40 +02:00
Andreas Gohr 3f874cb397 increase minimum PHP version to 7.2 2020-08-12 17:39:37 +02:00
Andreas Gohr 46028c4c32 Move defines to their own file
As described in
https://github.com/dwp-forge/columns/issues/5#issuecomment-638467603
sometime the Lexer constants have not been (auto)loaded when a syntax plugin
is invoked (I'm not sure why).

In general PSR2 discourages a mix of main code and function/class setup
with the call to define() being considered main code.

This patch moves these the define calls to a separate new file, solving
both of the above problems.

These are not all our defines. Instead I focused on the ones that are
ENUM-like.

In the future we should think about what defines can be replaced by
class constants and what other define() calls should be moved.
2020-06-04 08:22:16 +02:00
Andreas Gohr 322ad0741d some minor improvements for the writability checks
* handle is_writable for non-existing pages correctly
* Success and Fail are now color coded correctly
2020-06-02 11:42:41 +02:00
Andreas Gohr 556e996e8e fixed message classes
In #3069 the internal structure of messages was accidentally changed to
be numeric. This reintroduces the proper string constants.

I thought about keeping the integers and do the mapping in
html_msgarea() but some plugins rely on inspecting the global $MSG so I
don't want to change it.
2020-06-02 11:33:13 +02:00
Phy 0e20480f3e
Trigger event for msg()
Triggers INFOUTIL_MSG_SHOW.
2020-05-03 23:42:44 -04:00
Andreas Gohr b47790f975 Merge branch 'utf8refactor' into psr2
* utf8refactor:
  replaced deprecated utf8 functions
  formatting cleanup
  mark old utf8 functions deprecated
  Some cleanup for the UTF-8 stuff
  Moved all utf8 methods to their own namespaced classes
  Create separate table files for UTF-8 handling
2019-07-14 21:11:04 +02:00
Andreas Gohr 2b9c4a056d Merge branch 'master' into psr2
* master: (34 commits)
  fix color for noninstalled extensions
  show disabled extensions in gray
  warn about inaccessible repo api
  bugfix: access check was never cached
  First go on a CLI component for the extension manager
  use strict type comparison
  translation update
  translation update
  fix #dokuwiki__sitetools current item not in highlight due to Greebo change
  authplain: Add tests for group retrieval
  authplain: Add a simple method for retrieving user groups
  translation update
  Negative string offsets are allowed in PHP 7.1+ only
  improve memory check output
  fix and test php_to_byte() related to #2756 #2556
  translation update
  translation update
  translation update
  translation update
  translation update
  ...
2019-07-14 20:50:16 +02:00
Andreas Gohr 8cbc5ee84f replaced deprecated utf8 functions
For now this uses full qualified namespaces, sensible imports may come
later.
2019-06-10 16:12:59 +02:00
Andreas Gohr eb2e46cad9 use strict type comparison 2019-05-19 10:33:19 +02:00
Andreas Gohr c6e971dde7 improve memory check output
Makes use of the adjusted php_to_bytes() method which correctly returns
-1 for unlimited RAM and uses human readable sizes for output.
2019-04-24 14:21:36 +02:00
Andreas Gohr e1d9dcc8b4 First go at moving the plugin classes into their own namespace 2019-04-20 21:33:23 +02:00
Michael Große 5a8d6e48ea
Rename HTTPClient namespace to HTTP
This should make namespace a bit more flexible in scope and allow us to
move more functionality there later.
2019-03-26 22:05:09 +01:00
Michael Große 198564ab36
Refactor HTTPClient into different files 2019-03-17 13:36:40 +01:00
Andreas Gohr d8b492882d
Merge pull request #2689 from splitbrain/refactorCachePSR2
Refactor cache.php to better conform with PSR 2
2019-02-27 19:32:55 +01:00
Michael Große 0c5eb5e2d5
Refactor deprecation logging into its own class
This gives us the flexibility to handle both deprecated properties and
methods/functions properly.
2019-02-25 22:13:38 +01:00
Michael Große b4b0b31be1
Use deprecation helper
Instead of writing our own magic getters and setters for all variables
that used to be public, this adds a trait that does that in a generic
way.
This trait was copied from MediaWiki and adjusted to DokuWiki.
The original author seems to be @tgr Tisza Gergő

The downside of this trait is that the properties keep their
(potentially undesired) name. While that could be fixed within the
helper, that might add unnecessary complexity. The name can change when
support is dropped.
2019-02-22 23:26:36 +01:00
Michael Große 923e149a1f
Merge branch 'master' into psr2 2019-02-15 01:05:01 +01:00
peterfromearth 8f8499fae3 add logic if the server uses unlimited memory, memory_limit = -1 2018-10-26 21:57:44 +02:00
Michael Große 56f47fdaf7
🐛 Add guard for getVersion fallback
This protects against the current commit being packed and not available
 as an object and against zlib not being available.

More information about commits being packed and thus not available can
be found here: https://git-scm.com/book/en/v2/Git-Internals-Packfiles
2018-09-09 16:13:28 +02:00
Michael Große be2e462d83
✏️ Fix typo in variable name 2018-07-05 15:48:18 +02:00
Michael Große f519f9dbd3
👌 Add fallback if we cannot use git on the shell
Under some circumstances, there may be no git or no shell access available. This gets the commit
date manually.
2018-07-05 15:46:27 +02:00
Michael Große 067b4fb970
🐛 make getVersion show the commit date, not checkout date
Currently, getVersion() shows the date when the HEAD of the local git
repository was last changed, not the date of the current commit. This
commit fixes that behavior.
2018-07-05 11:20:35 +02:00
Andreas Gohr 9ddafced33 Merge branch 'master' into psr2
* master:
  🐛 (Draft) Fix exception when actually viewing a draft of a page
  💡(Draft): Add doc block for constructor
   Add unittest for deleteUsers remote API call
  fix remote API call dokuwiki.deleteUsers
  translation update
  🏗 Use json for the response to dw_locktimer
  (dw_locktimer) plugins may reuse to add fields and callbacks
  💄 (editor) draft status is semantically not part of the toolbar
  🏗 Create new Draft class and move draft handling there
  translation update
  correctly avoid notice in init.
  avoid creating expensive stacktrace in dbg_deprecated()
  add method to EventHandler to check if an event is actually handled
  introduce INFO_DEPRECATION_LOG event
2018-06-15 10:34:40 +02:00
Andreas Gohr 8533108670 avoid creating expensive stacktrace in dbg_deprecated()
now the method is aborting early again unless the data is actually used
2018-06-01 14:02:54 +02:00
Andreas Gohr 4445501665 introduce INFO_DEPRECATION_LOG event
This adds an event to dbg_deprecated(). This allows plugins to handle
deprecation warnings. One example would be @cosmocode/dokuwiki-plugin-sentry

One thing I don't like, but don't know how to avaoid is that this
function used to abort super early when $conf['allowdebug'] wasn't set.

However for the sentry plugin you probably would want logs, but still do
not show any debugging to end users (which allow debug would do).

So now the backtrace is always built, the event triggered and then
everything is sent to dbglog() which may simply throw everything away.

Suggestions on how to improve this welcome.
2018-06-01 11:54:18 +02:00
Andreas Gohr 64159a61e9 line lengths shortened
This makes sure all files use line lenghts shorter than 120 characters.

This is a quick fix. It might not always be the nicest change.
2018-04-27 19:07:43 +02:00
Andreas Gohr b4f2363aa1 remove DOKU_INC checks
There is no need for this check, since these files should not have any
main code that is executed on direct call.

Fixes PSR1.Files.SideEffects.FoundWithSymbols
2018-04-27 14:32:42 +02:00
Phy 6c5e3c5eb8 Update check supports HTTPS
If SSL is not supported, a HTTP request will be made. In the log the request type will be indicated, but on the frontend no additional message would be shown (I think it's better to notify admins about non-SSL situations, but currently when this fetch encounter error, no error message will be shown, so it's better not to add any warning).
2017-08-27 17:05:54 +08:00
Takamura f50a239b3b I supplemented the existing comments on the methods in which there was not enough information to the standard phpDoc. 2017-03-31 09:33:33 +02:00
Andreas Gohr 3476bb81a3 increase minimum version requirement to PHP 5.6 2017-03-31 09:29:40 +02:00
Andreas Gohr d6c7b502a6 Check the server has a sensible time
DokuWiki assumes that the server's time is correct. Especially page
revisions and cache handling depend on correct time. If that's not the
case it can lead to problems later (as mentioned in #1644).

This patch adds a very simple time check using the Date response header
from the DokuWiki server to our do=check mechanism.
2016-08-09 21:06:02 +02:00
Andreas Gohr 79e7937762 Remove error supression for file_exists()
In an older version of PHP a file_exists() call would issue a warning
when the file did not exist. This was fixed in later PHP releases. Since
we require PHP 5.3 now, there's no need to supress any error here
anymore. This might even give a minor performance boost.
2015-01-07 10:47:45 +01:00
Gerrit Uitslag 8702de7f7e Merge remote-tracking branch 'origin/master' into scrutinizerissues
Conflicts:
	inc/media.php
	inc/plugin.php
	inc/template.php
	lib/plugins/authplain/_test/escaping.test.php
	lib/plugins/syntax.php
2014-12-09 17:26:28 +01:00
Andreas Gohr 001d05eda1 new PHP minimum requirement is now 5.3.3
that's the version in Debian old stable
2014-10-14 21:33:23 +02:00
Andreas Gohr 37b21a1b15 use its own cache file per versions
this ensures there will be never, ever an outdated update message shown
after upgrade.
2014-10-14 19:55:45 +02:00
Angus Gratton 86c04d87ee Fix for update messages never completely going away
The existing logic for messages.txt requires some valid update
response (ending in %) to the messages update check before it clears
the current messages.

However update.dokuwiki.org appears to return an empty string response
if everything is up to date. (ie http://update.dokuwiki.org/check/46.1 )

As a result if there are update messages in messages.txt they don't
automatically go away after updating to the current version. The only
time they change is when a newer release comes out. The upgrade plugin
has logic in it to force a re-download of messages.txt, but currently
this just re-downloads the old update messages.

This change explicitly allows for "" as a valid "no messages"
indicator (distinct from false, which is the HTTP error indicator.)
2014-10-11 12:26:55 +11:00
Gerrit Uitslag 59bc3b48fd more scrutinizer issue improvements 2014-09-29 21:45:27 +02:00
Andreas Gohr 8f1efc437b sanity check update message
This should avoid problems when a WiFi login redirect intercepts the
update check.
See https://forum.dokuwiki.org/post/45076
2014-08-15 11:50:40 +02:00
Andreas Gohr 60bf39dd81 Merge pull request #693 from splitbrain/logdeprecated
log deprecated function calls FS#2399
2014-05-18 20:12:53 +02:00
Andreas Gohr 6164d9001d doc block updates 2014-05-10 15:54:18 +02:00
Andreas Gohr 1419a485e3 log deprecated function calls FS#2399
This introduces a new dbg_deprecated() function which allows for easy
marking of deprecated functions. Each call is logged to the debuglog
when debuggin is enabled.
2014-05-10 15:49:53 +02:00
Christopher Smith 585bf44e2b amend $_SERVER to $INPUT->server 2014-03-06 19:55:56 +00:00
Andreas Gohr 08d1a8dfa0 show PHP version only to admins and managers FS#2655 2014-02-15 12:59:32 +01:00
Matt Perry 2f7a0e94ca Fix CodeSniffer whitespace violoations
Removed extraneous whitespace to eliminate errors reported by the
Squiz.WhiteSpace.SuperfluousWhitespace sniff.
2013-09-10 22:17:43 -07:00