Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
anandr committed Sep 16, 2012
0 parents commit 29a7998
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
toucher Plugin for DokuWiki

touches config files

All documentation for this plugin can be found at
http://www.dokuwiki.org/plugin:toucher

If you install this plugin manually, make sure it is installed in
lib/plugins/toucher/ - if the folder is called different it
will not work!

Please refer to http://www.dokuwiki.org/plugins for additional info
on how to install plugins in DokuWiki.

----
Copyright (C) Andriy Nych <nych.andriy@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

See the COPYING file in your DokuWiki folder for details
52 changes: 52 additions & 0 deletions admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/**
* DokuWiki Plugin toucher (Admin Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andriy Nych <nych.andriy@gmail.com>
*/

// must be run within Dokuwiki
if (!defined('DOKU_INC')) die();

if (!defined('DOKU_LF')) define('DOKU_LF', "\n");
if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t");
if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');

require_once DOKU_PLUGIN.'admin.php';

class admin_plugin_toucher extends DokuWiki_Admin_Plugin {

public function getMenuSort() {
return 13;
}

public function forAdminOnly() {
return $this->getConf('admin_only');
}

function touchFiles() {
touch(DOKU_CONF."local.php"); // this is the core of this plugin
}

public function handle() {
global $INFO;

if ($this->getConf('admin_only')) {
if (!$INFO[isadmin]) {
msg('Plugin toucher failed: you must be admin to touch configuration',-1);
return false;
}
}
$this->touchFiles();
msg('Plugin toucher touched configuration files',1);
return true;
}

public function html() {
ptln('<h1>' . $this->getLang('menu') . '</h1>');
ptln('<p>Configuration files have been just touched.</p>');
}
}

// vim:ts=4:sw=4:et:
8 changes: 8 additions & 0 deletions conf/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
/**
* Default settings for the toucher plugin
*
* @author Andriy Nych <nych.andriy@gmail.com>
*/

$conf['admin_only'] = 1;
8 changes: 8 additions & 0 deletions conf/metadata.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
/**
* Options for the toucher plugin
*
* @author Andriy Nych <nych.andriy@gmail.com>
*/

$meta['admin_only'] = array('onoff');
11 changes: 11 additions & 0 deletions lang/en/lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
/**
* English language file for toucher plugin
*
* @author Andriy Nych <nych.andriy@gmail.com>
*/

$lang['menu'] = 'Touch configuration files';


//Setup VIM: ex: et ts=4 :
10 changes: 10 additions & 0 deletions lang/en/settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
/**
* english language file for toucher plugin
*
* @author Andriy Nych <nych.andriy@gmail.com>
*/

$lang['admin_only'] = 'Allow toucher plugin only for admins (superusers)';

//Setup VIM: ex: et ts=4 :
7 changes: 7 additions & 0 deletions plugin.info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
base toucher
author Andriy Nych
email nych.andriy@gmail.com
date 2012-09-16
name Toucher plugin
desc A plugin for touching configuration files without changing DokuWiki settings
url http://www.dokuwiki.org/plugin:toucher

0 comments on commit 29a7998

Please sign in to comment.