r113836 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113835‎ | r113836 | r113837 >
Date:20:16, 14 March 2012
Author:wikinaut
Status:resolved (Comments)
Tags:
Comment:
adding two public convenience function wrappers: dropExtensionField and dropExtensionTable
Modified paths:
  • /trunk/phase3/includes/installer/DatabaseUpdater.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/DatabaseUpdater.php
@@ -203,6 +203,30 @@
204204 }
205205
206206 /**
 207+ *
 208+ * @since 1.20
 209+ *
 210+ * @param $tableName string
 211+ * @param $columnName string
 212+ * @param $sqlPath string
 213+ */
 214+ public function dropExtensionField( $tableName, $columnName, $sqlPath ) {
 215+ $this->extensionUpdates[] = array( 'dropField', $tableName, $columnName, $sqlPath, true );
 216+ }
 217+
 218+ /**
 219+ *
 220+ * @since 1.20
 221+ *
 222+ * @param $tableName string
 223+ * @param $sqlPath string
 224+ */
 225+ public function dropExtensionTable( $tableName, $patch, $fullpath = false ) {
 226+ $this->extensionUpdates[] = array( 'dropTable', $tableName, $sqlPath, true );
 227+ }
 228+
 229+
 230+ /**
207231 * Add a maintenance script to be run after the database updates are complete.
208232 *
209233 * @since 1.19

Follow-up revisions

RevisionCommit summaryAuthorDate
r113862follow up r113836 added public function extensionTableExists.wikinaut21:41, 14 March 2012
r113864follow up r113836 typo correction in function header dropExtensionTablewikinaut21:53, 14 March 2012

Comments

#Comment by Wikinaut (talk | contribs)   20:17, 14 March 2012

I need this in E:AJAXPoll .

#Comment by Wikinaut (talk | contribs)   20:22, 14 March 2012

AJAXPoll r113837 relies upon r113836 .

#Comment by Saper (talk | contribs)   20:50, 14 March 2012

Soon we will end up with 'dropPgField' (see 'addPgField') and other horror in updater. Shouldn't we aim at providing addField/addTable/dropField/dropTable in relatively-DB independent manner for all databases? I would like to kick all those functions out of PostgresUpdater.php into something proper.

Please, please let's come up with sensible API since later we only will be fighting compatibility of extensions done after that.

#Comment by Wikinaut (talk | contribs)   22:04, 14 March 2012

Yes, we need to refactor that in relatively-DB independent manner for all databases, I fully agree.

However, it should be done by an expert, and I am not an expert in that field, sorry.

#Comment by Saper (talk | contribs)   22:05, 14 March 2012

I would like to work on it. Now I just need to bring PostgreSQL updater back in shape!

#Comment by Reedy (talk | contribs)   23:23, 14 March 2012

Soon we will end up with 'dropPgField' (see 'addPgField') and other horror in updater. Shouldn't we aim at providing addField/addTable/dropField/dropTable in relatively-DB independent manner for all databases? I would like to kick all those functions out of PostgresUpdater.php into something proper.

If the generic updater is exposing methods like that, you're doing it wrong.

These are just utility methods, all defined in the base DatabaseUpdater.

Where database specific implementations are needed, they can override the default function dropTable etc, and do it how they want. Which is database independent...

#Comment by Wikinaut (talk | contribs)   23:25, 14 March 2012

I am immediately going to check this. Do you mean, I can try to drop the actual $sqlPath parameter in my extension's code ?

Status & tagging log