r113837 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113836‎ | r113837 | r113838 >
Date:20:19, 14 March 2012
Author:wikinaut
Status:new (Comments)
Tags:
Comment:
version 1.72 -- schema change. database rename . dropping an unused table field. follow up r113772
Modified paths:
  • /trunk/extensions/AJAXPoll/AJAXPoll.php (modified) (history)
  • /trunk/extensions/AJAXPoll/AJAXPoll_body.php (modified) (history)
  • /trunk/extensions/AJAXPoll/patches (added) (history)
  • /trunk/extensions/AJAXPoll/patches/create-table--ajaxpoll_info.sql (added) (history)
  • /trunk/extensions/AJAXPoll/patches/create-table--ajaxpoll_vote.sql (added) (history)
  • /trunk/extensions/AJAXPoll/patches/drop-field--poll_info-poll_title.sql (added) (history)
  • /trunk/extensions/AJAXPoll/poll.sql (deleted) (history)

Diff [purge]

Index: trunk/extensions/AJAXPoll/poll.sql
@@ -1,15 +0,0 @@
2 -CREATE TABLE IF NOT EXISTS /*_*/poll_info (
3 - `poll_id` varchar(32) NOT NULL PRIMARY KEY default '',
4 - `poll_txt` text,
5 - `poll_date` datetime default NULL,
6 - `poll_title` varchar(255) default NULL
7 -) /*$wgDBTableOptions*/;
8 -
9 -CREATE TABLE IF NOT EXISTS /*_*/poll_vote (
10 - `poll_id` varchar(32) NOT NULL default '',
11 - `poll_user` varchar(255) NOT NULL default '',
12 - `poll_ip` varchar(255) default NULL,
13 - `poll_answer` int(3) default NULL,
14 - `poll_date` datetime default NULL,
15 - PRIMARY KEY (`poll_id`,`poll_user`)
16 -) /*$wgDBTableOptions*/;
\ No newline at end of file
Index: trunk/extensions/AJAXPoll/AJAXPoll.php
@@ -19,7 +19,7 @@
2020 * @author Jack Phoenix <jack@countervandalism.net>
2121 * @author Thomas Gries
2222 * @maintainer Thomas Gries
23 - * @version 1.71
 23+ * @version 1.72
