jenkins-bot has submitted this change and it was merged. Change subject: Test script to delete pages created by browser suite ......................................................................
Test script to delete pages created by browser suite Initializing elasticsearch to a consistent state before running a test suite can take some time if there are thousands of pages in the wiki from prior test runs. This script removes pages that the test suite created with epoch's in the title. Change-Id: Ia801b8c0e72f3352fbb29597d11b9183e87ae642 --- A tests/jenkins/deleteBrowserTestPages.php 1 file changed, 78 insertions(+), 0 deletions(-) Approvals: Smalyshev: Looks good to me, approved Cindy-the-browser-test-bot: Looks good to me, but someone else must approve DCausse: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/tests/jenkins/deleteBrowserTestPages.php b/tests/jenkins/deleteBrowserTestPages.php new file mode 100644 index 0000000..3b9fe0e --- /dev/null +++ b/tests/jenkins/deleteBrowserTestPages.php @@ -0,0 +1,78 @@ +<?php + +namespace CirrusSearch\Jenkins; +use \Maintenance; + +/** + * Deletes pages created by the browser test suite. cleanSetup.php + * in this jenkins directory runs much faster if it doesn't have to + * reindex all these old unnecessary pages. + * + * 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 + */ + +$IP = getenv( 'MW_INSTALL_PATH' ); +if( $IP === false ) { + $IP = __DIR__ . '/../../../..'; +} +require_once( "$IP/maintenance/Maintenance.php" ); + +class DeleteBrowserTestPages extends Maintenance { + public function execute() { + $pattern = implode( '|', array( + 'IAmABad RedirectChain', + 'IAmABad RedirectSelf', + 'IDontExistLink', + 'IDontExistRdir', + 'IDontExistRdirLinked', + 'ILinkIRedirectToNonExistentPages', + 'ILinkToNonExistentPages', + 'IRedirectToNonExistentPages', + 'IRedirectToNonExistentPagesLinked', + 'Move', + 'PreferRecent First exists with contents ', + 'PreferRecent Second Second exists with contents ', + 'PreferRecent Third exists with contents ', + 'ReallyLongLink', + 'StartsAsRedirect', + 'ToBeRedirect', + 'WeightedLink', + 'WeightedLinkRdir', + 'WeightedLinkRemoveUpdate', + 'WLDoubleRdir', + 'WLRURdir', + ) ); + $pattern = "/$pattern/"; + + $dbw = wfGetDB( DB_MASTER ); + $user = \User::newFromName( 'Admin' ); + $it = new \EchoBatchRowIterator( $dbw, 'page', 'page_id', 500 ); + $it->setFetchColumns( array( '*' ) ); + $it = new \RecursiveIteratorIterator( $it ); + foreach ( $it as $row ) { + if ( preg_match( $pattern, $row->page_title ) !== 1 ) { + continue; + } + $title = \Title::newFromRow( $row ); + $pageObj = \WikiPage::factory( $title ); + echo "Deleting page $title\n"; + $pageObj->doDeleteArticleReal( 'cirrussearch maint task' ); + } + } +} + +$maintClass = "CirrusSearch\Jenkins\DeleteBrowserTestPages"; +require_once RUN_MAINTENANCE_IF_MAIN; -- To view, visit https://gerrit.wikimedia.org/r/227916 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia801b8c0e72f3352fbb29597d11b9183e87ae642 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: master Gerrit-Owner: EBernhardson <[email protected]> Gerrit-Reviewer: Chad <[email protected]> Gerrit-Reviewer: Cindy-the-browser-test-bot <[email protected]> Gerrit-Reviewer: DCausse <[email protected]> Gerrit-Reviewer: EBernhardson <[email protected]> Gerrit-Reviewer: Manybubbles <[email protected]> Gerrit-Reviewer: Smalyshev <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
