Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php |
— | — | @@ -56,25 +56,26 @@ |
57 | 57 | ); |
58 | 58 | |
59 | 59 | foreach ( $fields as $field ) { |
60 | | - if ( $field->afi_bucket_id != $bucket ) { |
| 60 | + $field_name = $field->afi_name; |
| 61 | + if ( $field['afi_bucket_id'] != $bucket ) { |
61 | 62 | continue; |
62 | 63 | } |
63 | | - if ( isset( $params[$field->afi_name] ) ) { |
64 | | - $value = $params[$field->afi_name]; |
65 | | - $type = $field->afi_data_type; |
| 64 | + if ( isset( $params[$field['afi_name']] ) ) { |
| 65 | + $value = $params[$field_name]; |
| 66 | + $type = $field['afi_data_type']; |
66 | 67 | if ( $value === '' ) { |
67 | 68 | continue; |
68 | 69 | } |
69 | | - if ( $this->validateParam( $value, $type, $field->afi_id ) ) { |
| 70 | + if ( $this->validateParam( $value, $type, $field['afi_id'] ) ) { |
70 | 71 | $data = array( |
71 | 72 | 'aa_feedback_id' => $feedbackId, |
72 | | - 'aa_field_id' => $field->afi_id, |
| 73 | + 'aa_field_id' => $field['afi_id'], |
73 | 74 | ); |
74 | 75 | foreach ( array( 'rating', 'text', 'boolean', 'option_id' ) as $t ) { |
75 | 76 | $data["aa_response_$t"] = $t == $type ? $value : null; |
76 | 77 | } |
77 | 78 | $user_answers[] = $data; |
78 | | - $email_data['ratingData'][$field->afi_name] = $value; |
| 79 | + $email_data['ratingData'][$field_name] = $value; |
79 | 80 | } else { |
80 | 81 | $error = 'articlefeedbackv5-error-validation'; |
81 | 82 | } |
— | — | @@ -577,7 +578,7 @@ |
578 | 579 | |
579 | 580 | $fields = ApiArticleFeedbackv5Utils::getFields(); |
580 | 581 | foreach ( $fields as $field ) { |
581 | | - $ret[$field->afi_name] = array( |
| 582 | + $ret[$field['afi_name']] = array( |
582 | 583 | ApiBase::PARAM_TYPE => 'string', |
583 | 584 | ApiBase::PARAM_REQUIRED => false, |
584 | 585 | ApiBase::PARAM_ISMULTI => false, |
— | — | @@ -602,7 +603,7 @@ |
603 | 604 | ); |
604 | 605 | $fields = ApiArticleFeedbackv5Utils::getFields(); |
605 | 606 | foreach ( $fields as $f ) { |
606 | | - $ret[$f->afi_name] = 'Optional feedback field, only appears on certain "buckets".'; |
| 607 | + $ret[$f['afi_name']] = 'Optional feedback field, only appears on certain "buckets".'; |
607 | 608 | } |
608 | 609 | return $ret; |
609 | 610 | } |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -57,12 +57,14 @@ |
58 | 58 | |
59 | 59 | $where['af_page_id'] = $pageId; |
60 | 60 | |
61 | | - // TODO: Not this. |
62 | | - return $dbr->selectField( |
63 | | - array( 'aft_article_feedback' ), |
64 | | - array( 'COUNT(*) AS count' ), |
65 | | - $where |
66 | | - ); |
| 61 | + # Until this is done properly, just don't do anything. |
| 62 | + return 0; |
| 63 | + |
| 64 | +# return $dbr->selectField( |
| 65 | +# array( 'aft_article_feedback' ), |
| 66 | +# array( 'COUNT(*) AS count' ), |
| 67 | +# $where |
| 68 | +# ); |
67 | 69 | } |
68 | 70 | |
69 | 71 | public function fetchFeedback( $pageId, |
— | — | @@ -184,11 +186,10 @@ |
185 | 187 | } |
186 | 188 | $rv .= "<p>" |
187 | 189 | .wfMessage( 'articlefeedbackv5-form-optionid', $record[0]->af_bucket_id )->escaped() |
188 | | - ." | " |
| 190 | + .'</a> '.wfMessage( 'pipe-separator' )->escaped() |
189 | 191 | ."<a href='#' class='aft5-hide-link' id='aft5-hide-link-$id'>" |
190 | 192 | .wfMessage( 'articlefeedbackv5-form-hide', $record[0]->af_hide_count )->escaped() |
191 | | - .'</a> | ' |
192 | | -//204 |
| 193 | + .'</a>'.wfMessage( 'pipe-separator' )->escaped() |
193 | 194 | ."<a href='#' class='aft5-abuse-link' id='aft5-abuse-link-$id'>" |
194 | 195 | .wfMessage( 'articlefeedbackv5-form-abuse', $record[0]->af_abuse_count )->escaped() |
195 | 196 | ."</a></p></div><hr>"; |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5Utils.php |
— | — | @@ -79,8 +79,9 @@ |
80 | 80 | if( $cached != '' ) { |
81 | 81 | return $cached; |
82 | 82 | } else { |
83 | | - $dbr = wfGetDB( DB_SLAVE ); |
84 | | - $rv = $dbr->select( |
| 83 | + $rv = array(); |
| 84 | + $dbr = wfGetDB( DB_SLAVE ); |
| 85 | + $rows = $dbr->select( |
85 | 86 | 'aft_article_field', |
86 | 87 | array( |
87 | 88 | 'afi_name', |
— | — | @@ -91,6 +92,16 @@ |
92 | 93 | null, |
93 | 94 | __METHOD__ |
94 | 95 | ); |
| 96 | + |
| 97 | + foreach( $rows as $row ) { |
| 98 | + $rv[] = array( |
| 99 | + 'afi_name' => $row->afi_name, |
| 100 | + 'afi_id' => $row->afi_id, |
| 101 | + 'afi_data_type' => $row->afi_data_type, |
| 102 | + 'afi_bucket_id' => $row->afi_bucket_id |
| 103 | + ); |
| 104 | + } |
| 105 | + |
95 | 106 | // An hour? That might be reasonable for a cache time. |
96 | 107 | $wgMemc->set( $key, $rv, 60 * 60 ); |
97 | 108 | } |