2424 * @link http://www.mediawiki.org/wiki/Extension:AJAX_Poll Documentation
2525 */
2626
@@ -31,7 +31,7 @@
3232 $wgExtensionCredits['parserhook'][] = array(
3333 'path' => __FILE__,
3434 'name' => 'AJAX Poll',
35 - 'version' => '1.71 20120314',
 35+ 'version' => '1.72 20120314',
3636 'author' => array( 'Dariusz Siedlecki', 'Jack Phoenix', 'Thomas Gries' ),
3737 'descriptionmsg' => 'ajaxpoll-desc',
3838 'url' => 'https://www.mediawiki.org/wiki/Extension:AJAX_Poll',
@@ -42,7 +42,8 @@
4343 $wgExtensionMessagesFiles['AJAXPoll'] = $dir . '/AJAXPoll.i18n.php';
4444 $wgAutoloadClasses['AJAXPoll'] = $dir . '/AJAXPoll_body.php';
4545 $wgAjaxExportList[] = 'AJAXPoll::submitVote';
46 -$wgHooks['ParserFirstCallInit'][] = 'AJAXPoll::AJAXPollParserInit';
 46+$wgHooks['ParserFirstCallInit'][] = 'AJAXPoll::onParserInit';
 47+$wgHooks['LoadExtensionSchemaUpdates'][] = 'AJAXPoll::onLoadExtensionSchemaUpdates';
4748
4849 $myResourceTemplate = array(
4950 'localBasePath' => dirname( __FILE__ ) . "/resources",
Index: trunk/extensions/AJAXPoll/patches/drop-field--poll_info-poll_title.sql
@@ -0,0 +1,5 @@
 2+--
 3+-- SQL schema update for AJAXPoll extension to drop poll_info.poll_title field since version 1.72
 4+--
 5+
 6+ALTER TABLE /*_*/poll_info DROP poll_title;
Property changes on: trunk/extensions/AJAXPoll/patches/drop-field--poll_info-poll_title.sql
___________________________________________________________________
Added: svn:eol-style
17 + native
Index: trunk/extensions/AJAXPoll/patches/create-table--ajaxpoll_info.sql
@@ -0,0 +1,6 @@
 2+RENAME TABLE /*_*/poll_info TO /*_*/ajaxpoll_info;
 3+CREATE TABLE IF NOT EXISTS /*_*/ajaxpoll_info (
 4+ `poll_id` varchar(32) NOT NULL PRIMARY KEY default '',
 5+ `poll_txt` text,
 6+ `poll_date` datetime default NULL
 7+) /*$wgDBTableOptions*/;
\ No newline at end of file
Property changes on: trunk/extensions/AJAXPoll/patches/create-table--ajaxpoll_info.sql
___________________________________________________________________
Added: svn:eol-style
18 + native
Index: trunk/extensions/AJAXPoll/patches/create-table--ajaxpoll_vote.sql
@@ -0,0 +1,9 @@
 2+RENAME TABLE /*_*/poll_vote TO /*_*/ajaxpoll_vote;
 3+CREATE TABLE IF NOT EXISTS /*_*/ajaxpoll_vote (
 4+ `poll_id` varchar(32) NOT NULL default '',
 5+ `poll_user` varchar(255) NOT NULL default '',
 6+ `poll_ip` varchar(255) default NULL,
 7+ `poll_answer` int(3) default NULL,
 8+ `poll_date` datetime default NULL,
 9+ PRIMARY KEY (`poll_id`,`poll_user`)
 10+) /*$wgDBTableOptions*/;
\ No newline at end of file
Property changes on: trunk/extensions/AJAXPoll/patches/create-table--ajaxpoll_vote.sql
___________________________________________________________________
Added: svn:eol-style
111 + native
Index: trunk/extensions/AJAXPoll/AJAXPoll_body.php
@@ -21,7 +21,7 @@
2222 * @param $parser Object: instance of Parser (not necessarily $wgParser)
2323 * @return Boolean: true
2424 */
25 - static function AJAXPollParserInit( $parser ) {
 25+ static function onParserInit( $parser ) {
2626 global $wgOut;
2727 $parser->setHook( 'poll', array( __CLASS__, 'AJAXPollRender' ) );
2828 $wgOut->addModules( 'ext.ajaxpoll' );
@@ -76,7 +76,6 @@
7777 'poll_id' => $id,
7878 'poll_txt' => $input,
7979 'poll_date' => wfTimestampNow(),
80 - 'poll_title' => $parser->mTitle->getPrefixedText()
8180 ),
8281 __METHOD__
8382 );
@@ -394,4 +393,30 @@
395394 return $ret;
396395 }
397396
 397+ public static function onLoadExtensionSchemaUpdates( $updater = null ) {
 398+ if ( $updater === null ) {
 399+ // no < 1.17 support
 400+ } else {
 401+ // >= 1.17 support
 402+
 403+ # poll_info.poll_title field was dropped in AJAXPoll version 1.72
 404+ $updater->dropExtensionField(
 405+ 'poll_info',
 406+ 'poll_title',
 407+ dirname( __FILE__ ) . '/patches/drop-field--poll_info-poll_title.sql'
 408+ );
 409+
 410+ $updater->addExtensionTable(
 411+ 'ajaxpoll_info',
 412+ dirname( __FILE__ ) . '/patches/create-table--ajaxpoll_info.sql'
 413+ );
 414+ $updater->addExtensionTable(
 415+ 'ajaxpoll_vote',
 416+ dirname( __FILE__ ) . '/patches/create-table--ajaxpoll_vote.sql'
 417+ );
 418+
 419+ }
 420+ return true;
 421+ }
 422+
398423 } /* class AJAXPoll */

Follow-up revisions

RevisionCommit summaryAuthorDate
r113839follow up r113837 oops, i forgot to make the corresponding database changes i...wikinaut20:28, 14 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r113772follow up r113554 . fixing a regression which was introduced in r113554. Maki...wikinaut22:31, 13 March 2012

Comments

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

relies on two new public functions in the installer see r113836 .

Status & tagging log