Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into ticket/11574
Browse files Browse the repository at this point in the history
* upstream/develop: (575 commits)
  [ticket/11702] Fix forum_posts left over for link-click counts in viewforum.php
  [ticket/11696] Move file to new directory
  [ticket/11696] Rename constructor to __construct()
  [ticket/11696] Remove manual loading of db_tools in extension controller test
  [ticket/11696] Rename db_tools.php so it can be autoloaded
  [ticket/11698] Moving all autoloadable files to phpbb/
  [ticket/11694] Do not locate assets with root path
  [ticket/11692] Don't update search_type in dev migration if already appended
  [ticket/11675] Fix template loop
  [ticket/11690] Old module class names may get autoloaded by class_exists
  [ticket/9649] Display information on index for moderators on unapproved posts
  [ticket/10999] Fix assets_version in ACP
  [prep-release-3.0.12] More changelog items for the 3.0.12 release.
  [ticket/11687] Add assets_version to phpbb_config
  [ticket/11686] Not checking for phpBB Debug errors on functional tests
  [ticket/11670] Consistency with logo: Replace "phpBB(tm)" with "phpBB(R)".
  [ticket/11674] Do not include vendor folder if there are no dependencies.
  [ticket/11685] Remove logout confirmation page
  [ticket/11684] Remove useless confirmation page after login and admin login
  [ticket/9657] Define user before injecting
  ...

Conflicts:
	phpBB/includes/functions_container.php
	phpBB/install/database_update.php
	phpBB/install/index.php
  • Loading branch information
