xref: /plugin/gitbacked/action/editcommit.php (revision e8224fc2adab60c230d2e234fb6752e82d78cfc3)
1fa53f2a3SWolfgang Gassler<?php
2fa53f2a3SWolfgang Gassler/**
3fa53f2a3SWolfgang Gassler * DokuWiki Plugin gitbacked (Action Component)
4fa53f2a3SWolfgang Gassler *
5fa53f2a3SWolfgang Gassler * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6fa53f2a3SWolfgang Gassler * @author  Wolfgang Gassler <wolfgang@gassler.org>
7fa53f2a3SWolfgang Gassler */
8fa53f2a3SWolfgang Gassler
9fa53f2a3SWolfgang Gassler// must be run within Dokuwiki
10fa53f2a3SWolfgang Gasslerif (!defined('DOKU_INC')) die();
11fa53f2a3SWolfgang Gassler
12fa53f2a3SWolfgang Gasslerif (!defined('DOKU_LF')) define('DOKU_LF', "\n");
13fa53f2a3SWolfgang Gasslerif (!defined('DOKU_TAB')) define('DOKU_TAB', "\t");
14fa53f2a3SWolfgang Gasslerif (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
15fa53f2a3SWolfgang Gassler
16fa53f2a3SWolfgang Gasslerrequire_once DOKU_PLUGIN.'action.php';
1700ce3f12SDanny Linrequire_once dirname(__FILE__).'/../lib/Git.php';
18fa53f2a3SWolfgang Gassler
19fa53f2a3SWolfgang Gasslerclass action_plugin_gitbacked_editcommit extends DokuWiki_Action_Plugin {
20fa53f2a3SWolfgang Gassler
2100ce3f12SDanny Lin    function __construct() {
2200ce3f12SDanny Lin        global $conf;
2300ce3f12SDanny Lin        $this->temp_dir = $conf['tmpdir'].'/gitbacked';
2400ce3f12SDanny Lin        io_mkdir_p($this->temp_dir);
2500ce3f12SDanny Lin    }
2600ce3f12SDanny Lin
27a6cdc68cSMichael Sorg    public function register(Doku_Event_Handler $controller) {
28fa53f2a3SWolfgang Gassler
29fa53f2a3SWolfgang Gassler        $controller->register_hook('IO_WIKIPAGE_WRITE', 'AFTER', $this, 'handle_io_wikipage_write');
30442c3981SWolfgang Gassler        $controller->register_hook('MEDIA_UPLOAD_FINISH', 'AFTER', $this, 'handle_media_upload');
31442c3981SWolfgang Gassler        $controller->register_hook('MEDIA_DELETE_FILE', 'AFTER', $this, 'handle_media_deletion');
32b92b117aSWolfgang Gassler        $controller->register_hook('DOKUWIKI_DONE', 'AFTER', $this, 'handle_periodic_pull');
33442c3981SWolfgang Gassler    }
34442c3981SWolfgang Gassler
35b92b117aSWolfgang Gassler    private function initRepo() {
36442c3981SWolfgang Gassler        //get path to the repo root (by default DokuWiki's savedir)
3738f8ac72SWolfgang Gassler        if(defined('DOKU_FARM')) {
3838f8ac72SWolfgang Gassler            $repoPath = $this->getConf('repoPath');
3938f8ac72SWolfgang Gassler        } else {
40442c3981SWolfgang Gassler            $repoPath = DOKU_INC.$this->getConf('repoPath');
4138f8ac72SWolfgang Gassler        }
42635161d0SCarsten Teibes        //set the path to the git binary
43635161d0SCarsten Teibes        $gitPath = trim($this->getConf('gitPath'));
44635161d0SCarsten Teibes        if ($gitPath !== '') {
45635161d0SCarsten Teibes            Git::set_bin($gitPath);
46635161d0SCarsten Teibes        }
47442c3981SWolfgang Gassler        //init the repo and create a new one if it is not present
484eba9b44SDanny Lin        io_mkdir_p($repoPath);
49*e8224fc2SMarkus Hoffrogge        $repo = new GitRepo($repoPath, $this, true, true);
504eba9b44SDanny Lin        //set git working directory (by default DokuWiki's savedir)
514eba9b44SDanny Lin        $repoWorkDir = DOKU_INC.$this->getConf('repoWorkDir');
52985a1bc7SCarsten Teibes        Git::set_bin(Git::get_bin().' --work-tree '.escapeshellarg($repoWorkDir));
53442c3981SWolfgang Gassler
540d7cb616SBirkir A. Barkarson        $params = str_replace(
550d7cb616SBirkir A. Barkarson            array('%mail%','%user%'),
560d7cb616SBirkir A. Barkarson            array($this->getAuthorMail(),$this->getAuthor()),
570d7cb616SBirkir A. Barkarson            $this->getConf('addParams'));
58442c3981SWolfgang Gassler        if ($params) {
59985a1bc7SCarsten Teibes            Git::set_bin(Git::get_bin().' '.$params);
60442c3981SWolfgang Gassler        }
61b92b117aSWolfgang Gassler        return $repo;
62b92b117aSWolfgang Gassler    }
63b92b117aSWolfgang Gassler
6466f21a70SWolfgang Gassler	private function isIgnored($filePath) {
6566f21a70SWolfgang Gassler		$ignore = false;
6666f21a70SWolfgang Gassler		$ignorePaths = trim($this->getConf('ignorePaths'));
6766f21a70SWolfgang Gassler		if ($ignorePaths !== '') {
6866f21a70SWolfgang Gassler			$paths = explode(',',$ignorePaths);
6966f21a70SWolfgang Gassler			foreach($paths as $path) {
7066f21a70SWolfgang Gassler				if (strstr($filePath,$path)) {
7166f21a70SWolfgang Gassler					$ignore = true;
7266f21a70SWolfgang Gassler				}
7366f21a70SWolfgang Gassler			}
7466f21a70SWolfgang Gassler		}
7566f21a70SWolfgang Gassler		return $ignore;
7666f21a70SWolfgang Gassler	}
7766f21a70SWolfgang Gassler
78b92b117aSWolfgang Gassler    private function commitFile($filePath,$message) {
7966f21a70SWolfgang Gassler		if (!$this->isIgnored($filePath)) {
80*e8224fc2SMarkus Hoffrogge			try {
81b92b117aSWolfgang Gassler				$repo = $this->initRepo();
82442c3981SWolfgang Gassler
83442c3981SWolfgang Gassler				//add the changed file and set the commit message
84442c3981SWolfgang Gassler				$repo->add($filePath);
85442c3981SWolfgang Gassler				$repo->commit($message);
86442c3981SWolfgang Gassler
87442c3981SWolfgang Gassler				//if the push after Commit option is set we push the active branch to origin
88442c3981SWolfgang Gassler				if ($this->getConf('pushAfterCommit')) {
89442c3981SWolfgang Gassler					$repo->push('origin',$repo->active_branch());
90442c3981SWolfgang Gassler				}
91*e8224fc2SMarkus Hoffrogge			} catch (Exception $e) {
92*e8224fc2SMarkus Hoffrogge				if (!$this->isNotifyByEmailOnGitCommandError()) {
93*e8224fc2SMarkus Hoffrogge					throw new Exception('Git committing or pushing failed: '.$e->getMessage(), 1, $e);
9466f21a70SWolfgang Gassler				}
95*e8224fc2SMarkus Hoffrogge				return;
96*e8224fc2SMarkus Hoffrogge			}
97*e8224fc2SMarkus Hoffrogge		}
98442c3981SWolfgang Gassler    }
99442c3981SWolfgang Gassler
100442c3981SWolfgang Gassler    private function getAuthor() {
101442c3981SWolfgang Gassler        return $GLOBALS['USERINFO']['name'];
102442c3981SWolfgang Gassler    }
103442c3981SWolfgang Gassler
1040d7cb616SBirkir A. Barkarson    private function getAuthorMail() {
1050d7cb616SBirkir A. Barkarson        return $GLOBALS['USERINFO']['mail'];
1060d7cb616SBirkir A. Barkarson    }
1070d7cb616SBirkir A. Barkarson
1082377428fSDanny Lin    public function handle_periodic_pull(Doku_Event &$event, $param) {
1092377428fSDanny Lin        if ($this->getConf('periodicPull')) {
1102377428fSDanny Lin            $lastPullFile = $this->temp_dir.'/lastpull.txt';
1112377428fSDanny Lin            //check if the lastPullFile exists
1122377428fSDanny Lin            if (is_file($lastPullFile)) {
1132377428fSDanny Lin                $lastPull = unserialize(file_get_contents($lastPullFile));
1142377428fSDanny Lin            } else {
1152377428fSDanny Lin                $lastPull = 0;
1162377428fSDanny Lin            }
1172377428fSDanny Lin            //calculate time between pulls in seconds
1182377428fSDanny Lin            $timeToWait = $this->getConf('periodicMinutes')*60;
1192377428fSDanny Lin            $now = time();
1202377428fSDanny Lin
1212377428fSDanny Lin            //if it is time to run a pull request
1222377428fSDanny Lin            if ($lastPull+$timeToWait < $now) {
123*e8224fc2SMarkus Hoffrogge				try {
1242377428fSDanny Lin                	$repo = $this->initRepo();
1252377428fSDanny Lin
1262377428fSDanny Lin                	//execute the pull request
1272377428fSDanny Lin                	$repo->pull('origin',$repo->active_branch());
128*e8224fc2SMarkus Hoffrogge				} catch (Exception $e) {
129*e8224fc2SMarkus Hoffrogge					if (!$this->isNotifyByEmailOnGitCommandError()) {
130*e8224fc2SMarkus Hoffrogge						throw new Exception('Git command failed to perform periodic pull: '.$e->getMessage(), 2, $e);
131*e8224fc2SMarkus Hoffrogge					}
132*e8224fc2SMarkus Hoffrogge					return;
133*e8224fc2SMarkus Hoffrogge				}
1342377428fSDanny Lin
1352377428fSDanny Lin                //save the current time to the file to track the last pull execution
1362377428fSDanny Lin                file_put_contents($lastPullFile,serialize(time()));
1372377428fSDanny Lin            }
1382377428fSDanny Lin        }
1392377428fSDanny Lin    }
1402377428fSDanny Lin
141442c3981SWolfgang Gassler    public function handle_media_deletion(Doku_Event &$event, $param) {
142442c3981SWolfgang Gassler        $mediaPath = $event->data['path'];
143442c3981SWolfgang Gassler        $mediaName = $event->data['name'];
144442c3981SWolfgang Gassler
145442c3981SWolfgang Gassler        $message = str_replace(
146442c3981SWolfgang Gassler            array('%media%','%user%'),
147442c3981SWolfgang Gassler            array($mediaName,$this->getAuthor()),
148442c3981SWolfgang Gassler            $this->getConf('commitMediaMsgDel')
149442c3981SWolfgang Gassler        );
150442c3981SWolfgang Gassler
151442c3981SWolfgang Gassler        $this->commitFile($mediaPath,$message);
152442c3981SWolfgang Gassler
153442c3981SWolfgang Gassler    }
154442c3981SWolfgang Gassler
155442c3981SWolfgang Gassler    public function handle_media_upload(Doku_Event &$event, $param) {
156442c3981SWolfgang Gassler
157442c3981SWolfgang Gassler        $mediaPath = $event->data[1];
158442c3981SWolfgang Gassler        $mediaName = $event->data[2];
159442c3981SWolfgang Gassler
160442c3981SWolfgang Gassler        $message = str_replace(
161442c3981SWolfgang Gassler            array('%media%','%user%'),
162442c3981SWolfgang Gassler            array($mediaName,$this->getAuthor()),
163442c3981SWolfgang Gassler            $this->getConf('commitMediaMsg')
164442c3981SWolfgang Gassler        );
165442c3981SWolfgang Gassler
166442c3981SWolfgang Gassler        $this->commitFile($mediaPath,$message);
167fa53f2a3SWolfgang Gassler
168fa53f2a3SWolfgang Gassler    }
169fa53f2a3SWolfgang Gassler
170fa53f2a3SWolfgang Gassler    public function handle_io_wikipage_write(Doku_Event &$event, $param) {
171fa53f2a3SWolfgang Gassler
172fa53f2a3SWolfgang Gassler        $rev = $event->data[3];
173fa53f2a3SWolfgang Gassler
174fa53f2a3SWolfgang Gassler        /* On update to an existing page this event is called twice,
175fa53f2a3SWolfgang Gassler         * once for the transfer of the old version to the attic (rev will have a value)
176fa53f2a3SWolfgang Gassler         * and once to write the new version of the page into the wiki (rev is false)
177fa53f2a3SWolfgang Gassler         */
178fa53f2a3SWolfgang Gassler        if (!$rev) {
179fa53f2a3SWolfgang Gassler
180fa53f2a3SWolfgang Gassler            $pagePath = $event->data[0][0];
181fa53f2a3SWolfgang Gassler            $pageName = $event->data[2];
182442c3981SWolfgang Gassler            $pageContent = $event->data[0][1];
183fa53f2a3SWolfgang Gassler
1847af27dc9SWolfgang Gassler            // get the summary directly from the form input
185e7471cfaSDanny Lin            // as the metadata hasn't updated yet
1867af27dc9SWolfgang Gassler            $editSummary = $GLOBALS['INPUT']->str('summary');
187442c3981SWolfgang Gassler
188442c3981SWolfgang Gassler            // empty content indicates a page deletion
189442c3981SWolfgang Gassler            if ($pageContent == '') {
190442c3981SWolfgang Gassler                // get the commit text for deletions
191d4e1c54bSWolfgang Gassler                $msgTemplate = $this->getConf('commitPageMsgDel');
192442c3981SWolfgang Gassler
193442c3981SWolfgang Gassler                // bad hack as DokuWiki deletes the file after this event
194442c3981SWolfgang Gassler                // thus, let's delete the file by ourselves, so git can recognize the deletion
195442c3981SWolfgang Gassler                // DokuWiki uses @unlink as well, so no error should be thrown if we delete it twice
196442c3981SWolfgang Gassler                @unlink($pagePath);
197442c3981SWolfgang Gassler
198442c3981SWolfgang Gassler            } else {
199442c3981SWolfgang Gassler                //get the commit text for edits
200d4e1c54bSWolfgang Gassler                $msgTemplate = $this->getConf('commitPageMsg');
201442c3981SWolfgang Gassler            }
202442c3981SWolfgang Gassler
203fa53f2a3SWolfgang Gassler            $message = str_replace(
204fa53f2a3SWolfgang Gassler                array('%page%','%summary%','%user%'),
205442c3981SWolfgang Gassler                array($pageName,$editSummary,$this->getAuthor()),
206442c3981SWolfgang Gassler                $msgTemplate
207fa53f2a3SWolfgang Gassler            );
208fa53f2a3SWolfgang Gassler
209442c3981SWolfgang Gassler            $this->commitFile($pagePath,$message);
210fa53f2a3SWolfgang Gassler
211fa53f2a3SWolfgang Gassler        }
212*e8224fc2SMarkus Hoffrogge    }
213fa53f2a3SWolfgang Gassler
214*e8224fc2SMarkus Hoffrogge	// ====== Error notification helpers ======
215*e8224fc2SMarkus Hoffrogge	/**
216*e8224fc2SMarkus Hoffrogge	 * Notifies error on create_new
217*e8224fc2SMarkus Hoffrogge	 *
218*e8224fc2SMarkus Hoffrogge	 * @access  public
219*e8224fc2SMarkus Hoffrogge	 * @param   string  repository path
220*e8224fc2SMarkus Hoffrogge	 * @param   string  reference path / remote reference
221*e8224fc2SMarkus Hoffrogge	 * @param   string  error message
222*e8224fc2SMarkus Hoffrogge	 * @return  bool
223*e8224fc2SMarkus Hoffrogge	 */
224*e8224fc2SMarkus Hoffrogge	public function notify_create_new_error($repo_path, $reference, $error_message) {
225*e8224fc2SMarkus Hoffrogge		$template_replacements = array(
226*e8224fc2SMarkus Hoffrogge			'GIT_REPO_PATH' => $repo_path,
227*e8224fc2SMarkus Hoffrogge			'GIT_REFERENCE' => (empty($reference) ? 'n/a' : $reference),
228*e8224fc2SMarkus Hoffrogge			'GIT_ERROR_MESSAGE' => $error_message
229*e8224fc2SMarkus Hoffrogge		);
230*e8224fc2SMarkus Hoffrogge		return $this->notifyByMail('mail_create_new_error_subject', 'mail_create_new_error', $template_replacements);
231*e8224fc2SMarkus Hoffrogge	}
232*e8224fc2SMarkus Hoffrogge
233*e8224fc2SMarkus Hoffrogge	/**
234*e8224fc2SMarkus Hoffrogge	 * Notifies error on setting repo path
235*e8224fc2SMarkus Hoffrogge	 *
236*e8224fc2SMarkus Hoffrogge	 * @access  public
237*e8224fc2SMarkus Hoffrogge	 * @param   string  repository path
238*e8224fc2SMarkus Hoffrogge	 * @param   string  error message
239*e8224fc2SMarkus Hoffrogge	 * @return  bool
240*e8224fc2SMarkus Hoffrogge	 */
241*e8224fc2SMarkus Hoffrogge	public function notify_repo_path_error($repo_path, $error_message) {
242*e8224fc2SMarkus Hoffrogge		$template_replacements = array(
243*e8224fc2SMarkus Hoffrogge			'GIT_REPO_PATH' => $repo_path,
244*e8224fc2SMarkus Hoffrogge			'GIT_ERROR_MESSAGE' => $error_message
245*e8224fc2SMarkus Hoffrogge		);
246*e8224fc2SMarkus Hoffrogge		return $this->notifyByMail('mail_repo_path_error_subject', 'mail_repo_path_error', $template_replacements);
247*e8224fc2SMarkus Hoffrogge	}
248*e8224fc2SMarkus Hoffrogge
249*e8224fc2SMarkus Hoffrogge	/**
250*e8224fc2SMarkus Hoffrogge	 * Notifies error on git command
251*e8224fc2SMarkus Hoffrogge	 *
252*e8224fc2SMarkus Hoffrogge	 * @access  public
253*e8224fc2SMarkus Hoffrogge	 * @param   string  repository path
254*e8224fc2SMarkus Hoffrogge	 * @param   string  current working dir
255*e8224fc2SMarkus Hoffrogge	 * @param   string  command line
256*e8224fc2SMarkus Hoffrogge	 * @param   int     exit code of command (status)
257*e8224fc2SMarkus Hoffrogge	 * @param   string  error message
258*e8224fc2SMarkus Hoffrogge	 * @return  bool
259*e8224fc2SMarkus Hoffrogge	 */
260*e8224fc2SMarkus Hoffrogge	public function notify_command_error($repo_path, $cwd, $command, $status, $error_message) {
261*e8224fc2SMarkus Hoffrogge		$template_replacements = array(
262*e8224fc2SMarkus Hoffrogge			'GIT_REPO_PATH' => $repo_path,
263*e8224fc2SMarkus Hoffrogge			'GIT_CWD' => $cwd,
264*e8224fc2SMarkus Hoffrogge			'GIT_COMMAND' => $command,
265*e8224fc2SMarkus Hoffrogge			'GIT_COMMAND_EXITCODE' => $status,
266*e8224fc2SMarkus Hoffrogge			'GIT_ERROR_MESSAGE' => $error_message
267*e8224fc2SMarkus Hoffrogge		);
268*e8224fc2SMarkus Hoffrogge		return $this->notifyByMail('mail_command_error_subject', 'mail_command_error', $template_replacements);
269*e8224fc2SMarkus Hoffrogge	}
270*e8224fc2SMarkus Hoffrogge
271*e8224fc2SMarkus Hoffrogge	/**
272*e8224fc2SMarkus Hoffrogge	 * Notifies success on git command
273*e8224fc2SMarkus Hoffrogge	 *
274*e8224fc2SMarkus Hoffrogge	 * @access  public
275*e8224fc2SMarkus Hoffrogge	 * @param   string  repository path
276*e8224fc2SMarkus Hoffrogge	 * @param   string  current working dir
277*e8224fc2SMarkus Hoffrogge	 * @param   string  command line
278*e8224fc2SMarkus Hoffrogge	 * @return  bool
279*e8224fc2SMarkus Hoffrogge	 */
280*e8224fc2SMarkus Hoffrogge	public function notify_command_success($repo_path, $cwd, $command) {
281*e8224fc2SMarkus Hoffrogge		if (!$this->getConf('notifyByMailOnSuccess')) {
282*e8224fc2SMarkus Hoffrogge			return false;
283*e8224fc2SMarkus Hoffrogge		}
284*e8224fc2SMarkus Hoffrogge		$template_replacements = array(
285*e8224fc2SMarkus Hoffrogge			'GIT_REPO_PATH' => $repo_path,
286*e8224fc2SMarkus Hoffrogge			'GIT_CWD' => $cwd,
287*e8224fc2SMarkus Hoffrogge			'GIT_COMMAND' => $command
288*e8224fc2SMarkus Hoffrogge		);
289*e8224fc2SMarkus Hoffrogge		return $this->notifyByMail('mail_command_success_subject', 'mail_command_success', $template_replacements);
290*e8224fc2SMarkus Hoffrogge	}
291*e8224fc2SMarkus Hoffrogge
292*e8224fc2SMarkus Hoffrogge	/**
293*e8224fc2SMarkus Hoffrogge	 * Send an eMail, if eMail address is configured
294*e8224fc2SMarkus Hoffrogge	 *
295*e8224fc2SMarkus Hoffrogge	 * @access  public
296*e8224fc2SMarkus Hoffrogge	 * @param   string  lang id for the subject
297*e8224fc2SMarkus Hoffrogge	 * @param   string  lang id for the template(.txt)
298*e8224fc2SMarkus Hoffrogge	 * @param   array   array of replacements
299*e8224fc2SMarkus Hoffrogge	 * @return  bool
300*e8224fc2SMarkus Hoffrogge	 */
301*e8224fc2SMarkus Hoffrogge	public function notifyByMail($subject_id, $template_id, $template_replacements) {
302*e8224fc2SMarkus Hoffrogge		$ret = false;
303*e8224fc2SMarkus Hoffrogge		dbglog("GitBacked - notifyByMail: [subject_id=".$subject_id.", template_id=".$template_id.", template_replacements=".$template_replacements."]");
304*e8224fc2SMarkus Hoffrogge		if (!$this->isNotifyByEmailOnGitCommandError()) {
305*e8224fc2SMarkus Hoffrogge			return $ret;
306*e8224fc2SMarkus Hoffrogge		}
307*e8224fc2SMarkus Hoffrogge		//$template_text = rawLocale($template_id); // this works for core artifacts only - not for plugins
308*e8224fc2SMarkus Hoffrogge		$template_filename = $this->localFN($template_id);
309*e8224fc2SMarkus Hoffrogge        $template_text = file_get_contents($template_filename);
310*e8224fc2SMarkus Hoffrogge		$template_html = $this->render_text($template_text);
311*e8224fc2SMarkus Hoffrogge
312*e8224fc2SMarkus Hoffrogge		$mailer = new \Mailer();
313*e8224fc2SMarkus Hoffrogge		$mailer->to($this->getEmailAddressOnErrorConfigured());
314*e8224fc2SMarkus Hoffrogge		dbglog("GitBacked - lang check['".$subject_id."']: ".$this->getLang($subject_id));
315*e8224fc2SMarkus Hoffrogge		dbglog("GitBacked - template text['".$template_id."']: ".$template_text);
316*e8224fc2SMarkus Hoffrogge		dbglog("GitBacked - template html['".$template_id."']: ".$template_html);
317*e8224fc2SMarkus Hoffrogge		$mailer->subject($this->getLang($subject_id));
318*e8224fc2SMarkus Hoffrogge		$mailer->setBody($template_text, $template_replacements, null, $template_html);
319*e8224fc2SMarkus Hoffrogge		$ret = $mailer->send();
320*e8224fc2SMarkus Hoffrogge
321*e8224fc2SMarkus Hoffrogge        return $ret;
322*e8224fc2SMarkus Hoffrogge	}
323*e8224fc2SMarkus Hoffrogge
324*e8224fc2SMarkus Hoffrogge	/**
325*e8224fc2SMarkus Hoffrogge	 * Check, if eMail is to be sent on a Git command error.
326*e8224fc2SMarkus Hoffrogge	 *
327*e8224fc2SMarkus Hoffrogge	 * @access  public
328*e8224fc2SMarkus Hoffrogge	 * @return  bool
329*e8224fc2SMarkus Hoffrogge	 */
330*e8224fc2SMarkus Hoffrogge	public function isNotifyByEmailOnGitCommandError() {
331*e8224fc2SMarkus Hoffrogge		$emailAddressOnError = $this->getEmailAddressOnErrorConfigured();
332*e8224fc2SMarkus Hoffrogge		return !empty($emailAddressOnError);
333*e8224fc2SMarkus Hoffrogge	}
334*e8224fc2SMarkus Hoffrogge
335*e8224fc2SMarkus Hoffrogge	/**
336*e8224fc2SMarkus Hoffrogge	 * Get the eMail address configured for notifications.
337*e8224fc2SMarkus Hoffrogge	 *
338*e8224fc2SMarkus Hoffrogge	 * @access  public
339*e8224fc2SMarkus Hoffrogge	 * @return  string
340*e8224fc2SMarkus Hoffrogge	 */
341*e8224fc2SMarkus Hoffrogge	public function getEmailAddressOnErrorConfigured() {
342*e8224fc2SMarkus Hoffrogge		$emailAddressOnError = trim($this->getConf('emailAddressOnError'));
343*e8224fc2SMarkus Hoffrogge		return $emailAddressOnError;
344fa53f2a3SWolfgang Gassler	}
345fa53f2a3SWolfgang Gassler
346fa53f2a3SWolfgang Gassler}
347fa53f2a3SWolfgang Gassler
348fa53f2a3SWolfgang Gassler// vim:ts=4:sw=4:et:
349