return $this->getSize() == 0;
}
+ /**
+ * Returns if the content is valid.
+ * It needs to be valid before it can be saved.
+ *
+ * @since WD.1
+ *
+ * @return boolean
+ */
+ public function isValid() {
+ // TODO
+ return true;
+ }
+
+ /**
+ * Diff the content object with what is currently stored in the database.
+ * If it is not currently stored, it will be diffed with an empty object.
+ *
+ * @since WD.diff
+ *
+ * @return ContentDiff
+ */
+ public function diffToDatabase() {
+ // TODO
+ }
+
/**
* Returns true if this Content objects is conceptually equivalent to the given Content object.
*
$changed = !$content->equals( $old_content );
if ( $changed ) {
+ // TODO: validate!
+ if ( $content->isValid() ) {
+
+ }
+
$dbw->begin( __METHOD__ );
$revisionId = $revision->insertOn( $dbw );
return $status;
}
+ // TODO: create content diff to pass to update objects that might need it
+
# Update links tables, site stats, etc.
- $this->doEditUpdates( $revision, $user, array( 'changed' => $changed,
- 'oldcountable' => $oldcountable ) );
+ $this->doEditUpdates(
+ $revision,
+ $user,
+ array(
+ 'changed' => $changed,
+ 'oldcountable' => $oldcountable
+ )
+ );
if ( !$changed ) {
$status->warning( 'edit-no-change' );