mediawiki-extensions-Linter/includes/MissingCategoryException.php
Kunal Mehta 3a8d3b9e03 Handle non-existent categories in the database better
If a newer version of MediaWiki gets rolled back, it's possible for
there to be lint entries in the database that don't exist according to
CategoryManager.

Instead of showing an error to the user, just silently hide those rows.

All callers to CategoryManager::getCategoryId() already check the
category exists. The callers for CategoryManager::getCategoryName() will
catch the MissingCategoryException, and log it if necessary. Notably
LinterError::makeLintError() will return false on invalid rows, and all
callers have been updated to handle that.

Bug: T179423
Change-Id: Ia5f56f18a51fa871511b02410222a6079efbfff6
2017-10-31 10:42:07 -07:00

30 lines
955 B
PHP

<?php
/**
* Copyright (C) 2017 Kunal Mehta <legoktm@member.fsf.org>
*
* 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.
*
*/
namespace MediaWiki\Linter;
use Exception;
/**
* Exception to throw if a category cannot be found
*/
class MissingCategoryException extends Exception {
}