summaryrefslogtreecommitdiffstats
PHPBB3-11495
-rw-r--r--phpBB/includes/nestedset/base.php28
-rw-r--r--phpBB/includes/nestedset/exception.php20
-rw-r--r9 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
#!/usr/bin/perl
#
# Main author Pascal Rigaux (pixel@mandriva.com)
# Put together by Guillaume Cottenceau
#
# Copyright 1999-2005 Mandriva
#
# 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.
#
#
# Detects partition types using signatures
#

use lib qw(/usr/lib/libDrakX);
use common;
use fs::type;
use fs::proc_partitions;

my $params = join '', @ARGV;
my $verbose = $params =~ /-v/;

$params =~ /-h/ and die "usage: lsparts [-v]\n";


foreach (fs::proc_partitions::read_raw()) {
    if (my $err = $_->{size} <= 1 ?
	"Skipping <$_->{dev}> because too little blocks ($_->{size})" :
	  $_->{dev} !~ /\d$/ ?
	"Skipping <$_->{dev}> because doesn't end with a number (e.g. seems to not be a partition)" :
	  $_->{dev} =~ /^loop\d+$/ ?
	"Skipping <$_->{dev}>" :
	  '') {
	print STDERR "$err\n" if $verbose;
    } else {
	$_->{device} = $_->{dev};
	if (my $type = fs::type::type_subpart_from_magic($_)) {
	    printf "$_->{dev}: %6s, fs %s (%s)\n", formatXiB($_->{size} * 512), $type->{fs_type}, fs::type::part2type_name($type);
	}
    }
}
class='ctx'> }
$item_data = $this->get_children_branch_data($current_parent_id);
if (!isset($item_data[$current_parent_id]))
{
$this->lock->release();
- throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_ITEM');
+ throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
}
$current_parent = $item_data[$current_parent_id];
@@ -319,7 +319,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface
if (in_array($new_parent_id, $move_items))
{
$this->lock->release();
- throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_PARENT');
+ throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
}
$diff = sizeof($move_items) * 2;
@@ -343,7 +343,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface
{
$this->db->sql_transaction('rollback');
$this->lock->release();
- throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_PARENT');
+ throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
}
$new_right_id = $this->prepare_adding_subset($move_items, $new_parent, true);
@@ -400,19 +400,19 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface
if (!$item_id)
{
- throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_ITEM');
+ throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
}
if (!$this->lock->acquire())
{
- throw new phpbb_nestedset_exception($this->message_prefix . 'LOCK_FAILED_ACQUIRE');
+ throw new RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE');
}
$item_data = $this->get_children_branch_data($item_id);
if (!isset($item_data[$item_id]))
{
$this->lock->release();
- throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_ITEM');
+ throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
}
$item = $item_data[$item_id];
@@ -421,7 +421,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface
if (in_array($new_parent_id, $move_items))
{
$this->lock->release();
- throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_PARENT');
+ throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
}
$diff = sizeof($move_items) * 2;
@@ -445,7 +445,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface
{
$this->db->sql_transaction('rollback');
$this->lock->release();
- throw new phpbb_nestedset_exception($this->message_prefix . 'INVALID_PARENT');
+ throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
}
$new_right_id = $this->prepare_adding_subset($move_items, $new_parent, true);
@@ -612,7 +612,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface
{
if (!$table_already_locked && !$this->lock->acquire())
{
- throw new phpbb_nestedset_exception($this->message_prefix . 'LOCK_FAILED_ACQUIRE');
+ throw new RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE');
}
$diff = sizeof($subset_items) * 2;
@@ -702,7 +702,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface
{
if (!$this->lock->acquire())
{
- throw new phpbb_nestedset_exception($this->message_prefix . 'LOCK_FAILED_ACQUIRE');
+ throw new RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE');
}
$this->db->sql_transaction('begin');
diff --git a/phpBB/includes/nestedset/exception.php b/phpBB/includes/nestedset/exception.php
deleted file mode 100644
index 10937d0b29..0000000000
--- a/phpBB/includes/nestedset/exception.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/**
-*
-* @package Nested Set
-* @copyright (c) 2013 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-class phpbb_nestedset_exception extends \Exception
-{
-}
diff --git a/tests/nestedset/set_forum_move_test.php b/tests/nestedset/set_forum_move_test.php
index 166fe666f2..90fc1c5468 100644
--- a/tests/nestedset/set_forum_move_test.php
+++ b/tests/nestedset/set_forum_move_test.php
@@ -383,7 +383,7 @@ class phpbb_tests_nestedset_set_forum_move_test extends phpbb_tests_nestedset_se
/**
* @dataProvider move_children_throws_item_data
*
- * @expectedException phpbb_nestedset_exception
+ * @expectedException OutOfBoundsException
* @expectedExceptionMessage FORUM_NESTEDSET_INVALID_ITEM
*/
public function test_move_children_throws_item($explain, $forum_id, $target_id)
@@ -403,7 +403,7 @@ class phpbb_tests_nestedset_set_forum_move_test extends phpbb_tests_nestedset_se
/**
* @dataProvider move_children_throws_parent_data
*
- * @expectedException phpbb_nestedset_exception
+ * @expectedException OutOfBoundsException
* @expectedExceptionMessage FORUM_NESTEDSET_INVALID_PARENT
*/
public function test_move_children_throws_parent($explain, $forum_id, $target_id)
@@ -539,7 +539,7 @@ class phpbb_tests_nestedset_set_forum_move_test extends phpbb_tests_nestedset_se
/**
* @dataProvider change_parent_throws_item_data
*
- * @expectedException phpbb_nestedset_exception
+ * @expectedException OutOfBoundsException
* @expectedExceptionMessage FORUM_NESTEDSET_INVALID_ITEM
*/
public function test_change_parent_throws_item($explain, $forum_id, $target_id)
@@ -559,7 +559,7 @@ class phpbb_tests_nestedset_set_forum_move_test extends phpbb_tests_nestedset_se
/**
* @dataProvider change_parent_throws_parent_data
*
- * @expectedException phpbb_nestedset_exception
+ * @expectedException OutOfBoundsException
* @expectedExceptionMessage FORUM_NESTEDSET_INVALID_PARENT
*/
public function test_change_parent_throws_parent($explain, $forum_id, $target_id)