Robert Vogel has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/374112 )
Change subject: BSFoundation: Added more base classes for MW hooks ...................................................................... BSFoundation: Added more base classes for MW hooks * ArticleDeleteComplete, FileDeleteComplete, UploadComplete Change-Id: I2ef8f96c75cf09cec856a27904a49c801d071aa7 --- A src/Hook/ArticleDeleteComplete.php A src/Hook/FileDeleteComplete.php A src/Hook/UploadComplete.php 3 files changed, 280 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation refs/changes/12/374112/1 diff --git a/src/Hook/ArticleDeleteComplete.php b/src/Hook/ArticleDeleteComplete.php new file mode 100644 index 0000000..3f0a132 --- /dev/null +++ b/src/Hook/ArticleDeleteComplete.php @@ -0,0 +1,115 @@ +<?php +/** + * Hook handler base class for MediaWiki hook ArticleDeleteComplete + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This file is part of BlueSpice MediaWiki + * For further information visit http://bluespice.com + * + * @author Patric Wirth <wi...@hallowelt.com> + * @package BlueSpiceFoundation + * @copyright Copyright (C) 2017 Hallo Welt! GmbH, All rights reserved. + * @license http://www.gnu.org/copyleft/gpl.html GNU Public License v2 or later + * @filesource + */ +namespace BlueSpice\Hook; +use BlueSpice\Hook; + +abstract class ArticleDeleteComplete extends Hook { + + /** + * + * @var \WikiPage + */ + protected $wikipage = null; + + /** + * + * @var \User + */ + protected $user = null; + + /** + * + * @var string + */ + protected $reason = null; + + /** + * + * @var integer + */ + protected $id = null; + + /** + * + * @var \Content + */ + protected $content = null; + + /** + * + * @var \LogEntry + */ + protected $logEntry = false; + + /** + * + * @param \WikiPage $wikipage + * @param \User $user + * @param string $reason + * @param integer $id + * @param \Content $content + * @param \LogEntry $logEntry + * @return boolean + */ + public static function callback( &$wikipage, &$user, $reason, $id, $content, $logEntry ) { + $className = static::class; + $hookHandler = new $className( + null, + null, + $wikipage, + $user, + $reason, + $id, + $content, + $logEntry + ); + return $hookHandler->process(); + } + + /** + * + * @param \IContextSource $context + * @param \Context $config + * @param \WikiPage $wikipage + * @param \User $user + * @param string $reason + * @param integer $id + * @param \Content $content + * @param \LogEntry $logEntry + */ + public function __construct( $context, $config, &$wikipage, &$user, $reason, $id, $content, $logEntry ) { + parent::__construct( $context, $config ); + + $this->wikipage = &$wikipage; + $this->user = &$user; + $this->reason = $reason; + $this->id = $id; + $this->content = $content; + $this->logEntry = $logEntry; + } +} \ No newline at end of file diff --git a/src/Hook/FileDeleteComplete.php b/src/Hook/FileDeleteComplete.php new file mode 100644 index 0000000..a929e18 --- /dev/null +++ b/src/Hook/FileDeleteComplete.php @@ -0,0 +1,100 @@ +<?php +/** + * Hook handler base class for MediaWiki hook FileDeleteComplete + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This file is part of BlueSpice MediaWiki + * For further information visit http://bluespice.com + * + * @author Patric Wirth <wi...@hallowelt.com> + * @package BlueSpiceFoundation + * @copyright Copyright (C) 2017 Hallo Welt! GmbH, All rights reserved. + * @license http://www.gnu.org/copyleft/gpl.html GNU Public License v2 or later + * @filesource + */ +namespace BlueSpice\Hook; +use BlueSpice\Hook; + +abstract class FileDeleteComplete extends Hook { + /** + * + * @var \File + */ + protected $file = null; + /** + * Archive name + * @var string + */ + protected $oldimage = null; + /** + * + * @var \WikiPage + */ + protected $wikipage = null; + /** + * + * @var \User + */ + protected $user = null; + /** + * + * @var string + */ + protected $reason = null; + + /** + * + * @param \File $file + * @param string $oldimage + * @param \WikiPage $wikipage + * @param \User $user + * @param string $reason + * @return boolean + */ + public static function callback( $file, $oldimage, $wikipage, $user, $reason ) { + $className = static::class; + $hookHandler = new $className( + null, + null, + $file, + $oldimage, + $wikipage, + $user, + $reason + ); + return $hookHandler->process(); + } + + /** + * + * @param \IContextSource $context + * @param \Context $config + * @param \File $file + * @param string $oldimage + * @param \WikiPage $wikipage + * @param \User $user + * @param string $reason + */ + public function __construct( $context, $config, $file, $oldimage, $wikipage, $user, $reason ) { + parent::__construct( $context, $config ); + + $this->file = $file; + $this->oldimage = $oldimage; + $this->wikipage = $wikipage; + $this->user = $user; + $this->reason = $reason; + } +} \ No newline at end of file diff --git a/src/Hook/UploadComplete.php b/src/Hook/UploadComplete.php new file mode 100644 index 0000000..acccb1d --- /dev/null +++ b/src/Hook/UploadComplete.php @@ -0,0 +1,65 @@ +<?php +/** + * Hook handler base class for MediaWiki hook UploadComplete + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This file is part of BlueSpice MediaWiki + * For further information visit http://bluespice.com + * + * @author Patric Wirth <wi...@hallowelt.com> + * @package BlueSpiceFoundation + * @copyright Copyright (C) 2017 Hallo Welt! GmbH, All rights reserved. + * @license http://www.gnu.org/copyleft/gpl.html GNU Public License v2 or later + * @filesource + */ +namespace BlueSpice\Hook; +use BlueSpice\Hook; + +abstract class UploadComplete extends Hook { + + /** + * + * @var \UploadBase + */ + protected $upload = null; + + /** + * + * @param \UploadBase $upload + * @return boolean + */ + public static function callback( &$upload ) { + $className = static::class; + $hookHandler = new $className( + null, + null, + $upload + ); + return $hookHandler->process(); + } + + /** + * + * @param \IContextSource $context + * @param \Context $config + * @param \UploadBase $upload + */ + public function __construct( $context, $config, &$upload ) { + parent::__construct( $context, $config ); + + $this->upload = &$upload; + } +} \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/374112 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2ef8f96c75cf09cec856a27904a49c801d071aa7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation Gerrit-Branch: REL1_27 Gerrit-Owner: Robert Vogel <vo...@hallowelt.biz> Gerrit-Reviewer: Pwirth <wi...@hallowelt.biz> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits