Code Duplication    Length = 13-13 lines in 3 locations

includes/installer/DatabaseUpdater.php 3 locations

@@ 684-696 (lines=13) @@
681
	 * @param bool $fullpath Whether to treat $patch path as a relative or not
682
	 * @return bool False if this was skipped because schema changes are skipped
683
	 */
684
	protected function addTable( $name, $patch, $fullpath = false ) {
685
		if ( !$this->doTable( $name ) ) {
686
			return true;
687
		}
688
689
		if ( $this->db->tableExists( $name, __METHOD__ ) ) {
690
			$this->output( "...$name table already exists.\n" );
691
		} else {
692
			return $this->applyPatch( $patch, $fullpath, "Creating $name table" );
693
		}
694
695
		return true;
696
	}
697
698
	/**
699
	 * Add a new field to an existing table
@@ 757-769 (lines=13) @@
754
	 * @param bool $fullpath Whether to treat $patch path as a relative or not
755
	 * @return bool False if this was skipped because schema changes are skipped
756
	 */
757
	protected function dropField( $table, $field, $patch, $fullpath = false ) {
758
		if ( !$this->doTable( $table ) ) {
759
			return true;
760
		}
761
762
		if ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
763
			return $this->applyPatch( $patch, $fullpath, "Table $table contains $field field. Dropping" );
764
		} else {
765
			$this->output( "...$table table does not contain $field field.\n" );
766
		}
767
768
		return true;
769
	}
770
771
	/**
772
	 * Drop an index from an existing table
@@ 780-792 (lines=13) @@
777
	 * @param bool $fullpath Whether to treat $patch path as a relative or not
778
	 * @return bool False if this was skipped because schema changes are skipped
779
	 */
780
	protected function dropIndex( $table, $index, $patch, $fullpath = false ) {
781
		if ( !$this->doTable( $table ) ) {
782
			return true;
783
		}
784
785
		if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
786
			return $this->applyPatch( $patch, $fullpath, "Dropping $index index from table $table" );
787
		} else {
788
			$this->output( "...$index key doesn't exist.\n" );
789
		}
790
791
		return true;
792
	}
793
794
	/**
795
	 * Rename an index from an existing table