Skip to content

Added the ability to rebuild the intire database from the admin area #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion action.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,20 @@ function register(&$controller) {
$controller->register_hook('HTML_EDIT_FORMSELECTION', 'BEFORE', $this, '_editform');
$controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, '_handle_edit_post');
$controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, '_handle_ajax');
}
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, '_handle_refresh_data');
}

function _handle_refresh_data(&$event, $param) {

if ($_REQUEST['cmd'] === null) return;

// verify valid values
switch (key($_REQUEST['cmd'])) {
case 'refresh_data' :
$this->dthlp->rebuild_data();
break;
}
}

/**
* Handles the page write event and removes the database info
Expand Down
41 changes: 41 additions & 0 deletions admin/rebuild.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* DokuWiki Plugin git (Admin Component)
*/

// must be run within Dokuwiki
if (!defined('DOKU_INC')) die();
if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');

require_once(DOKU_PLUGIN.'admin.php');

class admin_plugin_data_rebuild extends DokuWiki_Admin_Plugin {

function getInfo() {
return confToHash(dirname(__FILE__).'plugin.info.txt');
}

function getMenuSort() { return 1; }
function forAdminOnly() { return true; }

function getMenuText($language) {
return $this->getLang('menu_rebuild');
}

function handle() {

}

function html() {

echo '<h2>Short:</h2><p>This page allows you to refreshes all Data-Plugin data. You can refresh as often as you like!</p>';

echo '<form method="post">';
echo ' <input type="submit" name="cmd[refresh_data]" value="Refresh Data plugin data" />';
echo '</form><br/>';

}

}

// vim:ts=4:sw=4:et:
Loading