aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/permissions.php
diff options
context:
space:
mode:
authorlavigor <lavigor@users.noreply.github.com>2016-02-07 16:50:17 +0300
committerlavigor <lavigor@users.noreply.github.com>2016-02-07 16:50:17 +0300
commit3479f950906dce340ab63b0d310ea8ba8fc02b97 (patch)
treef2fc3a1114cc986f502dc4bfb2563179be140af5 /phpBB/phpbb/permissions.php
parent8a2f564f3db0e857f382f0d0d9eb1c5281c14ec9 (diff)
downloadforums-3479f950906dce340ab63b0d310ea8ba8fc02b97.tar
forums-3479f950906dce340ab63b0d310ea8ba8fc02b97.tar.gz
forums-3479f950906dce340ab63b0d310ea8ba8fc02b97.tar.bz2
forums-3479f950906dce340ab63b0d310ea8ba8fc02b97.tar.xz
forums-3479f950906dce340ab63b0d310ea8ba8fc02b97.zip
[ticket/14466] Add an event to cron.php
PHPBB3-14466
Diffstat (limited to 'phpBB/phpbb/permissions.php')
0 files changed, 0 insertions, 0 deletions
' href='#n10'>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 79 80 81
package fs::partitioning; # $Id: partitioning.pm 243679 2008-07-29 11:55:58Z tv $

use diagnostics;
use strict;

use common;
use fs::format;
use fs::type;

sub guess_partitions_to_format {
    my ($fstab) = @_;
    foreach (@$fstab) {
	$_->{mntpoint} = "swap" if isSwap($_);
	$_->{mntpoint} or next;

	add2hash_($_, { toFormat => $_->{notFormatted} }) if $_->{fs_type}; #- eg: do not set toFormat for isRawRAID (0xfd)
        $_->{toFormatUnsure} ||= member($_->{mntpoint}, '/', '/usr');

	if (!$_->{toFormat}) {
	    my $fs_type = fs::type::fs_type_from_magic($_);
	    if (!$fs_type || $fs_type ne $_->{fs_type}) {
		log::l("setting toFormatUnsure for $_->{device} because <$_->{fs_type}> ne <$fs_type>");
		$_->{toFormatUnsure} = 1;
	    }
	}
    }
}

sub choose_partitions_to_format {
    my ($in, $fstab) = @_;

    guess_partitions_to_format($fstab);

    my @l = grep { !$_->{isMounted} && $_->{mntpoint} && !isSwap($_) &&
		   (!isFat_or_NTFS($_) || $_->{notFormatted}) &&
		   (!isOtherAvailableFS($_) || $_->{toFormat});
	       } @$fstab;
    $_->{toFormat} = 1 foreach grep { isSwap($_) } @$fstab;

    return if @l == 0 || every { $_->{toFormat} } @l;

    #- keep it temporary until the guy has accepted
    $_->{toFormatTmp} = $_->{toFormat} || $_->{toFormatUnsure} foreach @l;

    $in->ask_from_(
        { messages => N("Choose the partitions you want to format"),
	  interactive_help_id => 'formatPartitions',
          advanced_messages => N("Check for bad blocks?"),
        },
        [ map { 
	    my $e = $_;
	    ({
	      text => partition_table::description($e), type => 'bool',
	      val => \$e->{toFormatTmp}
	     }, if_(!isLoopback($_) && !member($_->{fs_type}, qw(btrfs jfs reiserfs xfs)), {
	      text => partition_table::description($e), type => 'bool', advanced => 1, 
	      disabled => sub { !$e->{toFormatTmp} },
	      val => \$e->{toFormatCheck}
        })) } @l ]
    ) or die 'already displayed';
    #- ok now we can really set toFormat
    foreach (@l) {
	$_->{toFormat} = delete $_->{toFormatTmp};
	set_isFormatted($_, 0);
    }
}

sub format_mount_partitions {
    my ($in, $all_hds, $fstab) = @_;
    my ($w, $wait_message) = $in->wait_message_with_progress_bar;
    catch_cdie {
        fs::format::formatMount_all($all_hds, $fstab, $wait_message);
    } sub { 
	$@ =~ /fsck failed on (\S+)/ or return;
	$in->ask_yesorno('', N("Failed to check filesystem %s. Do you want to repair the errors? (beware, you can lose data)", $1), 1);
    };
    undef $w; #- help perl (otherwise wait_message stays forever in curses)
    die N("Not enough swap space to fulfill installation, please add some") if availableMemory() < 40 * 1024;
}

1;