igorw committed Jul 14, 2013
2 parents fa3cdb6 + c15bde1 commit f6865dc
Show file tree
Hide file tree
Showing 509 changed files with 12,698 additions and 5,962 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*~
/phpunit.xml
/phpBB/cache/twig/*
/phpBB/cache/*.html
/phpBB/cache/*.php
/phpBB/cache/*.lock
Expand Down
42 changes: 29 additions & 13 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,26 +169,42 @@
command="git archive ${revision} | tar -xf - -C ../${dir}"
checkreturn="true" />

<!--
If composer.phar exists in this version of the tree, also export
it into ${dir}, install dependencies, then delete it again.
-->
<!-- Install composer dependencies, if there are any. -->
<exec dir="."
command="git ls-tree ${revision} composer.phar"
command='php -r "\$j = json_decode(file_get_contents("composer.json")); echo isset(\$j->require);"'
checkreturn="true"
outputProperty='composer-ls-tree-output' />
outputProperty='composer-has-dependencies' />
<if>
<not><equals arg1="${composer-ls-tree-output}" arg2="" trim="true" /></not>
<equals arg1="${composer-has-dependencies}" arg2="1" trim="true" />
<then>
<!-- We have non-dev composer dependencies -->
<exec dir="."
command="git archive ${revision} composer.phar | tar -xf - -C ${dir}"
checkreturn="true" />
<exec dir="${dir}"
command="php composer.phar install"
command="git ls-tree ${revision} composer.phar"
checkreturn="true"
passthru="true" />
<delete file="${dir}/composer.phar" />
outputProperty='composer-ls-tree-output' />
<if>
<equals arg1="${composer-ls-tree-output}" arg2="" trim="true" />
<then>
<fail message="There are composer dependencies, but composer.phar is missing." />
</then>
<else>
<!-- Export the phar, install dependencies, delete phar. -->
<exec dir="."
command="git archive ${revision} composer.phar | tar -xf - -C ${dir}"
checkreturn="true" />
<exec dir="${dir}"
command="php composer.phar install"
checkreturn="true"
passthru="true" />
<delete file="${dir}/composer.phar" />
</else>
</if>
</then>
<else>
<!-- We do not have composer dependencies, do not ship composer files -->
<delete file="${dir}/composer.json" />
<delete file="${dir}/composer.lock" />
</else>
</if>

<delete file="${dir}/config.php" />
Expand Down
57 changes: 5 additions & 52 deletions git-tools/hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

error=0
errors=""

if ! which "$PHP_BIN" >/dev/null 2>&1
then
echo "PHP Syntax check failed:"
Expand Down Expand Up @@ -73,63 +71,18 @@ do

# check the staged file content for syntax errors
# using php -l (lint)
# note: if display_errors=stderr in php.ini,
# parse errors are printed on stderr; otherwise
# they are printed on stdout.
# we filter everything other than parse errors
# with a grep below, therefore it should be safe
# to combine stdout and stderr in all circumstances
result=$(git cat-file -p $sha | "$PHP_BIN" -l 2>&1)
result=$(git cat-file -p $sha | "$PHP_BIN" -n -l -ddisplay_errors\=1 -derror_reporting\=E_ALL -dlog_errrors\=0 2>&1)
if [ $? -ne 0 ]
then
error=1
# Swap back in correct filenames
errors=$(echo "$errors"; echo "$result" |sed -e "s@in - on@in $filename on@g")
errors=$(echo "$errors"; echo "$result" | grep ':' | sed -e "s@in - on@in $filename on@g")
fi
done
unset IFS

if [ $error -eq 1 ]
if [ -n "$errors" ]
then
echo "PHP Syntax check failed:"
# php "display errors" (display_errors php.ini value)
# and "log errors" (log_errors php.ini value).
# these are independent settings - see main/main.c in php source.
# the "log errors" setting produces output which
# starts with "PHP Parse error:"; the "display errors"
# setting produces output starting with "Parse error:".
# if both are turned on php dumps the parse error twice.
# therefore here we try to grep for one version and
# if that yields no results grep for the other version.
#
# other fun php facts:
#
# 1. in cli, display_errors and log_errors have different
# destinations by default. display_errors prints to
# standard output and log_errors prints to standard error.
# whether these destinations make sense is left
# as an exercise for the reader.
# 2. as mentioned above, with all output turned on
# php will print parse errors twice, one time on stdout
# and one time on stderr.
# 3. it is possible to set both display_errors and log_errors
# to off. if this is done php will print the text
# "Errors parsing <file>" but will not say what
# the errors are. useful behavior, this.
# 4. on my system display_errors defaults to on and
# log_errors defaults to off, therefore providing
# by default one copy of messages. your mileage may vary.
# 5. by setting display_errors=stderr and log_errors=on,
# both sets of messages will be printed on stderr.
# 6. php-cgi binary, given display_errors=stderr and
# log_errors=on, still prints both sets of messages
# on stderr, but formats one set as an html fragment.
# 7. your entry here? ;)
$echo_e "$errors" | grep "^Parse error:"
if [ $? -ne 0 ]
then
# match failed
$echo_e "$errors" | grep "^PHP Parse error:"
fi
echo "PHP Syntax check failed: "
$echo_e "$errors"
exit 1
fi
21 changes: 18 additions & 3 deletions git-tools/merge.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,34 @@ function get_repository_url($username, $repository, $ssh = false)

function api_request($query)
{
$contents = file_get_contents("http://github.com/api/v2/json/$query");
return api_url_request("https://api.github.com/$query?per_page=100");
}

function api_url_request($url)
{
$contents = file_get_contents($url, false, stream_context_create(array(
'http' => array(
'header' => "User-Agent: phpBB/1.0\r\n",
),
)));

if ($contents === false)
{
throw new RuntimeException("Error: failed to retrieve pull request data\n", 4);
}
$contents = json_decode($contents);

if (isset($contents->message) && strpos($contents->message, 'API Rate Limit') === 0)
{
throw new RuntimeException('Reached github API Rate Limit. Please try again later' . "\n", 4);
}

return json_decode($contents);
return $contents;
}

function get_pull($username, $repository, $pull_id)
{
$request = api_request("pulls/$username/$repository/$pull_id");
$request = api_request("repos/$username/$repository/pulls/$pull_id");

$pull = $request->pull;

Expand Down
92 changes: 66 additions & 26 deletions git-tools/setup_github_network.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ function show_usage()
echo "$filename adds repositories of a github network as remotes to a local git repository.\n";
echo "\n";

echo "Usage: [php] $filename -s collaborators|organisation|contributors|network [OPTIONS]\n";
echo "Usage: [php] $filename -s collaborators|organisation|contributors|forks [OPTIONS]\n";
echo "\n";

echo "Scopes:\n";
echo " collaborators Repositories of people who have push access to the specified repository\n";
echo " contributors Repositories of people who have contributed to the specified repository\n";
echo " organisation Repositories of members of the organisation at github\n";
echo " network All repositories of the whole github network\n";
echo " forks All repositories of the whole github network\n";
echo "\n";

echo "Options:\n";
Expand Down Expand Up @@ -55,31 +55,31 @@ function show_usage()
function work($scope, $username, $repository, $developer)
{
// Get some basic data
$network = get_network($username, $repository);
$forks = get_forks($username, $repository);
$collaborators = get_collaborators($username, $repository);

if ($network === false || $collaborators === false)
if ($forks === false || $collaborators === false)
{
echo "Error: failed to retrieve network or collaborators\n";
echo "Error: failed to retrieve forks or collaborators\n";
return 1;
}

switch ($scope)
{
case 'collaborators':
$remotes = array_intersect_key($network, $collaborators);
$remotes = array_intersect_key($forks, $collaborators);
break;

case 'organisation':
$remotes = array_intersect_key($network, get_organisation_members($username));
$remotes = array_intersect_key($forks, get_organisation_members($username));
break;

case 'contributors':
$remotes = array_intersect_key($network, get_contributors($username, $repository));
$remotes = array_intersect_key($forks, get_contributors($username, $repository));
break;

case 'network':
$remotes = $network;
case 'forks':
$remotes = $forks;
break;

default:
Expand Down Expand Up @@ -145,41 +145,81 @@ function get_repository_url($username, $repository, $ssh = false)

function api_request($query)
{
$contents = file_get_contents("http://github.com/api/v2/json/$query");
return api_url_request("https://api.github.com/$query?per_page=100");
}

function api_url_request($url)
{
$contents = file_get_contents($url, false, stream_context_create(array(
'http' => array(
'header' => "User-Agent: phpBB/1.0\r\n",
),
)));

$sub_request_result = array();
// Check headers for pagination links
if (!empty($http_response_header))
{
foreach ($http_response_header as $header_element)
{
// Find Link Header which gives us a link to the next page
if (strpos($header_element, 'Link: ') === 0)
{
list($head, $header_content) = explode(': ', $header_element);
foreach (explode(', ', $header_content) as $links)
{
list($url, $rel) = explode('; ', $links);
if ($rel == 'rel="next"')
{
// Found a next link, follow it and merge the results
$sub_request_result = api_url_request(substr($url, 1, -1));
}
}
}
}
}

if ($contents === false)
{
return false;
}
return json_decode($contents);
$contents = json_decode($contents);

if (isset($contents->message) && strpos($contents->message, 'API Rate Limit') === 0)
{
throw new RuntimeException('Reached github API Rate Limit. Please try again later' . "\n", 4);
}

return ($sub_request_result) ? array_merge($sub_request_result, $contents) : $contents;
}

function get_contributors($username, $repository)
{
$request = api_request("repos/show/$username/$repository/contributors");
$request = api_request("repos/$username/$repository/stats/contributors");
if ($request === false)
{
return false;
}

$usernames = array();
foreach ($request->contributors as $contributor)
foreach ($request as $contribution)
{
$usernames[$contributor->login] = $contributor->login;
$usernames[$contribution->author->login] = $contribution->author->login;
}

return $usernames;
}

function get_organisation_members($username)
{
$request = api_request("organizations/$username/public_members");
$request = api_request("orgs/$username/public_members");
if ($request === false)
{
return false;
}

$usernames = array();
foreach ($request->users as $member)
foreach ($request as $member)
{
$usernames[$member->login] = $member->login;
}
Expand All @@ -189,35 +229,35 @@ function get_organisation_members($username)

function get_collaborators($username, $repository)
{
$request = api_request("repos/show/$username/$repository/collaborators");
$request = api_request("repos/$username/$repository/collaborators");
if ($request === false)
{
return false;
}

$usernames = array();
foreach ($request->collaborators as $collaborator)
foreach ($request as $collaborator)
{
$usernames[$collaborator] = $collaborator;
$usernames[$collaborator->login] = $collaborator->login;
}

return $usernames;
}

function get_network($username, $repository)
function get_forks($username, $repository)
{
$request = api_request("repos/show/$username/$repository/network");
$request = api_request("repos/$username/$repository/forks");
if ($request === false)
{
return false;
}

$usernames = array();
foreach ($request->network as $network)
foreach ($request as $fork)
{
$usernames[$network->owner] = array(
'username' => $network->owner,
'repository' => $network->name,
$usernames[$fork->owner->login] = array(
'username' => $fork->owner->login,
'repository' => $fork->name,
);
}

Expand Down
2 changes: 1 addition & 1 deletion phpBB/adm/style/acp_board.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h3>{L_WARNING}</h3>

<!-- IF S_AUTH -->
<!-- BEGIN auth_tpl -->
{auth_tpl.TPL}
<!-- INCLUDE {auth_tpl.TEMPLATE_FILE} -->
<!-- END auth_tpl -->
<!-- ENDIF -->

Expand Down
2 changes: 1 addition & 1 deletion phpBB/adm/style/acp_forums.html
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ <h3>{L_NOTIFY}</h3>
</div>
<!-- ENDIF -->

<p><strong>{NAVIGATION}<!-- IF S_NO_FORUMS --> [<a href="{U_EDIT}">{L_EDIT}</a> | <a href="{U_DELETE}">{L_DELETE}</a><!-- IF not S_LINK --> | <a href="{U_SYNC}">{L_RESYNC}</a><!-- ENDIF --->]<!-- ENDIF --></strong></p>
<p><strong>{NAVIGATION}<!-- IF S_NO_FORUMS --> [<a href="{U_EDIT}">{L_EDIT}</a> | <a href="{U_DELETE}">{L_DELETE}</a><!-- IF not S_LINK --> | <a href="{U_SYNC}">{L_RESYNC}</a><!-- ENDIF -->]<!-- ENDIF --></strong></p>

<!-- IF .forums -->
<table cellspacing="1">
Expand Down
4 changes: 2 additions & 2 deletions phpBB/adm/style/acp_icons.html
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ <h3>{L_NOTIFY}</h3>
<td style="text-align: center;">{items.EMOTION}</td>
<!-- ENDIF -->
<td style="text-align: right; white-space: nowrap;">
<!-- IF items.S_FIRST_ROW and not PREVIOUS_PAGE -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{items.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->&nbsp;
<!-- IF items.S_LAST_ROW and not NEXT_PAGE -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{items.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
<!-- IF items.S_FIRST_ROW and not U_PREVIOUS_PAGE -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{items.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->&nbsp;
<!-- IF items.S_LAST_ROW and not U_NEXT_PAGE -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{items.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
&nbsp;<a href="{items.U_EDIT}">{ICON_EDIT}</a> <a href="{items.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a>
</td>
</tr>
Expand Down
Loading

0 comments on commit f6865dc

Please sign in to comment.