Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/184060
Change subject: MWException -> Exception ...................................................................... MWException -> Exception Change-Id: I22e3fd386d7ba39455e279893ec26adcb1f51da3 --- M GWToolset.alias.php M includes/Adapters/Php/MediawikiTemplatePhpAdapter.php M includes/Handlers/Forms/FormHandler.php M includes/Handlers/Forms/MetadataDetectHandler.php M includes/Handlers/Forms/MetadataMappingHandler.php M includes/Handlers/UploadHandler.php M includes/Handlers/Xml/XmlDetectHandler.php M includes/Handlers/Xml/XmlHandler.php M includes/Handlers/Xml/XmlMappingHandler.php M includes/Helpers/FileChecks.php M includes/Helpers/GWTFileBackend.php M includes/Helpers/WikiChecks.php M includes/Jobs/UploadMetadataJob.php M includes/Models/MediawikiTemplate.php M includes/Php/File.php M includes/Specials/SpecialGWToolset.php M includes/Utils.php M maintenance/cleanupGWTFileBackend.php 18 files changed, 101 insertions(+), 101 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GWToolset refs/changes/60/184060/1 diff --git a/GWToolset.alias.php b/GWToolset.alias.php index 8fe270e..5aa9eb4 100644 --- a/GWToolset.alias.php +++ b/GWToolset.alias.php @@ -63,4 +63,4 @@ /** Traditional Chinese (中文(繁體)) */ $specialPageAliases['zh-hant'] = array( 'GWToolset' => array( 'GW_工具組' ), -); \ No newline at end of file +); diff --git a/includes/Adapters/Php/MediawikiTemplatePhpAdapter.php b/includes/Adapters/Php/MediawikiTemplatePhpAdapter.php index ca83e39..7458d3c 100644 --- a/includes/Adapters/Php/MediawikiTemplatePhpAdapter.php +++ b/includes/Adapters/Php/MediawikiTemplatePhpAdapter.php @@ -101,7 +101,7 @@ * format -- {"parameter name":""} * * @param {Title} $Title - * @throws {MWException} + * @throws {Exception} * @return {null|string} * null or a JSON representation of the MediaWiki template parameters */ diff --git a/includes/Handlers/Forms/FormHandler.php b/includes/Handlers/Forms/FormHandler.php index 137ea10..929935b 100644 --- a/includes/Handlers/Forms/FormHandler.php +++ b/includes/Handlers/Forms/FormHandler.php @@ -10,7 +10,7 @@ use GWToolset\GWTException, GWToolset\Helpers\WikiChecks, Html, - MWException; + Exception; abstract class FormHandler { @@ -86,14 +86,14 @@ /** * @param {string} $module - * @throws {MWException} + * @throws {Exception} * @return {string} */ public function getFormClass( $module = null ) { $registered_modules = $this->SpecialPage->getRegisteredModules(); if ( $module === null || !array_key_exists( $module, $registered_modules ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . @@ -104,7 +104,7 @@ } if ( !isset( $registered_modules[$module]['form'] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . @@ -117,7 +117,7 @@ $result = $registered_modules[$module]['form']; if ( !class_exists( $result ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . diff --git a/includes/Handlers/Forms/MetadataDetectHandler.php b/includes/Handlers/Forms/MetadataDetectHandler.php index c5d3955..e028bfc 100644 --- a/includes/Handlers/Forms/MetadataDetectHandler.php +++ b/includes/Handlers/Forms/MetadataDetectHandler.php @@ -20,7 +20,7 @@ GWToolset\Utils, FSFile, Language, - MWException, + Exception, Php\File; class MetadataDetectHandler extends FormHandler { @@ -209,7 +209,7 @@ ); if ( !( $FSFile instanceof FSFile ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . diff --git a/includes/Handlers/Forms/MetadataMappingHandler.php b/includes/Handlers/Forms/MetadataMappingHandler.php index 3d1b844..a487762 100644 --- a/includes/Handlers/Forms/MetadataMappingHandler.php +++ b/includes/Handlers/Forms/MetadataMappingHandler.php @@ -26,7 +26,7 @@ Html, JobQueueGroup, Linker, - MWException, + Exception, Title; class MetadataMappingHandler extends FormHandler { @@ -97,7 +97,7 @@ protected $_XmlMappingHandler; /** - * @throws {MWException} + * @throws {Exception} * * @return {string} * the html string has been escaped and parsed by wfMessage @@ -409,7 +409,7 @@ ); if ( !( $FSFile instanceof FSFile ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . @@ -422,7 +422,7 @@ } if ( $user_options['gwtoolset-metadata-file-sha1'] !== $FSFile->getSha1Base36() ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . @@ -486,7 +486,7 @@ ); if ( !$Status->ok ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . $Status->getMessage() ) ->parse() diff --git a/includes/Handlers/UploadHandler.php b/includes/Handlers/UploadHandler.php index ecd2010..0efb3f6 100644 --- a/includes/Handlers/UploadHandler.php +++ b/includes/Handlers/UploadHandler.php @@ -20,7 +20,7 @@ GWToolset\Jobs\UploadMediafileJob, Http, MimeMagic, - MWException, + Exception, MWHttpRequest, Status, Title, @@ -745,14 +745,14 @@ * @param {array} $whitelisted_post * * @return {bool} - * @throws {MWException} + * @throws {Exception} */ public function saveMediafileViaJob( array $user_options, array $options, array $whitelisted_post ) { if ( count( $this->mediafile_jobs ) > (int)$user_options['gwtoolset-mediafile-throttle'] ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . @@ -929,11 +929,11 @@ * - url-to-the-media-file * * @param {array} $options - * @throws {MWException} + * @throws {Exception} */ protected function validateUploadParams( array &$options ) { if ( !isset( $options['ignorewarnings'] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-ignorewarnings' )->parse() ) ->parse() @@ -942,7 +942,7 @@ // assumes that text must be something if ( empty( $options['text'] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-text' )->escaped() ) ->parse() @@ -950,7 +950,7 @@ } if ( empty( $options['title'] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-title' )->escaped() ) ->parse() @@ -958,7 +958,7 @@ } if ( empty( $options['gwtoolset-url-to-the-media-file'] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-url-to-media' )->parse() ) ->parse() @@ -968,11 +968,11 @@ /** * @param {array} $options - * @throws {MWException} + * @throws {Exception} */ protected function validateUserOptions( array $user_options ) { if ( !isset( $user_options['comment'] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-comment' )->parse() ) ->parse() @@ -980,7 +980,7 @@ } if ( !isset( $user_options['gwtoolset-mediafile-throttle'] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-mediafile-throttle' )->parse() ) ->parse() @@ -988,7 +988,7 @@ } if ( !isset( $user_options['gwtoolset-reupload-media'] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-reupload-media' )->parse() ) ->parse() @@ -996,7 +996,7 @@ } if ( !isset( $user_options['save-as-batch-job'] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-save-as-batch' )->parse() ) ->parse() diff --git a/includes/Handlers/Xml/XmlDetectHandler.php b/includes/Handlers/Xml/XmlDetectHandler.php index 360aa44..4163c3f 100644 --- a/includes/Handlers/Xml/XmlDetectHandler.php +++ b/includes/Handlers/Xml/XmlDetectHandler.php @@ -14,7 +14,7 @@ GWToolset\Utils, GWToolset\Models\Mapping, Html, - MWException, + Exception, Sanitizer, XMLReader; @@ -113,13 +113,13 @@ * @param {array} $user_options * an array of user options that was submitted in the html form * - * @throws {MWException} + * @throws {Exception} */ protected function findExampleDOMElement( $XMLElement, array &$user_options ) { $record = null; if ( !( $XMLElement instanceof XMLReader ) && !( $XMLElement instanceof DOMElement ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-xml-element' )->escaped() ) ->parse() @@ -129,7 +129,7 @@ if ( !isset( $user_options['gwtoolset-record-element-name'] ) || !isset( $user_options['gwtoolset-record-count'] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-dom-record-issue' )->parse() ) ->parse() @@ -446,7 +446,7 @@ * the assumption is that it has already been uploaded to the wiki earlier and * is ready for use * - * @throws {GWTException|MWException} + * @throws {GWTException|Exception} */ public function processXml( array &$user_options, $xml_source = null ) { $callback = 'findExampleDOMElement'; @@ -457,7 +457,7 @@ $msg = wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-xml-source' )->escaped() ) ->parse(); - throw new MWException( $msg ); + throw new Exception( $msg ); } if ( empty( $this->_metadata_example_dom_element ) ) { diff --git a/includes/Handlers/Xml/XmlHandler.php b/includes/Handlers/Xml/XmlHandler.php index 4dd3d5a..306ac3e 100644 --- a/includes/Handlers/Xml/XmlHandler.php +++ b/includes/Handlers/Xml/XmlHandler.php @@ -11,7 +11,7 @@ use GWToolset\GWTException, GWToolset\Helpers\GWTFileBackend, Html, - MWException, + Exception, XMLReader; abstract class XmlHandler { @@ -100,7 +100,7 @@ * @todo: handle an xml schema if present (future) * @todo: handle incomplete/partial uploads (future) * - * @throws {MWException} + * @throws {Exception} * * @return {array} * an array of mediafile Title(s) @@ -111,7 +111,7 @@ $result = array(); if ( empty( $callback ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-callback' )->escaped() ) ->parse() @@ -121,7 +121,7 @@ $XMLReader = new XMLReader(); if ( !$XMLReader->open( $file_path_local ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-could-not-open-xml' )->escaped() ) ->parse() @@ -157,7 +157,7 @@ libxml_disable_entity_loader( $old_value ); if ( !$XMLReader->close() ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-could-not-close-xml' )->escaped() ) ->parse() diff --git a/includes/Handlers/Xml/XmlMappingHandler.php b/includes/Handlers/Xml/XmlMappingHandler.php index e5d9871..6e94f91 100644 --- a/includes/Handlers/Xml/XmlMappingHandler.php +++ b/includes/Handlers/Xml/XmlMappingHandler.php @@ -12,7 +12,7 @@ DOMElement, GWToolset\Config, GWToolset\Utils, - MWException, + Exception, XMLReader; class XmlMappingHandler extends XmlHandler { @@ -306,7 +306,7 @@ * @param {array} $user_options * an array of user options that was submitted in the html form * - * @throws {MWException} + * @throws {Exception} * * @return {array} * - $result['Title'] {Title} @@ -320,7 +320,7 @@ if ( !( $XMLElement instanceof XMLReader ) && !( $XMLElement instanceof DOMElement ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-xml-element' )->escaped() ) ->parse() @@ -331,7 +331,7 @@ || !isset( $user_options['gwtoolset-record-count'] ) || !isset( $user_options['gwtoolset-record-current'] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-dom-record-issue' )->parse() ) ->parse() @@ -404,7 +404,7 @@ * the assumption is that it has already been uploaded to the wiki earlier and * is ready for use * - * @throws {MWException} + * @throws {Exception} * @return {array} * an array of mediafile Title(s) */ @@ -414,7 +414,7 @@ if ( is_string( $xml_source ) && !empty( $xml_source ) ) { return $this->readXmlAsFile( $user_options, $xml_source, $callback ); } else { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-xml-source' )->escaped() ) ->parse() diff --git a/includes/Helpers/FileChecks.php b/includes/Helpers/FileChecks.php index ac56db2..ea98b11 100644 --- a/includes/Helpers/FileChecks.php +++ b/includes/Helpers/FileChecks.php @@ -12,7 +12,7 @@ GWToolset\GWTException, GWToolset\Utils, MimeMagic, - MWException, + Exception, Php\File, Status, UploadBase; @@ -218,12 +218,12 @@ * * @param {File} $File * @param {array} $accepted_types - * @throws {MWException} + * @throws {Exception} * @return {Status} */ public static function isUploadedFileValid( File $File, array $accepted_types = array() ) { if ( empty( $accepted_types ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-accepted-types' )->escaped( 'gwtoolset-no-accepted-types-provided' ) ) ->parse() diff --git a/includes/Helpers/GWTFileBackend.php b/includes/Helpers/GWTFileBackend.php index 98fc913..d748453 100644 --- a/includes/Helpers/GWTFileBackend.php +++ b/includes/Helpers/GWTFileBackend.php @@ -13,7 +13,7 @@ GWToolset\Constants, GWToolset\Utils, JobQueueGroup, - MWException, + Exception, Exception, Php\File, Status, @@ -62,12 +62,12 @@ * creates a GWTFileBackendCleanupJob that will delete the mwstore file in the FileBackend * * @param {string} $mwstore_relative_path - * @throws {MWException} + * @throws {Exception} * @return {bool} */ public function createCleanupJob( $mwstore_relative_path = null ) { if ( empty( $mwstore_relative_path ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . wfMessage( 'gwtoolset-no-mwstore-relative-path' ) ) ->parse() @@ -75,7 +75,7 @@ } if ( empty( $this->_User ) ) { - throw new MWException( wfMessage( 'gwtoolset-no-user' ) ); + throw new Exception( wfMessage( 'gwtoolset-no-user' ) ); } $job = new GWTFileBackendCleanupJob( @@ -110,11 +110,11 @@ * * @param {string} $mwstore_complete_file_path * @return {Status} - * @throws {MWException} + * @throws {Exception} */ public function deleteFile( $mwstore_complete_file_path = null ) { if ( empty( $mwstore_complete_file_path ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . wfMessage( 'gwtoolset-no-mwstore-complete-path' ) ) ->parse() @@ -134,12 +134,12 @@ /** * @param {string} $mwstore_relative_path - * @throws {MWException} + * @throws {Exception} * @return {string} */ public function deleteFileFromRelativePath( $mwstore_relative_path = null ) { if ( empty( $mwstore_relative_path ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . wfMessage( 'gwtoolset-no-mwstore-relative-path' ) ) ->parse() @@ -246,7 +246,7 @@ * the User name is used in order to help limit file access and indicate * which user submitted the file. * - * @throws {MWException} + * @throws {Exception} * @return {string} */ public function getMWStorePath() { @@ -276,11 +276,11 @@ * includes: * - user name * - * @throws {MWException} + * @throws {Exception} */ protected function getUserPath() { if ( empty( $this->_User ) ) { - throw new MWException( wfMessage( 'gwtoolset-no-user' ) ); + throw new Exception( wfMessage( 'gwtoolset-no-user' ) ); } return wfStripIllegalFilenameChars( $this->_User->getName() ); @@ -322,14 +322,14 @@ * retrieves a file, based on an mwstore complete file path, from the FileBackend * * @param {string} $mwstore_complete_file_path - * @throws {MWException} + * @throws {Exception} * @return {null|FSFile} */ public function retrieveFile( $mwstore_complete_file_path = null ) { $result = null; if ( empty( $mwstore_complete_file_path ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . wfMessage( 'gwtoolset-no-mwstore-complete-path' ) ) ->parse() @@ -342,7 +342,7 @@ if ( $this->FileBackend->getFileSize( $src ) === 0 ) { $this->FileBackend->quickDelete( $src ); - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . wfMessage( 'gwtoolset-fsfile-empty' )->parse() ) ->parse() @@ -357,12 +357,12 @@ /** * @param {string} $mwstore_relative_path - * @throws {MWException} + * @throws {Exception} * @return {null|FSFile} */ public function retrieveFileFromRelativePath( $mwstore_relative_path = null ) { if ( empty( $mwstore_relative_path ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . wfMessage( 'gwtoolset-no-mwstore-relative-path' ) ) ->parse() @@ -380,14 +380,14 @@ * @see http://www.php.net/manual/en/datetime.formats.relative.php * * @param {File} $File - * @throws {MWException} + * @throws {Exception} * @return {null|string} */ public function saveFile( File $File ) { $result = null; if ( empty( $File ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . wfMessage( 'gwtoolset-no-file' )->parse() ) ->parse() @@ -399,7 +399,7 @@ $Status = $this->prepare(); if ( !$Status->ok ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . $Status->getMessage() ) ->parse() @@ -409,7 +409,7 @@ $Status = $this->quickStore( $File->tmp_name ); if ( !$Status->ok ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . $Status->getMessage() ) ->parse() @@ -439,11 +439,11 @@ * sets up the file backend * * @param {array} $params - * @throws {MWException} + * @throws {Exception} */ protected function setupFileBackend( array $params ) { if ( empty( $params['file-backend-name'] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . wfMessage( 'gwtoolset-no-file-backend-name' )->parse() ) ->parse() @@ -451,7 +451,7 @@ } if ( empty( $params['container'] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . diff --git a/includes/Helpers/WikiChecks.php b/includes/Helpers/WikiChecks.php index c7a9e25..9a9e0d4 100644 --- a/includes/Helpers/WikiChecks.php +++ b/includes/Helpers/WikiChecks.php @@ -11,7 +11,7 @@ use GWToolset\Config, GWToolset\Constants, GWToolset\Utils, - MWException, + Exception, SpecialPage, Status; @@ -85,7 +85,7 @@ try { wfUseMW( Constants::REQUIRED_MEDIAWIKI_VERSION ); - } catch( MWException $e ) { + } catch( Exception $e ) { return Status::newFatal( 'gwtoolset-mediawiki-version-invalid', Constants::REQUIRED_MEDIAWIKI_VERSION, diff --git a/includes/Jobs/UploadMetadataJob.php b/includes/Jobs/UploadMetadataJob.php index 5c00619..3e002f4 100644 --- a/includes/Jobs/UploadMetadataJob.php +++ b/includes/Jobs/UploadMetadataJob.php @@ -15,7 +15,7 @@ GWToolset\Utils, GWToolset\GWTException, GWToolset\Handlers\Forms\MetadataMappingHandler, - MWException, + Exception, Exception, Title, User; @@ -63,7 +63,7 @@ } /** - * @throws {MWException} + * @throws {Exception} * @return {bool} */ protected function recreateMetadataJob() { @@ -82,7 +82,7 @@ 'metadata job delay: ' . Config::$metadata_job_delay . PHP_EOL . 'jobReleaseTimestamp: ' . $job_release; - throw new MWException( $msg ); + throw new Exception( $msg ); } $job = new UploadMetadataJob( diff --git a/includes/Models/MediawikiTemplate.php b/includes/Models/MediawikiTemplate.php index 4c5044d..157994a 100644 --- a/includes/Models/MediawikiTemplate.php +++ b/includes/Models/MediawikiTemplate.php @@ -13,7 +13,7 @@ GWToolset\Config, GWToolset\GWTException, GWToolset\Utils, - MWException; + Exception; class MediawikiTemplate implements ModelInterface { @@ -185,7 +185,7 @@ * the array is expected to be in an array format for each mediawiki parameter * e.g. accession_number[], artist[] * - * @throws {MWException} + * @throws {Exception} * * @return {array} * the keys and values in the array are sanitized @@ -196,7 +196,7 @@ $metadata_element = null; if ( empty( $array ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . @@ -531,11 +531,11 @@ * provided at class instantiation and populates this model class with the result * * @param {string} $mediawiki_template_name - * @throws {GWTException|MWException} + * @throws {GWTException|Exception} */ public function getMediaWikiTemplate( $mediawiki_template_name = null ) { if ( empty( $mediawiki_template_name ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->param( wfMessage( 'gwtoolset-no-mediawiki-template' )->parse() ) ->parse() diff --git a/includes/Php/File.php b/includes/Php/File.php index 3a5aacd..e7a5df3 100644 --- a/includes/Php/File.php +++ b/includes/Php/File.php @@ -12,7 +12,7 @@ GWToolset\GWTException, GWToolset\Utils, MimeMagic, - MWException; + Exception; /** * @link http://php.net/manual/en/reserved.variables.files.php @@ -159,13 +159,13 @@ } /** - * @throws {GWTException|MWException} + * @throws {GWTException|Exception} */ public function populate( $file_field_name ) { $file_field_name = Utils::sanitizeString( $file_field_name ); if ( !isset( $_FILES[$file_field_name] ) ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-no-form-field' ) ->params( $file_field_name ) ->escaped() diff --git a/includes/Specials/SpecialGWToolset.php b/includes/Specials/SpecialGWToolset.php index c5b60a4..6b58998 100644 --- a/includes/Specials/SpecialGWToolset.php +++ b/includes/Specials/SpecialGWToolset.php @@ -14,7 +14,7 @@ GWToolset\Helpers\WikiChecks, Html, Linker, - MWException, + Exception, SpecialPage, Title; @@ -143,7 +143,7 @@ } /** - * @throws {MWException} + * @throws {Exception} */ protected function setModuleAndHandler() { $this->module_key = null; @@ -171,7 +171,7 @@ ) ->escaped(); - throw new MWException( $msg ); + throw new Exception( $msg ); } } else if ( $this->getRequest()->wasPosted() ) { // a posted form must have a registered module key @@ -182,7 +182,7 @@ ) ->escaped(); - throw new MWException( $msg ); + throw new Exception( $msg ); } } diff --git a/includes/Utils.php b/includes/Utils.php index aa4dd1b..7f980a8 100644 --- a/includes/Utils.php +++ b/includes/Utils.php @@ -10,7 +10,7 @@ namespace GWToolset; use Language, ManualLogEntry, - MWException, + Exception, Sanitizer, Title; @@ -108,7 +108,7 @@ * @param {bool} $options['must-be-known'] * Whether or not the Title must be known; defaults to true * - * @throws {GWTException|MWException} + * @throws {GWTException|Exception} * @return {null|Title} */ public static function getTitle( $page_title = null, $namespace = NS_MAIN, array $options = array() ) { @@ -122,7 +122,7 @@ $options = array_merge( $option_defaults, $options ); if ( empty( $page_title ) ) { - throw new MWException( + throw new Exception( __METHOD__ . ': ' . wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-page-title' )->escaped() ) @@ -179,7 +179,7 @@ * * @param {array} $original_post * @param {array} $expected_post_fields - * @throws {MWException} + * @throws {Exception} * * @return {array} * the values within the array have been sanitized @@ -196,7 +196,7 @@ } if ( !isset( $metadata['size'] ) ) { - throw new MWException( + throw new Exception( __METHOD__ . ': ' . wfMessage( 'gwtoolset-developer-issue' ) ->params( @@ -286,11 +286,11 @@ * @param {int} $params['max'] * @param {int} $params['default'] * @return {int} - * @throws {MWException} + * @throws {Exception} */ public static function sanitizeNumericRange( $value, $params ) { if ( !isset( $params['min'] ) ) { - throw new MWException( + throw new Exception( __METHOD__ . ': ' . wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-min' ) ) @@ -299,7 +299,7 @@ } if ( !isset( $params['max'] ) ) { - throw new MWException( + throw new Exception( __METHOD__ . ': ' . wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-max' ) ) @@ -308,7 +308,7 @@ } if ( !isset( $params['min'] ) ) { - throw new MWException( + throw new Exception( __METHOD__ . ': ' . wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-no-default' ) ) @@ -338,7 +338,7 @@ * @param {array} $options * Filter options * - * @throws {MWException} + * @throws {Exception} * @return {string|null} */ public static function sanitizeString( $string, array $options = array() ) { @@ -346,7 +346,7 @@ // is_string thought some form fields were booleans instead of strings if ( !gettype( $string ) === 'string' ) { - throw new MWException( + throw new Exception( __METHOD__ . ': ' . wfMessage( 'gwtoolset-developer-issue' ) ->params( wfMessage( 'gwtoolset-not-string' )->params( gettype( $string ) ) ) diff --git a/maintenance/cleanupGWTFileBackend.php b/maintenance/cleanupGWTFileBackend.php index 9f7fd04..338bfc9 100644 --- a/maintenance/cleanupGWTFileBackend.php +++ b/maintenance/cleanupGWTFileBackend.php @@ -11,7 +11,7 @@ use GWToolset\Helpers\GWTFileBackend, Maintenance, - MWException; + Exception; $IP = getenv( 'MW_INSTALL_PATH' ); if ( $IP === false ) { @@ -50,7 +50,7 @@ $cutoff = strtotime( '-' . $wgGWTFBMaxAge ); if ( !$cutoff ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . @@ -92,7 +92,7 @@ $Status = $GWTFileBackend->deleteFile( $mwstore_file_path ); if ( !$Status->isOK() ) { - throw new MWException( + throw new Exception( wfMessage( 'gwtoolset-developer-issue' ) ->params( __METHOD__ . ': ' . -- To view, visit https://gerrit.wikimedia.org/r/184060 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I22e3fd386d7ba39455e279893ec26adcb1f51da3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GWToolset Gerrit-Branch: master Gerrit-Owner: Ori.livneh <o...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits