Merge "Added a separate error message for mkdir failures"
[lhc/web/wiklou.git] / includes / revisiondelete / RevDelArchiveList.php
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
22 use Wikimedia\Rdbms\IDatabase;
23
24 /**
25 * List for archive table items, i.e. revisions deleted via action=delete
26 */
27 class RevDelArchiveList extends RevDelRevisionList {
28 public function getType() {
29 return 'archive';
30 }
31
32 public static function getRelationType() {
33 return 'ar_timestamp';
34 }
35
36 /**
37 * @param IDatabase $db
38 * @return mixed
39 */
40 public function doQuery( $db ) {
41 $timestamps = [];
42 foreach ( $this->ids as $id ) {
43 $timestamps[] = $db->timestamp( $id );
44 }
45
46 $tables = [ 'archive' ];
47 $fields = Revision::selectArchiveFields();
48 $conds = [
49 'ar_namespace' => $this->title->getNamespace(),
50 'ar_title' => $this->title->getDBkey(),
51 'ar_timestamp' => $timestamps,
52 ];
53 $join_conds = [];
54 $options = [ 'ORDER BY' => 'ar_timestamp DESC' ];
55
56 ChangeTags::modifyDisplayQuery(
57 $tables,
58 $fields,
59 $conds,
60 $join_conds,
61 $options,
62 ''
63 );
64
65 return $db->select( $tables,
66 $fields,
67 $conds,
68 __METHOD__,
69 $options,
70 $join_conds
71 );
72 }
73
74 public function newItem( $row ) {
75 return new RevDelArchiveItem( $this, $row );
76 }
77
78 public function doPreCommitUpdates() {
79 return Status::newGood();
80 }
81
82 public function doPostCommitUpdates( array $visibilityChangeMap ) {
83 return Status::newGood();
84 }
85 }