Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/398617 )
Change subject: Move maintenance script to own folder ...................................................................... Move maintenance script to own folder Added alias file under old name, because it could be run from cron. Change-Id: Ibd6ee1dcbd387d5a208896b9f0059ad0c03e9eba --- M .phpcs.xml M loadExitNodes.php A maintenance/loadExitNodes.php 3 files changed, 62 insertions(+), 53 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TorBlock refs/changes/17/398617/1 diff --git a/.phpcs.xml b/.phpcs.xml index bf67ffa..4b8c076 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -2,13 +2,15 @@ <ruleset> <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"> <exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" /> - <exclude name="MediaWiki.Files.ClassMatchesFilename.WrongCase" /> <exclude name="MediaWiki.Files.OneClassPerFile.MultipleFound" /> <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" /> <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamComment" /> <exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" /> <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" /> </rule> + <rule ref="MediaWiki.Files.ClassMatchesFilename.WrongCase"> + <exclude-pattern>*/maintenance/*</exclude-pattern> + </rule> <file>.</file> <arg name="extensions" value="php,php5,inc" /> <arg name="encoding" value="UTF-8" /> diff --git a/loadExitNodes.php b/loadExitNodes.php index 33ea603..9f88653 100644 --- a/loadExitNodes.php +++ b/loadExitNodes.php @@ -1,56 +1,7 @@ <?php /** - * Updates the tor exit node list in - * - * 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. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - * @ingroup Extensions + * Alias file for renamed maintenance script in version 1.30. + * Backward compatibilty for cron jobs. */ - -require_once getenv( 'MW_INSTALL_PATH' ) !== false - ? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/Maintenance.php" - : __DIR__ . '/../../maintenance/Maintenance.php'; - -/** - * Maintenance script to load/reload the list of Tor exit nodes. - * - * @ingroup Maintenance - * @ingroup Extensions - */ -class LoadExitNodes extends Maintenance { - public function __construct() { - parent::__construct(); - $this->mDescription = "Load the list of Tor exit nodes."; - $this->addOption( 'force', 'Force loading of exit nodes from the server rather than cache.' ); - $this->requireExtension( "TorBlock" ); - } - - public function execute() { - if ( $this->getOption( 'force', false ) ) { - TorExitNodes::loadExitNodes(); - } - $nodes = TorExitNodes::getExitNodes(); - if ( !$nodes ) { - $this->error( "Could not load exit nodes.", true ); - } - $this->output( 'Successfully loaded ' . count( $nodes ) . " exit nodes.\n" ); - } -} - -$maintClass = 'LoadExitNodes'; -require_once RUN_MAINTENANCE_IF_MAIN; +require_once __DIR__ . '/maintenance/loadExitNodes.php'; diff --git a/maintenance/loadExitNodes.php b/maintenance/loadExitNodes.php new file mode 100644 index 0000000..4c258b3 --- /dev/null +++ b/maintenance/loadExitNodes.php @@ -0,0 +1,56 @@ +<?php + +/** + * Updates the tor exit node list in + * + * 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. + * http://www.gnu.org/copyleft/gpl.html + * + * @file + * @ingroup Extensions + */ + +require_once getenv( 'MW_INSTALL_PATH' ) !== false + ? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/Maintenance.php" + : __DIR__ . '/../../../maintenance/Maintenance.php'; + +/** + * Maintenance script to load/reload the list of Tor exit nodes. + * + * @ingroup Maintenance + * @ingroup Extensions + */ +class LoadExitNodes extends Maintenance { + public function __construct() { + parent::__construct(); + $this->mDescription = "Load the list of Tor exit nodes."; + $this->addOption( 'force', 'Force loading of exit nodes from the server rather than cache.' ); + $this->requireExtension( "TorBlock" ); + } + + public function execute() { + if ( $this->getOption( 'force', false ) ) { + TorExitNodes::loadExitNodes(); + } + $nodes = TorExitNodes::getExitNodes(); + if ( !$nodes ) { + $this->error( "Could not load exit nodes.", true ); + } + $this->output( 'Successfully loaded ' . count( $nodes ) . " exit nodes.\n" ); + } +} + +$maintClass = 'LoadExitNodes'; +require_once RUN_MAINTENANCE_IF_MAIN; -- To view, visit https://gerrit.wikimedia.org/r/398617 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibd6ee1dcbd387d5a208896b9f0059ad0c03e9eba Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TorBlock Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits