Index: trunk/extensions/ArticleCreationWorkflow/includes/ArticleCreationUtil.php |
— | — | @@ -66,25 +66,13 @@ |
67 | 67 | |
68 | 68 | self::clickTracking( $event, Title::newFromText( $par ) ); |
69 | 69 | } |
70 | | - |
71 | | - /** |
72 | | - * Track pages created from article creation |
73 | | - * @param $title Title |
74 | | - */ |
75 | | - public static function TrackCompleteSave( $title ) { |
76 | | - global $wgRequest; |
77 | 70 | |
78 | | - if ( $wgRequest->getVal( 'fromacw' ) ) { |
79 | | - self::clickTracking( 'created-from-article-creation', $title ); |
80 | | - } |
81 | | - } |
82 | | - |
83 | 71 | /** |
84 | 72 | * Tracking code that calls ClickTracking |
85 | 73 | * @param $event string the event name |
86 | 74 | * @param $title Object |
87 | 75 | */ |
88 | | - private static function clickTracking( $event, $title ) { |
| 76 | + public static function clickTracking( $event, $title ) { |
89 | 77 | // check if ClickTracking API is enabled |
90 | 78 | if ( !self::trackingEnabled() ) { |
91 | 79 | return; |
Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.php |
— | — | @@ -31,6 +31,7 @@ |
32 | 32 | $wgHooks['SpecialSearchCreateLink'][] = 'ArticleCreationHooks::SpecialSearchCreateLink'; |
33 | 33 | $wgHooks['EditPage::showEditForm:fields'][] = 'ArticleCreationHooks::pushTrackingFieldsToEdit'; |
34 | 34 | $wgHooks['ArticleSaveComplete'][] = 'ArticleCreationHooks::trackEditSuccess'; |
| 35 | +$wgHooks['EditPage::attemptSave'][] = 'ArticleCreationHooks::trackEditAttempt'; |
35 | 36 | |
36 | 37 | $wgHooks['ResourceLoaderGetConfigVars'][] = 'ArticleCreationHooks::resourceLoaderGetConfigVars'; |
37 | 38 | |
Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.hooks.php |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | * Redirect users to a page specified by returnto upon successful account creation |
8 | 8 | * @param $welcome_creation_msg - string |
9 | 9 | * @param $injected_html - html string |
| 10 | + * @return bool |
10 | 11 | */ |
11 | 12 | public static function BeforeWelcomeCreation( &$welcome_creation_msg, &$injected_html ) { |
12 | 13 | global $wgRequest, $wgOut; |
— | — | @@ -26,7 +27,8 @@ |
27 | 28 | |
28 | 29 | /** |
29 | 30 | * If the edit page is coming from red link, redirect users to article-non-existing page |
30 | | - * @param $editPage - Object |
| 31 | + * @param $editPage EditPage |
| 32 | + * @return bool |
31 | 33 | */ |
32 | 34 | public static function AlternateEdit( $editPage ) { |
33 | 35 | global $wgRequest, $wgOut; |
— | — | @@ -46,6 +48,8 @@ |
47 | 49 | |
48 | 50 | /** |
49 | 51 | * Customized html that shows an article doesn't exist |
| 52 | + * @param $article Article |
| 53 | + * @return bool |
50 | 54 | */ |
51 | 55 | public static function BeforeDisplayNoArticleText( $article ) { |
52 | 56 | global $wgOut; |
— | — | @@ -80,6 +84,9 @@ |
81 | 85 | |
82 | 86 | /** |
83 | 87 | * Alter 'Create' Link behavior in search result page |
| 88 | + * @param $title Title |
| 89 | + * @param $params array |
| 90 | + * @return bool |
84 | 91 | */ |
85 | 92 | public static function SpecialSearchCreateLink( $title, &$params ) { |
86 | 93 | global $wgOut, $wgHooks; |
— | — | @@ -109,9 +116,9 @@ |
110 | 117 | |
111 | 118 | return true; |
112 | 119 | } |
113 | | - |
| 120 | + |
114 | 121 | /** |
115 | | - * Tracks successful edits |
| 122 | + * Tracks successful save from article creation workflow |
116 | 123 | * |
117 | 124 | * @see http://www.mediawiki.org/wiki/Manual:Hooks/ArticleSaveComplete |
118 | 125 | * @param $article WikiPage |
— | — | @@ -130,7 +137,30 @@ |
131 | 138 | public static function trackEditSuccess( &$article, &$user, $text, |
132 | 139 | $summary, $minoredit, $watchthis, $sectionanchor, &$flags, |
133 | 140 | $revision, &$status, $baseRevId /*, &$redirect */ ) { // $redirect not passed in 1.18wmf1 |
134 | | - ArticleCreationUtil::trackCompleteSave( $article->getTitle() ); |
| 141 | + |
| 142 | + global $wgRequest; |
| 143 | + |
| 144 | + if ( $wgRequest->getVal( 'fromacw' ) ) { |
| 145 | + ArticleCreationUtil::clickTracking( 'created-from-article-creation', $article->getTitle() ); |
| 146 | + } |
| 147 | + |
135 | 148 | return true; |
136 | 149 | } |
| 150 | + |
| 151 | + /** |
| 152 | + * Tracks save attempt from article creation workflow |
| 153 | + * |
| 154 | + * @see http://www.mediawiki.org/wiki/Manual:Hooks/EditPage::attemptSave |
| 155 | + * @param $editpage EditPage |
| 156 | + * @return bool |
| 157 | + */ |
| 158 | + public static function trackEditAttempt( $editpage ) { |
| 159 | + global $wgRequest; |
| 160 | + |
| 161 | + if ( $wgRequest->getVal( 'fromacw' ) ) { |
| 162 | + ArticleCreationUtil::clickTracking( 'attempt-save-from-article-creation', $editpage->getArticle()->getTitle() ); |
| 163 | + } |
| 164 | + |
| 165 | + return true; |
| 166 | + } |
137 | 167 | } |