Code Duplication    Length = 15-15 lines in 2 locations

includes/installer/DatabaseUpdater.php 2 locations

@@ 707-721 (lines=15) @@
704
	 * @param bool $fullpath Whether to treat $patch path as a relative or not
705
	 * @return bool False if this was skipped because schema changes are skipped
706
	 */
707
	protected function addField( $table, $field, $patch, $fullpath = false ) {
708
		if ( !$this->doTable( $table ) ) {
709
			return true;
710
		}
711
712
		if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
713
			$this->output( "...$table table does not exist, skipping new field patch.\n" );
714
		} elseif ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
715
			$this->output( "...have $field field in $table table.\n" );
716
		} else {
717
			return $this->applyPatch( $patch, $fullpath, "Adding $field field to table $table" );
718
		}
719
720
		return true;
721
	}
722
723
	/**
724
	 * Add a new index to an existing table
@@ 732-746 (lines=15) @@
729
	 * @param bool $fullpath Whether to treat $patch path as a relative or not
730
	 * @return bool False if this was skipped because schema changes are skipped
731
	 */
732
	protected function addIndex( $table, $index, $patch, $fullpath = false ) {
733
		if ( !$this->doTable( $table ) ) {
734
			return true;
735
		}
736
737
		if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
738
			$this->output( "...skipping: '$table' table doesn't exist yet.\n" );
739
		} elseif ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
740
			$this->output( "...index $index already set on $table table.\n" );
741
		} else {
742
			return $this->applyPatch( $patch, $fullpath, "Adding index $index to table $table" );
743
		}
744
745
		return true;
746
	}
747
748
	/**
749
	 * Drop a field from an existing table