From cdeb7fe02ce0db86aa18a8063f6d7d2ecb964bd9 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 23 May 2012 09:30:26 +0200 Subject: [PATCH] content validation, global consistency check --- includes/Content.php | 5 +++-- includes/ContentHandler.php | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/includes/Content.php b/includes/Content.php index c270540b22..8f505e665a 100644 --- a/includes/Content.php +++ b/includes/Content.php @@ -201,15 +201,16 @@ abstract class Content { } /** - * Returns if the content is valid. + * Returns if the content is valid. This is intended for local validity checks, not considering global consistency. * It needs to be valid before it can be saved. * + * This default implementation always returns true. + * * @since WD.1 * * @return boolean */ public function isValid() { - // TODO return true; } diff --git a/includes/ContentHandler.php b/includes/ContentHandler.php index 80f729be15..b2d28d7a48 100644 --- a/includes/ContentHandler.php +++ b/includes/ContentHandler.php @@ -461,6 +461,22 @@ abstract class ContentHandler { } } + /** + * Returns if the content is consistent with the database, that is if saving it to the database would not violate any + * global constraints. + * + * Content needs to be valid using this method before it can be saved. + * + * This default implementation always returns true. + * + * @since WD.1 + * + * @return boolean + */ + public function isConsistentWithDatabase( Content $content ) { + return true; + } + /** * Returns overrides for action handlers. * Classes listed here will be used instead of the default one when -- 2.20.1