RevDelArchiveList.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License along
  14. * with this program; if not, write to the Free Software Foundation, Inc.,
  15. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. * http://www.gnu.org/copyleft/gpl.html
  17. *
  18. * @file
  19. * @ingroup RevisionDelete
  20. */
  21. use Wikimedia\Rdbms\IDatabase;
  22. /**
  23. * List for archive table items, i.e. revisions deleted via action=delete
  24. */
  25. class RevDelArchiveList extends RevDelRevisionList {
  26. public function getType() {
  27. return 'archive';
  28. }
  29. public static function getRelationType() {
  30. return 'ar_timestamp';
  31. }
  32. /**
  33. * @param IDatabase $db
  34. * @return mixed
  35. */
  36. public function doQuery( $db ) {
  37. $timestamps = [];
  38. foreach ( $this->ids as $id ) {
  39. $timestamps[] = $db->timestamp( $id );
  40. }
  41. $arQuery = Revision::getArchiveQueryInfo();
  42. $tables = $arQuery['tables'];
  43. $fields = $arQuery['fields'];
  44. $conds = [
  45. 'ar_namespace' => $this->title->getNamespace(),
  46. 'ar_title' => $this->title->getDBkey(),
  47. 'ar_timestamp' => $timestamps,
  48. ];
  49. $join_conds = $arQuery['joins'];
  50. $options = [ 'ORDER BY' => 'ar_timestamp DESC' ];
  51. ChangeTags::modifyDisplayQuery(
  52. $tables,
  53. $fields,
  54. $conds,
  55. $join_conds,
  56. $options,
  57. ''
  58. );
  59. return $db->select( $tables,
  60. $fields,
  61. $conds,
  62. __METHOD__,
  63. $options,
  64. $join_conds
  65. );
  66. }
  67. public function newItem( $row ) {
  68. return new RevDelArchiveItem( $this, $row );
  69. }
  70. public function doPreCommitUpdates() {
  71. return Status::newGood();
  72. }
  73. public function doPostCommitUpdates( array $visibilityChangeMap ) {
  74. return Status::newGood();
  75. }
  76. }