version 1.72 -- schema change. database rename . dropping an unused table field. follow up r113772

This commit is contained in:
Thomas Gries 2012-03-14 20:19:16 +00:00
parent 999f2e067f
commit 1292f3b142
Notes: Thomas Gries 2012-03-14 20:19:16 +00:00
5 changed files with 44 additions and 13 deletions

View file

@ -19,7 +19,7 @@
* @author Jack Phoenix <jack@countervandalism.net>
* @author Thomas Gries
* @maintainer Thomas Gries
* @version 1.71
* @version 1.72
* @link http://www.mediawiki.org/wiki/Extension:AJAX_Poll Documentation
*/
@ -31,7 +31,7 @@ if( !defined( 'MEDIAWIKI' ) ) {
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'AJAX Poll',
'version' => '1.71 20120314',
'version' => '1.72 20120314',
'author' => array( 'Dariusz Siedlecki', 'Jack Phoenix', 'Thomas Gries' ),
'descriptionmsg' => 'ajaxpoll-desc',
'url' => 'https://www.mediawiki.org/wiki/Extension:AJAX_Poll',
@ -42,7 +42,8 @@ $dir = dirname( __FILE__ );
$wgExtensionMessagesFiles['AJAXPoll'] = $dir . '/AJAXPoll.i18n.php';
$wgAutoloadClasses['AJAXPoll'] = $dir . '/AJAXPoll_body.php';
$wgAjaxExportList[] = 'AJAXPoll::submitVote';
$wgHooks['ParserFirstCallInit'][] = 'AJAXPoll::AJAXPollParserInit';
$wgHooks['ParserFirstCallInit'][] = 'AJAXPoll::onParserInit';
$wgHooks['LoadExtensionSchemaUpdates'][] = 'AJAXPoll::onLoadExtensionSchemaUpdates';
$myResourceTemplate = array(
'localBasePath' => dirname( __FILE__ ) . "/resources",

View file

@ -21,7 +21,7 @@ class AJAXPoll {
* @param $parser Object: instance of Parser (not necessarily $wgParser)
* @return Boolean: true
*/
static function AJAXPollParserInit( $parser ) {
static function onParserInit( $parser ) {
global $wgOut;
$parser->setHook( 'poll', array( __CLASS__, 'AJAXPollRender' ) );
$wgOut->addModules( 'ext.ajaxpoll' );
@ -76,7 +76,6 @@ class AJAXPoll {
'poll_id' => $id,
'poll_txt' => $input,
'poll_date' => wfTimestampNow(),
'poll_title' => $parser->mTitle->getPrefixedText()
),
__METHOD__
);
@ -394,4 +393,30 @@ class AJAXPoll {
return $ret;
}
public static function onLoadExtensionSchemaUpdates( $updater = null ) {
if ( $updater === null ) {
// no < 1.17 support
} else {
// >= 1.17 support
# poll_info.poll_title field was dropped in AJAXPoll version 1.72
$updater->dropExtensionField(
'poll_info',
'poll_title',
dirname( __FILE__ ) . '/patches/drop-field--poll_info-poll_title.sql'
);
$updater->addExtensionTable(
'ajaxpoll_info',
dirname( __FILE__ ) . '/patches/create-table--ajaxpoll_info.sql'
);
$updater->addExtensionTable(
'ajaxpoll_vote',
dirname( __FILE__ ) . '/patches/create-table--ajaxpoll_vote.sql'
);
}
return true;
}
} /* class AJAXPoll */

View file

@ -0,0 +1,6 @@
RENAME TABLE /*_*/poll_info TO /*_*/ajaxpoll_info;
CREATE TABLE IF NOT EXISTS /*_*/ajaxpoll_info (
`poll_id` varchar(32) NOT NULL PRIMARY KEY default '',
`poll_txt` text,
`poll_date` datetime default NULL
) /*$wgDBTableOptions*/;

View file

@ -1,11 +1,5 @@
CREATE TABLE IF NOT EXISTS /*_*/poll_info (
`poll_id` varchar(32) NOT NULL PRIMARY KEY default '',
`poll_txt` text,
`poll_date` datetime default NULL,
`poll_title` varchar(255) default NULL
) /*$wgDBTableOptions*/;
CREATE TABLE IF NOT EXISTS /*_*/poll_vote (
RENAME TABLE /*_*/poll_vote TO /*_*/ajaxpoll_vote;
CREATE TABLE IF NOT EXISTS /*_*/ajaxpoll_vote (
`poll_id` varchar(32) NOT NULL default '',
`poll_user` varchar(255) NOT NULL default '',
`poll_ip` varchar(255) default NULL,

View file

@ -0,0 +1,5 @@
--
-- SQL schema update for AJAXPoll extension to drop poll_info.poll_title field since version 1.72
--
ALTER TABLE /*_*/poll_info DROP poll_title;