Index: trunk/extensions/Survey/Survey.php |
— | — | @@ -60,4 +60,33 @@ |
61 | 61 | $wgSpecialPages['SpecialSurveys'] = 'SpecialSurveys'; |
62 | 62 | $wgSpecialPages['SpecialSurveyStats'] = 'SpecialSurveyStats'; |
63 | 63 | |
| 64 | +$wgAPIModules['addsurvey'] = 'ApiAddSurvey'; |
| 65 | +$wgAPIModules['deletesurvey'] = 'ApiDeleteSurvey'; |
| 66 | +$wgAPIModules['editsurvey'] = 'ApiEditSurvey'; |
| 67 | +$wgAPIModules['submitsurvey'] = 'ApiSubmitSurvey'; |
| 68 | +$wgAPIListModules['surveys'] = 'ApiQuerySurveys'; |
| 69 | + |
| 70 | +$wgHooks['LoadExtensionSchemaUpdates'][] = 'SurveyHooks::onSchemaUpdate'; |
| 71 | + |
| 72 | +$wgAvailableRights[] = 'surveyadmin'; |
| 73 | +$wgAvailableRights[] = 'surveysubmit'; |
| 74 | + |
| 75 | +$egSurveyScriptPath = $wgExtensionAssetsPath === false ? $wgScriptPath . '/extensions' : $wgExtensionAssetsPath; |
| 76 | +$egSurveyScriptPath .= '/Survey/resources'; |
| 77 | + |
| 78 | +$moduleTemplate = array( |
| 79 | + 'localBasePath' => dirname( __FILE__ ), |
| 80 | + 'remoteBasePath' => $egSurveyScriptPath |
| 81 | +); |
| 82 | + |
| 83 | +$wgResourceModules['ext.survey'] = $moduleTemplate + array( |
| 84 | + 'styles' => array(), |
| 85 | + 'scripts' => array( |
| 86 | + 'jquery.survey.js' |
| 87 | + ), |
| 88 | + 'dependencies' => array(), |
| 89 | + 'messages' => array( |
| 90 | + ) |
| 91 | +); |
| 92 | + |
64 | 93 | $egSurveySettings = array(); |
Index: trunk/extensions/Survey/Survey.hooks.php |
— | — | @@ -13,6 +13,46 @@ |
14 | 14 | */ |
15 | 15 | final class SurveyHooks { |
16 | 16 | |
| 17 | + /** |
| 18 | + * Schema update to set up the needed database tables. |
| 19 | + * |
| 20 | + * @since 0.1 |
| 21 | + * |
| 22 | + * @param DatabaseUpdater $updater |
| 23 | + * |
| 24 | + * @return true |
| 25 | + */ |
| 26 | + public static function onSchemaUpdate( /* DatabaseUpdater */ $updater = null ) { |
| 27 | + global $wgDBtype; |
| 28 | + |
| 29 | + if ( $wgDBtype == 'mysql' ) { |
| 30 | + $updater->addExtensionUpdate( array( |
| 31 | + 'addTable', |
| 32 | + 'surveys', |
| 33 | + dirname( __FILE__ ) . '/Survey.sql', |
| 34 | + true |
| 35 | + ) ); |
| 36 | + $updater->addExtensionUpdate( array( |
| 37 | + 'addTable', |
| 38 | + 'survey_questions', |
| 39 | + dirname( __FILE__ ) . '/Survey.sql', |
| 40 | + true |
| 41 | + ) ); |
| 42 | + $updater->addExtensionUpdate( array( |
| 43 | + 'addTable', |
| 44 | + 'survey_submissions', |
| 45 | + dirname( __FILE__ ) . '/Survey.sql', |
| 46 | + true |
| 47 | + ) ); |
| 48 | + $updater->addExtensionUpdate( array( |
| 49 | + 'addTable', |
| 50 | + 'survey_answers', |
| 51 | + dirname( __FILE__ ) . '/Survey.sql', |
| 52 | + true |
| 53 | + ) ); |
| 54 | + } |
| 55 | + |
| 56 | + return true; |
| 57 | + } |
17 | 58 | |
18 | | - |
19 | 59 | } |