Index: trunk/extensions/ArticleCreationWorkflow/includes/ArticleCreationUtil.php |
— | — | @@ -6,6 +6,37 @@ |
7 | 7 | class ArticleCreationUtil { |
8 | 8 | |
9 | 9 | /** |
| 10 | + * Is ArticleCreation enabled for the current user? |
| 11 | + * |
| 12 | + * |
| 13 | + * @return bool whether or not it is. |
| 14 | + */ |
| 15 | + public static function isEnabled() { |
| 16 | + return true; |
| 17 | + global $wgUser, $wgArticleCreationRegistrationCutoff; |
| 18 | + |
| 19 | + $userRegistration = wfTimestamp( TS_MW, $wgUser->getRegistration() ); |
| 20 | + |
| 21 | + $bucketConfig = array( |
| 22 | + 'buckets' => array( |
| 23 | + 'on' => 1, |
| 24 | + 'off' => 99, |
| 25 | + ), |
| 26 | + 'version' => 1, |
| 27 | + ); |
| 28 | + |
| 29 | + if ( !$userRegistration || |
| 30 | + $userRegistration > $wgArticleCreationRegistrationCutoff |
| 31 | + ) { |
| 32 | + $bucket = PHPBucket::getBucket( 'ac-enabled', $bucketConfig ); |
| 33 | + |
| 34 | + return $bucket === 'on'; |
| 35 | + } else { |
| 36 | + return false; |
| 37 | + } |
| 38 | + } |
| 39 | + |
| 40 | + /** |
10 | 41 | * Check if tracking is enabled, in this case - ClickTracking |
11 | 42 | * @return bool |
12 | 43 | */ |
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.init/ext.articleCreation.init.js |
— | — | @@ -1,17 +1,9 @@ |
2 | | -(function($,mw) { |
3 | | - var bucket = mw.user.bucket( 'ACWInterstitialTest', { |
4 | | - 'buckets': { 'control': 99, 'test': 1 }, |
5 | | - 'version': 1, |
6 | | - } ); |
7 | | - |
8 | | - if( bucket === 'test' ) { |
9 | | - // extract the path, article title, and query string as separate components. |
10 | | - var locationParts = location.href.match(/(.+)\/([^\/]+?)((\?.*)|$)/); |
11 | | - |
12 | | - // change the link to point to the new special page |
13 | | - $("div.noarticletext").find('a[href*="action=edit"]').attr( |
14 | | - 'href', |
15 | | - locationParts[1] + '/' + 'Special:ArticleCreationLanding' + '/' + locationParts[2] |
16 | | - ); |
17 | | - } |
| 2 | +(function($,mw) { |
| 3 | + var newTitle = 'Special:ArticleCreationLanding' + '/' + |
| 4 | + encodeURIComponent(wgPageName); |
| 5 | + var landingURL = mw.config.get('wgArticlePath').replace( '$1', newTitle ); |
| 6 | + // change the link to point to the new special page |
| 7 | + $("div.noarticletext") |
| 8 | + .find('a[href*="action=edit"]') |
| 9 | + .attr( 'href', landingURL ); |
18 | 10 | })( jQuery, window.mediaWiki ); |
Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.hooks.php |
— | — | @@ -52,14 +52,10 @@ |
53 | 53 | // $text = ArticleCreationTemplates::showMissingPage( $article ); |
54 | 54 | // $wikiText = false; |
55 | 55 | // } |
56 | | - |
57 | 56 | // return false; |
| 57 | + global $wgOut; |
58 | 58 | |
59 | | - global $wgOut, $wgUser, $wgArticleCreationRegistrationCutoff; |
60 | | - |
61 | | - $userRegistration = wfTimestamp( TS_MW, $wgUser->getRegistration() ); |
62 | | - |
63 | | - if ( !$userRegistration || $userRegistration > $wgArticleCreationRegistrationCutoff ) { |
| 59 | + if ( ArticleCreationUtil::isEnabled() ) { |
64 | 60 | $wgOut->addModules( array( 'ext.articleCreation.init' ) ); |
65 | 61 | } |
66 | 62 | |