#!/usr/bin/perl # # Guillaume Cottenceau (gc@mandrakesoft.com) # # Copyright 2001 MandrakeSoft # # This software may be freely redistributed under the terms of the GNU # public license. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = ; wantarray ? @l : join '', @l } sub chomp_ { my @l = map { my $l = $_; chomp $l; $l } @_; wantarray ? @l : $l[0] } my @mounts = cat_('/proc/mounts'); grep { (split)[1] =~ m|^/mnt$| } @mounts and print("/mnt is already mounted (according to /proc/mounts)\n"), exit 0; system('drvinst'); #- class2text seems broken, I can't detect easily only modules for SCSI storage :-( print "\nPlease wait, trying to find your root device...\n"; my $target = '/mnt'; -d $target || mkdir($target) or die "couldn't create $target\n"; my (undef, undef, @parts) = cat_('/proc/partitions'); my @fstab; my $root; M: foreach (@parts) { my $dev = (split)[3] or next; $dev = "/dev/$dev"; for my $fs ('ext3', 'ext2', 'reiserfs', 'xfs', 'jfs') { my $where = $target; if (!system("mount -t $fs $dev $where 2>/dev/null")) { if (-r "$where/etc/fstab" && -r "$where/etc/mandrake-release") { print "=> found a Mandrake root partition on $dev\n=> type $fs, version `", chomp_(cat_ "$where/etc/mandrake-release"), "'\n"; @fstab = cat_("$where/etc/fstab"); $root = $dev; last M; } else { system('umount', $where) and die "error unmounting $where\n"; } last; } } } if ($root) { print "\nMounting other partitions from fstab on $target...\n"; foreach (@fstab) { next if /^\s*#/; my ($dev, $where, $type, $opts) = split; next if (!$type || $dev eq 'none' || $opts =~ /noauto/ || $type =~ /^(supermount|swap|nfs)$/ || $where eq '/' || $where =~ m,proc|cdrom|floppy|/mnt/zip, ); $opts = join(',', grep { !/codepage=/ && !/iocharset/ } split(',', $opts)); #- vfat opts, we don't have the modules in rescue $where = "$target$where"; -d $where || mkdir($where) or die "couldn't create $where\n"; print "\t$dev on $where type $type\n"; system("mount -t $type $dev $where -o $opts"); } print "\nYour system is ready on $target.\n\n"; } else { die "Could not find your root device :-(.\n"; } #------------------------------------------------- #- $Log$ #- Revision 1.5 2001/11/05 17:03:54 gc #- honours hash in /etc/fstab to disable lines #- #- Revision 1.4 2001/10/24 22:34:01 gc #- - add a GUI to the rescue #- - provide guessmounts with better efficiency and output, go to console, and reboot #- - provide install_bootloader which runs lilo from /mnt if it seems safe #- - add lsparts to rescue, which prints partitions with detected types #- #- Revision 1.3 2001/09/07 18:22:54 gc #- ext3, xfs, jfs #- #- Revision 1.2 2001/06/10 22:41:21 prigaux #- pixelization (tested!) #- #- Revision 1.1 2001/06/10 21:08:33 gc #- - add 'guessmounts' that mimics RH's detecting of partitions when rescue starts #- #- 751ab73dc2b7650'>v310/softdelete_p2.php
blob: 849a996c1b3d715e49b4f1ec245af55d1c1249e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/

namespace phpbb\db\migration\data\v310;

class softdelete_p2 extends \phpbb\db\migration\migration
{
	public function effectively_installed()
	{
		return !$this->db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_approved');
	}

	static public function depends_on()
	{
		return array(
			'\phpbb\db\migration\data\v310\dev',
			'\phpbb\db\migration\data\v310\softdelete_p1',
		);
	}

	public function update_schema()
	{
		return array(
			'drop_columns'		=> array(
				$this->table_prefix . 'forums'			=> array('forum_posts', 'forum_topics', 'forum_topics_real'),
				$this->table_prefix . 'posts'			=> array('post_approved'),
				$this->table_prefix . 'topics'			=> array('topic_approved', 'topic_replies', 'topic_replies_real'),
			),
			'drop_keys'		=> array(
				$this->table_prefix . 'posts'			=> array('post_approved'),
				$this->table_prefix . 'topics'			=> array(
					'forum_appr_last',
					'topic_approved',
				),
			),
		);
	}

	public function revert_schema()
	{
		return array(
			'add_columns'		=> array(
				$this->table_prefix . 'forums'			=> array(
					'forum_posts'			=> array('UINT', 0),
					'forum_topics'			=> array('UINT', 0),
					'forum_topics_real'		=> array('UINT', 0),
				),
				$this->table_prefix . 'posts'			=> array(
					'post_approved'			=> array('BOOL', 1),
				),
				$this->table_prefix . 'topics'		=> array(
					'topic_approved'			=> array('BOOL', 1),
					'topic_replies'				=> array('UINT', 0),
					'topic_replies_real'		=> array('UINT', 0),
				),
			),
			'add_index'		=> array(
				$this->table_prefix . 'posts'			=> array(
					'post_approved'		=> array('post_approved'),
				),
				$this->table_prefix . 'topics'		=> array(
					'forum_appr_last'	=> array('forum_id', 'topic_approved', 'topic_last_post_id'),
					'topic_approved'	=> array('topic_approved'),
				),
			),
		);
	}
}