Skip to content

Conversation

@tryweb
Copy link

@tryweb tryweb commented Jun 26, 2025

  • Update DokuHTTPClient to use new namespace \dokuwiki\HTTP\DokuHTTPClient
  • Replace deprecated ptln() function calls with echo statements
  • Fix undefined variable $ID by adding global declaration
  • Initialize $geo_dir_name variable to prevent undefined variable error
  • Correct syntax errors including malformed string concatenations
  • Fix JavaScript function calls with proper quote escaping
  • Resolve HTML tag errors (</br> to <br />)
  • Ensure all echo statements have proper semicolon termination

This update ensures the quickstats plugin works correctly with the
latest DokuWiki version and eliminates all deprecation warnings,
parse errors, and undefined variable notices.

Files modified:

  • admin.php: Replace ptln(), fix syntax and undefined variables
  • scripts/get_geocity2.php: Update HTTPClient namespace, fix variables
  • scripts/get_geocity.php: Update HTTPClient namespace
  • GEOIP/get_geocity2.php: Update HTTPClient namespace

Fixes: GeoLite2-City database download functionality

tryweb added 4 commits June 25, 2025 12:50
Resolves "require_once() is deprecated" warnings observed in PHP logs for the DokuWiki quickstats plugin.

The following explicit `require_once` statements for DokuWiki's core plugin classes have been removed from their respective files, as they are now correctly handled by DokuWiki's autoloader:

- `action.php`: Removed `require_once(DOKU_PLUGIN.'action.php');`
- `admin.php`: Removed `require_once(DOKU_PLUGIN.'admin.php');`
- `syntax.php`: Removed `require_once(DOKU_PLUGIN.'syntax.php');`

This refactoring improves code modernism, aligns with contemporary PHP practices, and eliminates unnecessary warnings in the DokuWiki environment.
…uire_once calls

This commit addresses a critical "Undefined array key" E_WARNING observed in `action.php` at line 451, which occurred when accessing `$this->pages['page'][$ID]`. The issue was due to `$this->pages` or its sub-arrays not always being fully initialized with expected keys, especially on first page visits or with new/empty statistics files.

To fix this, the `add_data` method in `action.php` has been updated to:
- Ensure that `$this->pages['page']`, `$this->pages['site_total']`, and `$this->pages['date']` are explicitly checked and initialized as arrays or zero before any access or increment operations.
- Ensure `$this->ips['uniq']` is initialized if not set.

These changes enhance the plugin's robustness, improve compatibility with modern PHP versions, and eliminate unnecessary warnings in the DokuWiki logs.
@tryweb tryweb changed the title Refactor: Address deprecated require_once calls in quickstats plugin & Use new DokuHTTPClient method Fix compatibility issues for DokuWiki 2025-05-14a "Librarian" Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant