Index: trunk/phase3/includes/filerepo/LocalFile.php |
— | — | @@ -1699,7 +1699,7 @@ |
1700 | 1700 | * @ingroup FileRepo |
1701 | 1701 | */ |
1702 | 1702 | class LocalFileMoveBatch { |
1703 | | - var $file, $cur, $olds, $oldcount, $archive, $target, $db; |
| 1703 | + var $file, $cur, $olds, $oldCount, $archive, $target, $db; |
1704 | 1704 | |
1705 | 1705 | function __construct( File $file, Title $target ) { |
1706 | 1706 | $this->file = $file; |
— | — | @@ -1713,14 +1713,20 @@ |
1714 | 1714 | $this->db = $file->repo->getMasterDb(); |
1715 | 1715 | } |
1716 | 1716 | |
| 1717 | + /* |
| 1718 | + * Add the current image to the batch |
| 1719 | + */ |
1717 | 1720 | function addCurrent() { |
1718 | 1721 | $this->cur = array( $this->oldRel, $this->newRel ); |
1719 | 1722 | } |
1720 | 1723 | |
| 1724 | + /* |
| 1725 | + * Add the old versions of the image to the batch |
| 1726 | + */ |
1721 | 1727 | function addOlds() { |
1722 | 1728 | $archiveBase = 'archive'; |
1723 | 1729 | $this->olds = array(); |
1724 | | - $this->oldcount = 0; |
| 1730 | + $this->oldCount = 0; |
1725 | 1731 | |
1726 | 1732 | $result = $this->db->select( 'oldimage', |
1727 | 1733 | array( 'oi_archive_name', 'oi_deleted' ), |
— | — | @@ -1728,10 +1734,10 @@ |
1729 | 1735 | __METHOD__ |
1730 | 1736 | ); |
1731 | 1737 | 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 ); |
1734 | 1740 | if( count( $bits ) != 2 ) { |
1735 | | - wfDebug( 'Invalid old file name: ' . $oldname ); |
| 1741 | + wfDebug( 'Invalid old file name: ' . $oldName ); |
1736 | 1742 | continue; |
1737 | 1743 | } |
1738 | 1744 | list( $timestamp, $filename ) = $bits; |
— | — | @@ -1739,8 +1745,8 @@ |
1740 | 1746 | wfDebug( 'Invalid old file name:' . $oldName ); |
1741 | 1747 | continue; |
1742 | 1748 | } |
1743 | | - $this->oldcount++; |
1744 | | - // Do we want to add those to oldcount? |
| 1749 | + $this->oldCount++; |
| 1750 | + // Do we want to add those to oldCount? |
1745 | 1751 | if( $row->oi_deleted & File::DELETED_FILE ) { |
1746 | 1752 | continue; |
1747 | 1753 | } |
— | — | @@ -1752,6 +1758,9 @@ |
1753 | 1759 | $this->db->freeResult( $result ); |
1754 | 1760 | } |
1755 | 1761 | |
| 1762 | + /* |
| 1763 | + * Perform the move. |
| 1764 | + */ |
1756 | 1765 | function execute() { |
1757 | 1766 | $repo = $this->file->repo; |
1758 | 1767 | $status = $repo->newGood(); |
— | — | @@ -1770,6 +1779,10 @@ |
1771 | 1780 | return $status; |
1772 | 1781 | } |
1773 | 1782 | |
| 1783 | + /* |
| 1784 | + * Do the database updates and return a new WikiError indicating how many |
| 1785 | + * rows where updated. |
| 1786 | + */ |
1774 | 1787 | function doDBUpdates() { |
1775 | 1788 | $repo = $this->file->repo; |
1776 | 1789 | $status = $repo->newGood(); |
— | — | @@ -1799,14 +1812,16 @@ |
1800 | 1813 | __METHOD__ |
1801 | 1814 | ); |
1802 | 1815 | $affected = $dbw->affectedRows(); |
1803 | | - $total = $this->oldcount; |
| 1816 | + $total = $this->oldCount; |
1804 | 1817 | $status->successCount += $affected; |
1805 | 1818 | $status->failCount += $total - $affected; |
1806 | 1819 | |
1807 | 1820 | return $status; |
1808 | 1821 | } |
1809 | 1822 | |
1810 | | - // Generates triplets for FSRepo::storeBatch() |
| 1823 | + /* |
| 1824 | + * Generate triplets for FSRepo::storeBatch(). |
| 1825 | + */ |
1811 | 1826 | function getMoveTriplets() { |
1812 | 1827 | $moves = array_merge( array( $this->cur ), $this->olds ); |
1813 | 1828 | $triplets = array(); // The format is: (srcUrl, destZone, destUrl) |