aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml1
-rw-r--r--phpBB/download/file.php4
-rw-r--r--phpBB/includes/acp/auth.php5
-rw-r--r--phpBB/includes/functions_acp.php27
-rw-r--r--phpBB/includes/functions_posting.php13
-rw-r--r--phpBB/includes/mcp/mcp_main.php28
-rw-r--r--phpBB/install/database_update.php4
-rw-r--r--phpBB/install/index.php4
-rw-r--r--phpBB/install/install_update.php8
-rw-r--r--phpBB/phpbb/config_php_file.php39
-rw-r--r--phpBB/phpbb/content_visibility.php69
-rw-r--r--phpBB/phpbb/controller/resolver.php18
-rw-r--r--phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php1
-rw-r--r--phpBB/phpbb/db/tools.php251
-rw-r--r--[-rwxr-xr-x]phpBB/styles/prosilver/theme/images/icon_print.gifbin204 -> 204 bytes
-rw-r--r--phpBB/viewtopic.php4
-rw-r--r--tests/config_php_file_test.php10
-rw-r--r--tests/content_visibility/delete_post_test.php34
-rw-r--r--tests/dbal/db_tools_test.php12
-rw-r--r--tests/functions/insert_config_array_test.php142
-rwxr-xr-xtravis/check-executable-files.sh68
-rwxr-xr-xtravis/setup-php-extensions.sh6
22 files changed, 567 insertions, 181 deletions
diff --git a/.travis.yml b/.travis.yml
index aea2b8ed0a..a246590bb5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -38,6 +38,7 @@ before_script:
script:
- travis/phing-sniff.sh $DB $TRAVIS_PHP_VERSION
- travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION
+ - travis/check-executable-files.sh $DB $TRAVIS_PHP_VERSION ./
- phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.3.3' -a '$DB' = 'mysqli' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi"
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index d4e0f04d2b..a521f413ed 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -11,10 +11,6 @@
*
*/
-use Symfony\Component\Config\FileLocator;
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
-
/**
* @ignore
*/
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index 7ff3212b72..905e981cdc 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -183,7 +183,10 @@ class auth_admin extends \phpbb\auth\auth
}
// Defining the user-function here to save some memory
- $return_acl_fill = create_function('$value', 'return ' . $acl_fill . ';');
+ $return_acl_fill = function () use ($acl_fill)
+ {
+ return $acl_fill;
+ };
// Actually fill the gaps
if (sizeof($hold_ary))
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index ad5a359710..abf726581d 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -655,3 +655,30 @@ function validate_range($value_ary, &$error)
}
}
}
+
+/**
+* Inserts new config display_vars into an exisiting display_vars array
+* at the given position.
+*
+* @param array $display_vars An array of existing config display vars
+* @param array $add_config_vars An array of new config display vars
+* @param array $where Where to place the new config vars,
+* before or after an exisiting config, as an array
+* of the form: array('after' => 'config_name') or
+* array('before' => 'config_name').
+* @return array The array of config display vars
+*/
+function phpbb_insert_config_array($display_vars, $add_config_vars, $where)
+{
+ if (is_array($where) && array_key_exists(current($where), $display_vars))
+ {
+ $position = array_search(current($where), array_keys($display_vars)) + ((key($where) == 'before') ? 0 : 1);
+ $display_vars = array_merge(
+ array_slice($display_vars, 0, $position),
+ $add_config_vars,
+ array_slice($display_vars, $position)
+ );
+ }
+
+ return $display_vars;
+}
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index fb09bc7057..624ce187b9 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1324,18 +1324,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
{
delete_topics('topic_id', array($topic_id), false);
- if ($data['topic_visibility'] == ITEM_APPROVED)
- {
- $sql_data[FORUMS_TABLE] .= 'forum_posts_approved = forum_posts_approved - 1, forum_topics_approved = forum_topics_approved - 1';
- }
- else if ($data['topic_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE)
- {
- $sql_data[FORUMS_TABLE] .= 'forum_posts_unapproved = forum_posts_unapproved - 1, forum_topics_unapproved = forum_topics_unapproved - 1';
- }
- else if ($data['topic_visibility'] == ITEM_DELETED)
- {
- $sql_data[FORUMS_TABLE] .= 'forum_posts_softdeleted = forum_posts_softdeleted - 1, forum_topics_softdeleted = forum_topics_softdeleted - 1';
- }
+ $phpbb_content_visibility->remove_topic_from_statistic($data, $sql_data);
$update_sql = update_post_information('forum', $forum_id, true);
if (sizeof($update_sql))
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 9f6125f256..92000c6ceb 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -1114,6 +1114,7 @@ function mcp_fork_topic($topic_ids)
$forum_id = request_var('f', 0);
$redirect = request_var('redirect', build_url(array('action', 'quickmod')));
$additional_msg = $success_msg = '';
+ $counter = array();
$s_hidden_fields = build_hidden_fields(array(
'topic_id_list' => $topic_ids,
@@ -1306,9 +1307,20 @@ function mcp_fork_topic($topic_ids)
'post_edit_time' => (int) $row['post_edit_time'],
'post_edit_count' => (int) $row['post_edit_count'],
'post_edit_locked' => (int) $row['post_edit_locked'],
- 'post_postcount' => 0,
+ 'post_postcount' => $row['post_postcount'],
);
-
+ // Adjust post count only if the post can be incremented to the user counter
+ if ($row['post_postcount'])
+ {
+ if (isset($counter[$row['poster_id']]))
+ {
+ ++$counter[$row['poster_id']];
+ }
+ else
+ {
+ $counter[$row['poster_id']] = 1;
+ }
+ }
$db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$new_post_id = $db->sql_nextid();
@@ -1428,6 +1440,18 @@ function mcp_fork_topic($topic_ids)
WHERE forum_id = ' . $to_forum_id;
$db->sql_query($sql);
+ if (!empty($counter))
+ {
+ // Do only one query per user and not a query per post.
+ foreach ($counter as $user_id => $count)
+ {
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_posts = user_posts + ' . (int) $count . '
+ WHERE user_id = ' . (int) $user_id;
+ $db->sql_query($sql);
+ }
+ }
+
sync('topic', 'topic_id', $new_topic_id_list);
sync('forum', 'forum_id', $to_forum_id);
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 517143792a..6a91033dbb 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -13,10 +13,6 @@
$update_start_time = time();
-use Symfony\Component\Config\FileLocator;
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
-
/**
* @ignore
*/
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index d443c537fa..395aff6c7d 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -11,10 +11,6 @@
*
*/
-use Symfony\Component\Config\FileLocator;
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
-
/**#@+
* @ignore
*/
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php
index 28777a8d24..82ca0fc18d 100644
--- a/phpBB/install/install_update.php
+++ b/phpBB/install/install_update.php
@@ -1063,6 +1063,14 @@ class install_update extends module
$transfer->write_file($file_struct['filename'], $contents);
}
break;
+
+ case 'deleted':
+
+ if ($update_mode != 'download')
+ {
+ $transfer->rename($file_struct['filename'], $file_struct['filename'] . '.bak');
+ }
+ break;
}
}
}
diff --git a/phpBB/phpbb/config_php_file.php b/phpBB/phpbb/config_php_file.php
index 1a562e470d..7445e7df22 100644
--- a/phpBB/phpbb/config_php_file.php
+++ b/phpBB/phpbb/config_php_file.php
@@ -71,59 +71,44 @@ class config_php_file
/**
* Returns an associative array containing the variables defined by the config file.
*
- * @return bool|array Return the content of the config file or false if the file does not exists.
+ * @return array Return the content of the config file or an empty array if the file does not exists.
*/
public function get_all()
{
- if (!$this->load_config_file())
- {
- return false;
- }
+ $this->load_config_file();
return $this->config_data;
}
/**
- * Return the value of a variable defined into the config.php file and false if the variable does not exist.
+ * Return the value of a variable defined into the config.php file or null if the variable does not exist.
*
* @param string $variable The name of the variable
- * @return mixed
+ * @return mixed Value of the variable or null if the variable is not defined.
*/
public function get($variable)
{
- if (!$this->load_config_file())
- {
- return false;
- }
+ $this->load_config_file();
- return isset($this->config_data[$variable]) ? $this->config_data[$variable] : false;
+ return isset($this->config_data[$variable]) ? $this->config_data[$variable] : null;
}
/**
* Load the config file and store the information.
*
- * @return bool True if the file was correctly loaded, false otherwise.
+ * @return null
*/
protected function load_config_file()
{
- if (!$this->config_loaded)
+ if (!$this->config_loaded && file_exists($this->config_file))
{
- if (file_exists($this->config_file))
- {
- $this->defined_vars = get_defined_vars();
+ $this->defined_vars = get_defined_vars();
- require($this->config_file);
- $this->config_data = array_diff_key(get_defined_vars(), $this->defined_vars);
+ require($this->config_file);
+ $this->config_data = array_diff_key(get_defined_vars(), $this->defined_vars);
- $this->config_loaded = true;
- }
- else
- {
- return false;
- }
+ $this->config_loaded = true;
}
-
- return true;
}
/**
diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php
index da4405d676..8bd537586e 100644
--- a/phpBB/phpbb/content_visibility.php
+++ b/phpBB/phpbb/content_visibility.php
@@ -570,7 +570,7 @@ class content_visibility
* Add post to topic and forum statistics
*
* @param $data array Contains information from the topics table about given topic
- * @param $sql_data array Populated with the SQL changes, may be empty at call time
+ * @param &$sql_data array Populated with the SQL changes, may be empty at call time
* @return null
*/
public function add_post_to_statistic($data, &$sql_data)
@@ -591,7 +591,7 @@ class content_visibility
* Remove post from topic and forum statistics
*
* @param $data array Contains information from the topics table about given topic
- * @param $sql_data array Populated with the SQL changes, may be empty at call time
+ * @param &$sql_data array Populated with the SQL changes, may be empty at call time
* @return null
*/
public function remove_post_from_statistic($data, &$sql_data)
@@ -623,64 +623,29 @@ class content_visibility
/**
* Remove topic from forum statistics
*
- * @param $topic_id int The topic to act on
- * @param $forum_id int Forum where the topic is found
- * @param $topic_row array Contains information from the topic, may be empty at call time
- * @param $sql_data array Populated with the SQL changes, may be empty at call time
+ * @param $data array Post and topic data
+ * @param &$sql_data array Populated with the SQL changes, may be empty at call time
* @return null
*/
- public function remove_topic_from_statistic($topic_id, $forum_id, &$topic_row, &$sql_data)
+ public function remove_topic_from_statistic($data, &$sql_data)
{
- // Do we need to grab some topic informations?
- if (!sizeof($topic_row))
+ if ($data['topic_visibility'] == ITEM_APPROVED)
{
- $sql = 'SELECT topic_type, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_visibility
- FROM ' . $this->topics_table . '
- WHERE topic_id = ' . (int) $topic_id;
- $result = $this->db->sql_query($sql);
- $topic_row = $this->db->sql_fetchrow($result);
- $this->db->sql_freeresult($result);
- }
-
- // If this is an edited topic or the first post the topic gets completely disapproved later on...
- $sql_data[$this->forums_table] = (($sql_data[$this->forums_table]) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_topics_approved = forum_topics_approved - 1';
- $sql_data[$this->forums_table] .= ', forum_posts_approved = forum_posts_approved - ' . $topic_row['topic_posts_approved'];
- $sql_data[$this->forums_table] .= ', forum_posts_unapproved = forum_posts_unapproved - ' . $topic_row['topic_posts_unapproved'];
- $sql_data[$this->forums_table] .= ', forum_posts_softdeleted = forum_posts_softdeleted - ' . $topic_row['topic_posts_softdeleted'];
+ $sql_data[FORUMS_TABLE] .= 'forum_posts_approved = forum_posts_approved - 1, forum_topics_approved = forum_topics_approved - 1';
- $this->config->increment('num_topics', -1, false);
- $this->config->increment('num_posts', $topic_row['topic_posts_approved'] * (-1), false);
-
- // Get user post count information
- $sql = 'SELECT poster_id, COUNT(post_id) AS num_posts
- FROM ' . $this->posts_table . '
- WHERE topic_id = ' . (int) $topic_id . '
- AND post_postcount = 1
- AND post_visibility = ' . ITEM_APPROVED . '
- GROUP BY poster_id';
- $result = $this->db->sql_query($sql);
-
- $postcounts = array();
- while ($row = $this->db->sql_fetchrow($result))
+ if ($data['post_postcount'])
+ {
+ $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1';
+ }
+ }
+ else if ($data['topic_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE)
{
- $postcounts[(int) $row['num_posts']][] = (int) $row['poster_id'];
+ $sql_data[FORUMS_TABLE] .= 'forum_posts_unapproved = forum_posts_unapproved - 1, forum_topics_unapproved = forum_topics_unapproved - 1';
}
- $this->db->sql_freeresult($result);
-
- // Decrement users post count
- foreach ($postcounts as $num_posts => $poster_ids)
+ else if ($data['topic_visibility'] == ITEM_DELETED)
{
- $sql = 'UPDATE ' . $this->users_table . '
- SET user_posts = 0
- WHERE user_posts < ' . $num_posts . '
- AND ' . $this->db->sql_in_set('user_id', $poster_ids);
- $this->db->sql_query($sql);
-
- $sql = 'UPDATE ' . $this->users_table . '
- SET user_posts = user_posts - ' . $num_posts . '
- WHERE user_posts >= ' . $num_posts . '
- AND ' . $this->db->sql_in_set('user_id', $poster_ids);
- $this->db->sql_query($sql);
+ $sql_data[FORUMS_TABLE] .= 'forum_posts_softdeleted = forum_posts_softdeleted - 1, forum_topics_softdeleted = forum_topics_softdeleted - 1';
}
+
}
}
diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php
index efab34b701..948a6a218c 100644
--- a/phpBB/phpbb/controller/resolver.php
+++ b/phpBB/phpbb/controller/resolver.php
@@ -41,6 +41,12 @@ class resolver implements ControllerResolverInterface
protected $template;
/**
+ * Request type cast helper object
+ * @var \phpbb\request\type_cast_helper
+ */
+ protected $type_cast_helper;
+
+ /**
* phpBB root path
* @var string
*/
@@ -59,6 +65,7 @@ class resolver implements ControllerResolverInterface
$this->user = $user;
$this->container = $container;
$this->template = $template;
+ $this->type_cast_helper = new \phpbb\request\type_cast_helper();
$this->phpbb_root_path = $phpbb_root_path;
}
@@ -138,7 +145,16 @@ class resolver implements ControllerResolverInterface
{
if (array_key_exists($param->name, $attributes))
{
- $arguments[] = $attributes[$param->name];
+ if (is_string($attributes[$param->name]))
+ {
+ $value = $attributes[$param->name];
+ $this->type_cast_helper->set_var($value, $attributes[$param->name], 'string', true, false);
+ $arguments[] = $value;
+ }
+ else
+ {
+ $arguments[] = $attributes[$param->name];
+ }
}
else if ($param->getClass() && $param->getClass()->isInstance($request))
{
diff --git a/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php b/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php
index f5970e74b2..6335c75398 100644
--- a/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php
+++ b/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php
@@ -119,6 +119,7 @@ class soft_delete_mod_convert extends \phpbb\db\migration\migration
{
return new \phpbb\content_visibility(
new \phpbb\auth\auth(),
+ $this->config,
$this->db,
new \phpbb\user(),
$this->phpbb_root_path,
diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php
index 5d93eb8246..3567570137 100644
--- a/phpBB/phpbb/db/tools.php
+++ b/phpBB/phpbb/db/tools.php
@@ -1816,7 +1816,8 @@ class tools
$old_return_statements = $this->return_statements;
$this->return_statements = true;
- $indexes = $this->mssql_get_existing_indexes($table_name, $column_name);
+ $indexes = $this->get_existing_indexes($table_name, $column_name);
+ $indexes = array_merge($indexes, $this->get_existing_indexes($table_name, $column_name, true));
// Drop any indexes
$recreate_indexes = array();
@@ -2038,7 +2039,7 @@ class tools
break;
case 'oracle':
- $statements[] = 'ALTER TABLE ' . $table_name . 'add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')';
+ $statements[] = 'ALTER TABLE ' . $table_name . ' add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')';
break;
case 'sqlite':
@@ -2274,10 +2275,23 @@ class tools
}
/**
+ * Removes table_name from the index_name if it is at the beginning
+ *
+ * @param $table_name
+ * @param $index_name
+ * @return string
+ */
+ protected function strip_table_name_from_index_name($table_name, $index_name)
+ {
+ return (strpos(strtoupper($index_name), strtoupper($table_name)) === 0) ? substr($index_name, strlen($table_name) + 1) : $index_name;
+ }
+
+ /**
* Change column type (not name!)
*/
function sql_column_change($table_name, $column_name, $column_data, $inline = false)
{
+ $original_column_data = $column_data;
$column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data);
$statements = array();
@@ -2289,12 +2303,14 @@ class tools
$old_return_statements = $this->return_statements;
$this->return_statements = true;
- $indexes = $this->mssql_get_existing_indexes($table_name, $column_name);
+ $indexes = $this->get_existing_indexes($table_name, $column_name);
+ $unique_indexes = $this->get_existing_indexes($table_name, $column_name, true);
// Drop any indexes
- if (!empty($indexes))
+ if (!empty($indexes) || !empty($unique_indexes))
{
- foreach ($indexes as $index_name => $index_data)
+ $drop_indexes = array_merge(array_keys($indexes), array_keys($unique_indexes));
+ foreach ($drop_indexes as $index_name)
{
$result = $this->sql_index_drop($table_name, $index_name);
$statements = array_merge($statements, $result);
@@ -2324,6 +2340,16 @@ class tools
}
}
+ if (!empty($unique_indexes))
+ {
+ // Recreate unique indexes after we changed the column
+ foreach ($unique_indexes as $index_name => $index_data)
+ {
+ $result = $this->sql_create_unique_index($table_name, $index_name, $index_data);
+ $statements = array_merge($statements, $result);
+ }
+ }
+
$this->return_statements = $old_return_statements;
break;
@@ -2333,7 +2359,69 @@ class tools
break;
case 'oracle':
- $statements[] = 'ALTER TABLE ' . $table_name . ' MODIFY ' . $column_name . ' ' . $column_data['column_type_sql'];
+ // We need the data here
+ $old_return_statements = $this->return_statements;
+ $this->return_statements = true;
+
+ // Get list of existing indexes
+ $indexes = $this->get_existing_indexes($table_name, $column_name);
+ $unique_indexes = $this->get_existing_indexes($table_name, $column_name, true);
+
+ // Drop any indexes
+ if (!empty($indexes) || !empty($unique_indexes))
+ {
+ $drop_indexes = array_merge(array_keys($indexes), array_keys($unique_indexes));
+ foreach ($drop_indexes as $index_name)
+ {
+ $result = $this->sql_index_drop($table_name, $this->strip_table_name_from_index_name($table_name, $index_name));
+ $statements = array_merge($statements, $result);
+ }
+ }
+
+ $temp_column_name = 'temp_' . substr(md5($column_name), 0, 25);
+ // Add a temporary table with the new type
+ $result = $this->sql_column_add($table_name, $temp_column_name, $original_column_data);
+ $statements = array_merge($statements, $result);
+
+ // Copy the data to the new column
+ $statements[] = 'UPDATE ' . $table_name . ' SET ' . $temp_column_name . ' = ' . $column_name;
+
+ // Drop the original column
+ $result = $this->sql_column_remove($table_name, $column_name);
+ $statements = array_merge($statements, $result);
+
+ // Recreate the original column with the new type
+ $result = $this->sql_column_add($table_name, $column_name, $original_column_data);
+ $statements = array_merge($statements, $result);
+
+ if (!empty($indexes))
+ {
+ // Recreate indexes after we changed the column
+ foreach ($indexes as $index_name => $index_data)
+ {
+ $result = $this->sql_create_index($table_name, $this->strip_table_name_from_index_name($table_name, $index_name), $index_data);
+ $statements = array_merge($statements, $result);
+ }
+ }
+
+ if (!empty($unique_indexes))
+ {
+ // Recreate unique indexes after we changed the column
+ foreach ($unique_indexes as $index_name => $index_data)
+ {
+ $result = $this->sql_create_unique_index($table_name, $this->strip_table_name_from_index_name($table_name, $index_name), $index_data);
+ $statements = array_merge($statements, $result);
+ }
+ }
+
+ // Copy the data to the original column
+ $statements[] = 'UPDATE ' . $table_name . ' SET ' . $column_name . ' = ' . $temp_column_name;
+
+ // Drop the temporary column again
+ $result = $this->sql_column_remove($table_name, $temp_column_name);
+ $statements = array_merge($statements, $result);
+
+ $this->return_statements = $old_return_statements;
break;
case 'postgres':
@@ -2517,45 +2605,78 @@ class tools
*
* @param string $table_name
* @param string $column_name
+ * @param bool $unique Should we get unique indexes or normal ones
* @return array Array with Index name => columns
*/
- protected function mssql_get_existing_indexes($table_name, $column_name)
+ public function get_existing_indexes($table_name, $column_name, $unique = false)
{
- $existing_indexes = array();
- if ($this->mssql_is_sql_server_2000())
+ switch ($this->sql_layer)
{
- // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx
- // Deprecated in SQL Server 2005
- $sql = "SELECT DISTINCT ix.name AS phpbb_index_name
- FROM sysindexes ix
- INNER JOIN sysindexkeys ixc
- ON ixc.id = ix.id
- AND ixc.indid = ix.indid
- INNER JOIN syscolumns cols
- ON cols.colid = ixc.colid
- AND cols.id = ix.id
- WHERE ix.id = object_id('{$table_name}')
- AND cols.name = '{$column_name}'";
+ case 'mysql_40':
+ case 'mysql_41':
+ case 'postgres':
+ case 'sqlite':
+ case 'sqlite3':
+ // Not supported
+ throw new \Exception('DBMS is not supported');
+ break;
}
- else
+
+ $sql = '';
+ $existing_indexes = array();
+
+ switch ($this->sql_layer)
{
- $sql = "SELECT DISTINCT ix.name AS phpbb_index_name
- FROM sys.indexes ix
- INNER JOIN sys.index_columns ixc
- ON ixc.object_id = ix.object_id
- AND ixc.index_id = ix.index_id
- INNER JOIN sys.columns cols
- ON cols.column_id = ixc.column_id
- AND cols.object_id = ix.object_id
- WHERE ix.object_id = object_id('{$table_name}')
- AND cols.name = '{$column_name}'";
+ case 'mssql':
+ case 'mssqlnative':
+ if ($this->mssql_is_sql_server_2000())
+ {
+ // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx
+ // Deprecated in SQL Server 2005
+ $sql = "SELECT DISTINCT ix.name AS phpbb_index_name
+ FROM sysindexes ix
+ INNER JOIN sysindexkeys ixc
+ ON ixc.id = ix.id
+ AND ixc.indid = ix.indid
+ INNER JOIN syscolumns cols
+ ON cols.colid = ixc.colid
+ AND cols.id = ix.id
+ WHERE ix.id = object_id('{$table_name}')
+ AND cols.name = '{$column_name}'
+ AND INDEXPROPERTY(ix.id, ix.name, 'IsUnique') = " . ($unique) ? '1' : '0';
+ }
+ else
+ {
+ $sql = "SELECT DISTINCT ix.name AS phpbb_index_name
+ FROM sys.indexes ix
+ INNER JOIN sys.index_columns ixc
+ ON ixc.object_id = ix.object_id
+ AND ixc.index_id = ix.index_id
+ INNER JOIN sys.columns cols
+ ON cols.column_id = ixc.column_id
+ AND cols.object_id = ix.object_id
+ WHERE ix.object_id = object_id('{$table_name}')
+ AND cols.name = '{$column_name}'
+ AND ix.is_unique = " . ($unique) ? '1' : '0';
+ }
+ break;
+
+ case 'oracle':
+ $sql = "SELECT ix.index_name AS phpbb_index_name, ix.uniqueness AS is_unique
+ FROM all_ind_columns ixc, all_indexes ix
+ WHERE ix.index_name = ixc.index_name
+ AND ixc.table_name = '" . strtoupper($table_name) . "'
+ AND ixc.column_name = '" . strtoupper($column_name) . "'";
+ break;
}
$result = $this->db->sql_query($sql);
- $existing_indexes = array();
while ($row = $this->db->sql_fetchrow($result))
{
- $existing_indexes[$row['phpbb_index_name']] = array();
+ if (!isset($row['is_unique']) || ($unique && $row['is_unique'] == 'UNIQUE') || (!$unique && $row['is_unique'] == 'NONUNIQUE'))
+ {
+ $existing_indexes[$row['phpbb_index_name']] = array();
+ }
}
$this->db->sql_freeresult($result);
@@ -2564,35 +2685,47 @@ class tools
return array();
}
- if ($this->mssql_is_sql_server_2000())
- {
- $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name
- FROM sysindexes ix
- INNER JOIN sysindexkeys ixc
- ON ixc.id = ix.id
- AND ixc.indid = ix.indid
- INNER JOIN syscolumns cols
- ON cols.colid = ixc.colid
- AND cols.id = ix.id
- WHERE ix.id = object_id('{$table_name}')
- AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes));
- }
- else
+ switch ($this->sql_layer)
{
- $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name
- FROM sys.indexes ix
- INNER JOIN sys.index_columns ixc
- ON ixc.object_id = ix.object_id
- AND ixc.index_id = ix.index_id
- INNER JOIN sys.columns cols
- ON cols.column_id = ixc.column_id
- AND cols.object_id = ix.object_id
- WHERE ix.object_id = object_id('{$table_name}')
- AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes));
+ case 'mssql':
+ case 'mssqlnative':
+ if ($this->mssql_is_sql_server_2000())
+ {
+ $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name
+ FROM sysindexes ix
+ INNER JOIN sysindexkeys ixc
+ ON ixc.id = ix.id
+ AND ixc.indid = ix.indid
+ INNER JOIN syscolumns cols
+ ON cols.colid = ixc.colid
+ AND cols.id = ix.id
+ WHERE ix.id = object_id('{$table_name}')
+ AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes));
+ }
+ else
+ {
+ $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name
+ FROM sys.indexes ix
+ INNER JOIN sys.index_columns ixc
+ ON ixc.object_id = ix.object_id
+ AND ixc.index_id = ix.index_id
+ INNER JOIN sys.columns cols
+ ON cols.column_id = ixc.column_id
+ AND cols.object_id = ix.object_id
+ WHERE ix.object_id = object_id('{$table_name}')
+ AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes));
+ }
+ break;
+
+ case 'oracle':
+ $sql = "SELECT index_name AS phpbb_index_name, column_name AS phpbb_column_name
+ FROM all_ind_columns
+ WHERE table_name = '" . strtoupper($table_name) . "'
+ AND " . $this->db->sql_in_set('index_name', array_keys($existing_indexes));
+ break;
}
$result = $this->db->sql_query($sql);
-
while ($row = $this->db->sql_fetchrow($result))
{
$existing_indexes[$row['phpbb_index_name']][] = $row['phpbb_column_name'];
diff --git a/phpBB/styles/prosilver/theme/images/icon_print.gif b/phpBB/styles/prosilver/theme/images/icon_print.gif
index e464e304ea..e464e304ea 100755..100644
--- a/phpBB/styles/prosilver/theme/images/icon_print.gif
+++ b/phpBB/styles/prosilver/theme/images/icon_print.gif
Binary files differ
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 1fdce5a6c3..50481302e6 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -539,8 +539,8 @@ $s_quickmod_action = append_sid(
$quickmod_array = array(
// 'key' => array('LANG_KEY', $userHasPermissions),
- 'lock' => array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))),
- 'unlock' => array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))),
+ 'lock' => array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster']))),
+ 'unlock' => array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id))),
'delete_topic' => array('DELETE_TOPIC', ($auth->acl_get('m_delete', $forum_id) || (($topic_data['topic_visibility'] != ITEM_DELETED) && $auth->acl_get('m_softdelete', $forum_id)))),
'restore_topic' => array('RESTORE_TOPIC', (($topic_data['topic_visibility'] == ITEM_DELETED) && $auth->acl_get('m_approve', $forum_id))),
'move' => array('MOVE_TOPIC', $auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED),
diff --git a/tests/config_php_file_test.php b/tests/config_php_file_test.php
index c2e4eb21c7..c319678108 100644
--- a/tests/config_php_file_test.php
+++ b/tests/config_php_file_test.php
@@ -17,6 +17,7 @@ class phpbb_config_php_file_test extends phpbb_test_case
{
$config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/', 'php');
$this->assertSame('bar', $config_php->get('foo'));
+ $this->assertNull($config_php->get('bar'));
$this->assertSame(array('foo' => 'bar', 'foo_foo' => 'bar bar'), $config_php->get_all());
}
@@ -25,6 +26,15 @@ class phpbb_config_php_file_test extends phpbb_test_case
$config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/', 'php');
$config_php->set_config_file(dirname( __FILE__ ) . '/fixtures/config_other.php');
$this->assertSame('foo', $config_php->get('bar'));
+ $this->assertNull($config_php->get('foo'));
$this->assertSame(array('bar' => 'foo', 'bar_bar' => 'foo foo'), $config_php->get_all());
}
+
+ public function test_non_existent_file()
+ {
+ $config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/non_existent/', 'php');
+ $this->assertNull($config_php->get('bar'));
+ $this->assertNull($config_php->get('foo'));
+ $this->assertSame(array(), $config_php->get_all());
+ }
}
diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php
index aa705c52a5..7f31dd9b28 100644
--- a/tests/content_visibility/delete_post_test.php
+++ b/tests/content_visibility/delete_post_test.php
@@ -67,6 +67,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
1, 1, 1,
@@ -93,6 +96,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
1, 1, 3,
@@ -119,6 +125,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 2),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
1, 1, 2,
@@ -145,6 +154,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
1, 1, 1,
@@ -171,6 +183,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
1, 1, 3,
@@ -197,6 +212,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 2),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
@@ -222,6 +240,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 0, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 0, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 0),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
@@ -257,6 +278,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 0, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 0, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 1, 'forum_last_post_id' => 0),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
);
}
@@ -264,7 +288,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
/**
* @dataProvider delete_post_data
*/
- public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum)
+ public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum, $expected_user)
{
global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
@@ -313,5 +337,13 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
$this->assertEquals($expected_forum, $db->sql_fetchrowset($result));
$db->sql_freeresult($result);
+
+ $sql = 'SELECT user_posts
+ FROM ' . USERS_TABLE . '
+ WHERE user_id = ' . (int) $data['poster_id'];
+ $result = $db->sql_query($sql);
+
+ $this->assertEquals($expected_user, $db->sql_fetchrowset($result));
+ $db->sql_freeresult($result);
}
}
diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php
index 6cc2f8ec0f..51f9daacfb 100644
--- a/tests/dbal/db_tools_test.php
+++ b/tests/dbal/db_tools_test.php
@@ -288,13 +288,13 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
$this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012_2'));
// Create index over the column
- $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012_2'));
- $this->assertTrue($this->tools->sql_create_index('prefix_table_name', 'i_bug_12012_2', array('c_bug_12012_2', 'c_bool')));
- $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012_2'));
+ $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'bug_12012_2'));
+ $this->assertTrue($this->tools->sql_create_index('prefix_table_name', 'bug_12012_2', array('c_bug_12012_2', 'c_bool')));
+ $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'bug_12012_2'));
- $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012_3'));
- $this->assertTrue($this->tools->sql_create_index('prefix_table_name', 'i_bug_12012_3', array('c_bug_12012_2')));
- $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012_3'));
+ $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'bug_12012_3'));
+ $this->assertTrue($this->tools->sql_create_index('prefix_table_name', 'bug_12012_3', array('c_bug_12012_2')));
+ $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'bug_12012_3'));
// Remove the column
$this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012_2'));
diff --git a/tests/functions/insert_config_array_test.php b/tests/functions/insert_config_array_test.php
new file mode 100644
index 0000000000..bfcb05862e
--- /dev/null
+++ b/tests/functions/insert_config_array_test.php
@@ -0,0 +1,142 @@
+<?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.
+*
+*/
+
+class phpbb_functions_insert_config_array_test extends phpbb_test_case
+{
+ public function config_display_vars()
+ {
+ return array(
+ 'legend1' => '',
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ );
+ }
+
+ public function insert_config_array_data()
+ {
+ return array(
+ array( // Add a new config after 1st array item
+ array('new_config_1' => array()),
+ array('after' => 'legend1'),
+ array(
+ 'legend1' => '',
+ 'new_config_1' => array(),
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ ),
+ ),
+ array( // Add a new config after last array item
+ array('new_config_1' => array()),
+ array('after' => 'acp_config_5'),
+ array(
+ 'legend1' => '',
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ 'new_config_1' => array(),
+ ),
+ ),
+ array( // Add a new config before 2nd array item
+ array('new_config_1' => array()),
+ array('before' => 'acp_config_1'),
+ array(
+ 'legend1' => '',
+ 'new_config_1' => array(),
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ ),
+ ),
+ array( // Add a new config before last config item
+ array('new_config_1' => array()),
+ array('before' => 'acp_config_5'),
+ array(
+ 'legend1' => '',
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'new_config_1' => array(),
+ 'acp_config_5' => array(),
+ ),
+ ),
+ array( // When an array key does not exist
+ array('new_config_1' => array()),
+ array('after' => 'foobar'),
+ array(
+ 'legend1' => '',
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ ),
+ ),
+ array( // When after|before is not used correctly (defaults to after)
+ array('new_config_1' => array()),
+ array('foobar' => 'acp_config_1'),
+ array(
+ 'legend1' => '',
+ 'acp_config_1' => array(),
+ 'new_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ ),
+ ),
+ array( // Add a new config set after the last array item
+ array(
+ 'legend2' => array(),
+ 'new_config_1' => array(),
+ 'new_config_2' => array(),
+ 'new_config_3' => array(),
+ ),
+ array('after' => 'acp_config_5'),
+ array(
+ 'legend1' => '',
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ 'legend2' => array(),
+ 'new_config_1' => array(),
+ 'new_config_2' => array(),
+ 'new_config_3' => array(),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider insert_config_array_data
+ */
+ public function test_insert_config_array($new_config, $position, $expected)
+ {
+ $config_array = $this->config_display_vars();
+ $new_config_array = phpbb_insert_config_array($config_array, $new_config, $position);
+
+ $this->assertSame($expected, $new_config_array);
+ }
+}
diff --git a/travis/check-executable-files.sh b/travis/check-executable-files.sh
new file mode 100755
index 0000000000..4d420add1c
--- /dev/null
+++ b/travis/check-executable-files.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+#
+# 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.
+#
+set -e
+
+DB=$1
+TRAVIS_PHP_VERSION=$2
+root="$3"
+path="${root}phpBB/"
+
+if [ "$TRAVIS_PHP_VERSION" == "5.3.3" -a "$DB" == "mysqli" ]
+then
+ # Check the permissions of the files
+
+ # The following variables MUST NOT contain any wildcard
+ # Directories to skip
+ directories_skipped="-path ${path}develop -o -path ${path}vendor"
+
+ # Files to skip
+ files_skipped="-false"
+
+ # Files which have to be executable
+ executable_files="-path ${path}bin/*"
+
+ incorrect_files=$( \
+ find ${path} \
+ '(' \
+ '(' \
+ ${directories_skipped} \
+ ')' \
+ -a -type d -prune -a -type f \
+ ')' -o \
+ '(' \
+ -type f -a \
+ -not '(' \
+ ${files_skipped} \
+ ')' -a \
+ '(' \
+ '(' \
+ '(' \
+ ${executable_files} \
+ ')' -a \
+ -not -perm +100 \
+ ')' -o \
+ '(' \
+ -not '(' \
+ ${executable_files} \
+ ')' -a \
+ -perm +111 \
+ ')' \
+ ')' \
+ ')' \
+ )
+
+ if [ "${incorrect_files}" != '' ]
+ then
+ echo "The following files do not have proper permissions:";
+ ls -la ${incorrect_files}
+ exit 1;
+ fi
+fi
diff --git a/travis/setup-php-extensions.sh b/travis/setup-php-extensions.sh
index 3655d6e952..c0defe44ef 100755
--- a/travis/setup-php-extensions.sh
+++ b/travis/setup-php-extensions.sh
@@ -42,12 +42,6 @@ function install_php_extension
php_ini_file=$(find_php_ini)
-# disable broken opcache on PHP 5.5.7 and 5.5.8
-if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.5.9', '<');"` == "1" ]
-then
- sed -i '/opcache.so/d' "$php_ini_file"
-fi
-
# apc
if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.5.0-dev', '<');"` == "1" ]
then