r105836 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105835‎ | r105836 | r105837 >
Date:22:54, 11 December 2011
Author:yuvipanda
Status:deferred
Tags:
Comment:
Properly record timestamps
Modified paths:
  • /trunk/extensions/SelectionSifter/AssessmentsExtractor.php (modified) (history)
  • /trunk/extensions/SelectionSifter/SelectionSifter.hooks.php (modified) (history)
  • /trunk/extensions/SelectionSifter/models/Log.php (modified) (history)
  • /trunk/extensions/SelectionSifter/models/Rating.php (modified) (history)
  • /trunk/extensions/SelectionSifter/schema/log.sql (modified) (history)
  • /trunk/extensions/SelectionSifter/schema/ratings.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/SelectionSifter/schema/log.sql
@@ -26,7 +26,7 @@
2727 l_new varchar(63),
2828 -- new value (e.g. GA-Class)
2929
30 - l_revision_timestamp binary(20) not null,
 30+ l_revision_timestamp binary(14) not null,
3131 -- timestamp when page was edited
3232 -- a wiki-format timestamp
3333
Index: trunk/extensions/SelectionSifter/schema/ratings.sql
@@ -17,7 +17,7 @@
1818 r_quality varchar(63),
1919 -- quality rating
2020
21 - r_quality_timestamp binary(20),
 21+ r_quality_timestamp binary(14),
2222 -- time when quality rating was assigned
2323 -- NOTE: a revid can be obtained from timestamp via API
2424 -- a wiki-format timestamp
@@ -25,7 +25,7 @@
2626 r_importance varchar(63),
2727 -- importance rating
2828
29 - r_importance_timestamp binary(20),
 29+ r_importance_timestamp binary(14),
3030 -- time when importance rating was assigned
3131 -- a wiki-style timestamp
3232
Index: trunk/extensions/SelectionSifter/models/Log.php
@@ -4,7 +4,7 @@
55 * Represents an convenience methods for logging
66 **/
77 class AssessmentChangeLog {
8 - public static function makeEntry( $project, $namespace, $article, $timestamp, $action, $old, $new ) {
 8+ public static function makeEntry( $project, $namespace, $article, $timestamp, $action, $old, $new, $revision_timestamp ) {
99 $dbw = wfGetDB( DB_MASTER );
1010 $dbw->insert(
1111 'assessment_changelog',
@@ -16,7 +16,7 @@
1717 'l_timestamp' => $timestamp,
1818 'l_old' => $old,
1919 'l_new' => $new,
20 - 'l_revision_timestamp' => 0
 20+ 'l_revision_timestamp' => $revision_timestamp
2121 ),
2222 __METHOD__
2323 );
Index: trunk/extensions/SelectionSifter/models/Rating.php
@@ -50,7 +50,8 @@
5151 $timestamp,
5252 "quality",
5353 $this->old_quality,
54 - $this->quality
 54+ $this->quality,
 55+ $timestamp
5556 );
5657 }
5758 if( strpos( $logAction, 'i' ) !== false ) {
@@ -61,7 +62,8 @@
6263 $timestamp,
6364 "importance",
6465 $this->old_importance,
65 - $this->importance
 66+ $this->importance,
 67+ $timestamp
6668 );
6769 }
6870
Index: trunk/extensions/SelectionSifter/AssessmentsExtractor.php
@@ -17,7 +17,7 @@
1818 }
1919
2020 /**
21 - * Once AssessmentsExtractor is build, call this method to generate
 21+ * Once AssessmentsExtractor is built, call this method to generate
2222 * an array of assessment.
2323 * @todo Describe the returned array
2424 * @todo What happens if the preparedText does not match the expected format?
Index: trunk/extensions/SelectionSifter/SelectionSifter.hooks.php
@@ -20,20 +20,19 @@
2121 foreach ( $assessments as $project => $assessment ) {
2222 $curRating = $ratings[$project];
2323 if( $curRating ) {
24 - $curRating->update( $assessment['importance'], $assessment['quality'], 0 );
 24+ $curRating->update( $assessment['importance'], $assessment['quality'], $timestamp );
2525 } else {
2626 $rating = new Rating(
2727 $project,
2828 $main_title->getNamespace(),
2929 $main_title->getText(),
3030 $assessment['quality'],
31 - 0,
 31+ $timestamp,
3232 $assessment['importance'],
33 - 0
 33+ $timestamp
3434 );
3535 $rating->saveAll();
3636
37 - $timestamp = wfTimestamp( TS_MW );
3837 if( isset( $assessment['quality'] ) ) {
3938 AssessmentChangeLog::makeEntry(
4039 $project,
@@ -42,7 +41,8 @@
4342 $timestamp,
4443 "quality",
4544 "",
46 - $assessment['quality']
 45+ $assessment['quality'],
 46+ $timestamp
4747 );
4848 }
4949 if( isset( $assessment['importance'] ) ) {
@@ -53,7 +53,8 @@
5454 $timestamp,
5555 "importance",
5656 "",
57 - $assessment['importance']
 57+ $assessment['importance'],
 58+ $timestamp
5859 );
5960 }
6061 }
@@ -73,7 +74,7 @@
7475 $preparedText = $article->prepareTextForEdit( $text )->output->getText();
7576 $extractor = new AssessmentsExtractor( $preparedText );
7677 $assessments = $extractor->extractAssessments();
77 - SelectionSifterHooks::updateDatabase( $title, $assessments, $revision );
 78+ SelectionSifterHooks::updateDatabase( $title, $assessments, wfTimestamp( TS_MW, $revision->getTimestamp() ) );
7879 }
7980 return true;
8081 }

Status & tagging log