r37496 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r37495‎ | r37496 | r37497 >
Date:13:24, 10 July 2008
Author:btongminh
Status:old
Tags:
Comment:
* Consistent use of capitalization
* Add documentation
Modified paths:
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -1699,7 +1699,7 @@
17001700 * @ingroup FileRepo
17011701 */
17021702 class LocalFileMoveBatch {
1703 - var $file, $cur, $olds, $oldcount, $archive, $target, $db;
 1703+ var $file, $cur, $olds, $oldCount, $archive, $target, $db;
17041704
17051705 function __construct( File $file, Title $target ) {
17061706 $this->file = $file;
@@ -1713,14 +1713,20 @@
17141714 $this->db = $file->repo->getMasterDb();
17151715 }
17161716
 1717+ /*
 1718+ * Add the current image to the batch
 1719+ */
17171720 function addCurrent() {
17181721 $this->cur = array( $this->oldRel, $this->newRel );
17191722 }
17201723
 1724+ /*
 1725+ * Add the old versions of the image to the batch
 1726+ */
17211727 function addOlds() {
17221728 $archiveBase = 'archive';
17231729 $this->olds = array();
1724 - $this->oldcount = 0;
 1730+ $this->oldCount = 0;
17251731
17261732 $result = $this->db->select( 'oldimage',
17271733 array( 'oi_archive_name', 'oi_deleted' ),
@@ -1728,10 +1734,10 @@
17291735 __METHOD__
17301736 );
17311737 while( $row = $this->db->fetchObject( $result ) ) {
1732 - $oldname = $row->oi_archive_name;
1733 - $bits = explode( '!', $oldname, 2 );
 1738+ $oldName = $row->oi_archive_name;
 1739+ $bits = explode( '!', $oldName, 2 );
17341740 if( count( $bits ) != 2 ) {
1735 - wfDebug( 'Invalid old file name: ' . $oldname );
 1741+ wfDebug( 'Invalid old file name: ' . $oldName );
17361742 continue;
17371743 }
17381744 list( $timestamp, $filename ) = $bits;
@@ -1739,8 +1745,8 @@
17401746 wfDebug( 'Invalid old file name:' . $oldName );
17411747 continue;
17421748 }
1743 - $this->oldcount++;
1744 - // Do we want to add those to oldcount?
 1749+ $this->oldCount++;
 1750+ // Do we want to add those to oldCount?
17451751 if( $row->oi_deleted & File::DELETED_FILE ) {
17461752 continue;
17471753 }
@@ -1752,6 +1758,9 @@
17531759 $this->db->freeResult( $result );
17541760 }
17551761
 1762+ /*
 1763+ * Perform the move.
 1764+ */
17561765 function execute() {
17571766 $repo = $this->file->repo;
17581767 $status = $repo->newGood();
@@ -1770,6 +1779,10 @@
17711780 return $status;
17721781 }
17731782
 1783+ /*
 1784+ * Do the database updates and return a new WikiError indicating how many
 1785+ * rows where updated.
 1786+ */
17741787 function doDBUpdates() {
17751788 $repo = $this->file->repo;
17761789 $status = $repo->newGood();
@@ -1799,14 +1812,16 @@
18001813 __METHOD__
18011814 );
18021815 $affected = $dbw->affectedRows();
1803 - $total = $this->oldcount;
 1816+ $total = $this->oldCount;
18041817 $status->successCount += $affected;
18051818 $status->failCount += $total - $affected;
18061819
18071820 return $status;
18081821 }
18091822
1810 - // Generates triplets for FSRepo::storeBatch()
 1823+ /*
 1824+ * Generate triplets for FSRepo::storeBatch().
 1825+ */
18111826 function getMoveTriplets() {
18121827 $moves = array_merge( array( $this->cur ), $this->olds );
18131828 $triplets = array(); // The format is: (srcUrl, destZone, destUrl)

Status & tagging log