1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-13 20:28:44 +01:00

Merge branch '3.2.x'

* 3.2.x: (47 commits)
  [ticket/14492] Add user service to installer & only instantiate if needed
  [ticket/14492] Fix redirection to help phpBB page
  [ticket/14492] Encode URI components in systemdata for stats
  [ticket/14492] Always update the time the stats were sent
  [ticket/14492] Update versions in files
  [ticket/14492] Add missing event variable
  [ticket/14492] Don't explicitly pass data providers by refs
  [ticket/14492] Update phpBB version and fix miscellaneous code issues
  [ticket/14492] Install all extensions if 'all' is specified for extensions
  [ticket/14492] Checkout master if viglink tag does not exist for latest version
  [ticket/14492] Add language variables for updating extensions
  [ticket/14492] Prevent timeouts in install & update extensions tasks
  [ticket/14492] Use same list for checking if extension should be updated
  [ticket/14492] Add missing config to schema_data.sql
  [ticket/14492] Unify version check for installing default extensions
  [ticket/14492] Use extension manager instead of finder and add try/catch
  [ticket/14492] Checkout viglink for each version depending on tags
  [ticket/14492] Remove unused use statement
  [ticket/14492] Redirect to help phpBB page after installation
  [ticket/14492] Properly retrieve version updating from
  ...
This commit is contained in:
Tristan Darricau 2016-12-03 14:42:32 +01:00
commit c36ac7703a
No known key found for this signature in database
GPG Key ID: 817043C2E29DB881
33 changed files with 1106 additions and 173 deletions

View File

@ -142,6 +142,7 @@
<phingcall target="export">
<property name="revision" value="release-${version}" />
<property name="version" value="${version}" />
<property name="dir" value="build/old_versions/release-${version}" />
<property name="skip-composer" value="true" />
</phingcall>
@ -287,6 +288,54 @@
</else>
</if>
<!-- Checkout latest viglink to ext folder -->
<available file="${dir}/ext" type="dir" property="add-viglink-ext" />
<exec dir="${dir}"
command='php -r "echo version_compare(&apos;${version}&apos;, &apos;3.2.0-RC2&apos;, &apos;>=&apos;) ? &apos;true&apos; : &apos;false&apos;;"'
checkreturn="true"
outputProperty='viglink-available' />
<if>
<and>
<equals arg1="${add-viglink-ext}" arg2="1" trim="true" />
<or>
<equals arg1="${revision}" arg2="HEAD" trim="true" />
<equals arg1="${viglink-available}" arg2="1" trim="true" />
</or>
</and>
<then>
<exec dir="${dir}/ext" command="mkdir phpbb" passthru="true" />
<exec dir="${dir}/ext/phpbb" command="git clone https://github.com/phpbb-extensions/viglink.git viglink" passthru="true" checkreturn="true" />
<if>
<equals arg1="${revision}" arg2="HEAD" trim="true" />
<then>
<exec dir="${dir}/ext/phpbb/viglink"
command="git rev-parse release-phpbb-${version}"
returnProperty='viglink_head_tag_exists' />
<if>
<equals arg1="${viglink_head_tag_exists}" arg2="0" trim="true" />
<then>
<exec dir="${dir}/ext/phpbb/viglink" command="git checkout release-phpbb-${version}" passthru="true" />
</then>
<else>
<exec dir="${dir}/ext/phpbb/viglink" command="git checkout master" passthru="true" />
</else>
</if>
</then>
<else>
<exec dir="${dir}/ext/phpbb/viglink" command="git checkout release-phpbb-${version}" passthru="true" />
</else>
</if>
<delete dir="${dir}/ext/phpbb/viglink/.git" />
<delete dir="${dir}/ext/phpbb/viglink/tests" />
<delete dir="${dir}/ext/phpbb/viglink/travis" />
<delete file="${dir}/ext/phpbb/viglink/.gitattributes" />
<delete file="${dir}/ext/phpbb/viglink/.travis.yml" />
<delete file="${dir}/ext/phpbb/viglink/phpunit.xml.dist" />
<delete file="${dir}/ext/phpbb/viglink/README.md" />
</then>
</if>
<!-- Create schema.json -->
<exec dir="${dir}" command="php develop/create_schema_files.php" />

View File

@ -0,0 +1,61 @@
<!-- INCLUDE overall_header.html -->
<a id="maincontent"></a>
<h1>{L_ACP_HELP_PHPBB}</h1>
<form id="acp_help_phpbb" method="post" action="{U_ACTION}" data-ajax-action="{U_COLLECT_STATS}">
<div class="send-stats-row">
<!-- EVENT acp_help_phpbb_stats_before -->
<div class="send-stats-tile">
<h2><i class="icon fa-bar-chart"></i>Send statistics</h2>
<p>{L_EXPLAIN_SEND_STATISTICS}</p>
<div class="send-stats-row">
<div class="send-stats-data-row send-stats-data-only-row">
<a id="trigger-configlist" data-ajax="toggle_link" data-overlay="false" data-toggle-text="{L_HIDE_STATISTICS}"><span>{L_SHOW_STATISTICS}</span><i class="icon fa-angle-down"></i></a>
</div>
<div class="send-stats-data-row">
<div class="configlist" id="configlist">
<!-- BEGIN providers -->
<fieldset>
<legend>{providers.NAME}</legend>
<!-- BEGIN values -->
<dl>
<dt>{providers.values.KEY}</dt>
<dd>{providers.values.VALUE}</dd>
</dl>
<!-- END values -->
</fieldset>
<!-- END providers -->
</div>
</div>
</div>
<dl class="send-stats-settings">
<dt>
<input name="help_send_statistics" id="help_send_statistics" type="checkbox"<!-- IF S_COLLECT_STATS --> checked="checked"<!-- ENDIF --> />
<label for="help_send_statistics"></label>
</dt>
<dd>{L_SEND_STATISTICS_LONG}</dd>
</dl>
</div>
<!-- EVENT acp_help_phpbb_stats_after -->
<fieldset>
<p class="submit-buttons">
<input type="hidden" name="systemdata" value="{RAW_DATA}" />
<input type="hidden" name="help_send_statistics_time" value="{COLLECT_STATS_TIME}" />
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
</p>
{S_FORM_TOKEN}
</fieldset>
</div>
</form>
<form action="{U_COLLECT_STATS}" method="post" target="questionaire_result" id="questionnaire-form">
<fieldset>
<p class="submit-buttons">
<input type="hidden" name="systemdata" value="{RAW_DATA}" />
<input class="button1" type="submit" id="submit_stats" name="submit" value="{L_SEND_STATISTICS}" />
</p>
</fieldset>
</form>
<!-- INCLUDE overall_footer.html -->

View File

@ -1,64 +0,0 @@
<!-- INCLUDE overall_header.html -->
<a id="maincontent"></a>
<h1>{L_SEND_STATISTICS}</h1>
<p>{L_EXPLAIN_SEND_STATISTICS}</p>
<script type="text/javascript">
//<![CDATA[
var iframect = 0;
function iframe_updated()
{
if (iframect++ == 0)
{
return;
}
phpbb.toggleDisplay('questionnaire-form', -1);
phpbb.toggleDisplay('questionnaire-thanks', 1);
}
//]]>
</script>
<iframe onload="iframe_updated();" name="questionaire_result" style="display: none;"></iframe>
<form action="{U_COLLECT_STATS}" method="post" target="questionaire_result" id="questionnaire-form">
<p><a href="{U_ACP_MAIN}">{L_DONT_SEND_STATISTICS}</a></p>
<p>{L_EXPLAIN_SHOW_STATISTICS}</p>
<p id="show-button"><input type="button" class="button2" onclick="phpbb.toggleDisplay('configlist', 1); phpbb.toggleDisplay('show-button', -1);" value="{L_SHOW_STATISTICS}" /></p>
<div id="configlist">
<input type="button" class="button2" onclick="phpbb.toggleDisplay('show-button', 1); phpbb.toggleDisplay('configlist', -1);" value="{L_HIDE_STATISTICS}" />
<p class="submit-buttons">
<input class="button1" type="submit" id="submit" name="submit" value="{L_SEND_STATISTICS}" />
</p>
<!-- BEGIN providers -->
<fieldset>
<legend>{providers.NAME}</legend>
<!-- BEGIN values -->
<dl>
<dt>{providers.values.KEY}</dt>
<dd>{providers.values.VALUE}</dd>
</dl>
<!-- END values -->
</fieldset>
<!-- END providers -->
</div>
<p class="submit-buttons">
<input type="hidden" name="systemdata" value="{RAW_DATA}" />
<input class="button1" type="submit" id="submit" name="submit" value="{L_SEND_STATISTICS}" />
</p>
</form>
<div id="questionnaire-thanks" class="successbox">
<p><strong>{L_THANKS_SEND_STATISTICS}</strong><br /><br /><a href="{U_ACP_MAIN}">&laquo; {L_GO_ACP_MAIN}</a></p>
</div>
<!-- INCLUDE overall_footer.html -->

View File

@ -2583,3 +2583,111 @@ fieldset.permissions .padding {
line-height: 25px;
font-weight: bold;
}
.send-stats-row {
margin: 15px 0;
}
.send-stats-row:before {
display: table;
content: " ";
}
.send-stats-tile {
position: relative;
padding: 14px;
margin-bottom: 20px;
background-color: #eff0f2;
border-radius: 6px;
box-shadow: rgba(0,0,0,0.3) 1px 1px 5px;
}
.send-stats-tile h2 {
margin-top: 0;
text-align: center;
padding-bottom: 1em;
}
.send-stats-tile i {
padding-right: 0.3em;
}
.icon {
font-family: FontAwesome;
font-style: normal;
}
.send-stats-data-row {
background: #f9f9f9;
border-radius: 6px;
border: #DEDEDE 1px solid;
padding: 10px;
border-top-width: 0;
border-top-right-radius: 0;
border-top-left-radius: 0;
}
.send-stats-data-hidden .configlist {
display: none;
}
.send-stats-data-only-row {
border-radius: 6px !important;
border-bottom-width: 1px !important;
}
.send-stats-data-hidden {
padding: 0;
border: none;
}
.send-stats-row > .send-stats-data-row:first-child {
background-color: #d9edf7;
border-bottom-width: 0;
border-top-right-radius: 6px;
border-top-left-radius: 6px;
border-top-width: 1px;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.send-stats-settings dt, .send-stats-settings dd {
min-width: 25px;
}
.send-stats-settings dd {
line-height: 1.5em;
}
.send-stats-settings input {
display: none;
}
.send-stats-settings input[type=checkbox] + label:before {
content: "\f096";
font-family: FontAwesome;
font-size: 1.5em;
}
.send-stats-settings input[type=checkbox]:checked + label:before {
content: "\f14a";
color: #3c763d;
}
.send-stats-data-row a:hover span {
text-decoration: underline;
}
.send-stats-data-row a {
text-decoration: none;
cursor: default;
}
.send-stats-data-row i {
padding-left: 6px;
}
.configlist {
word-wrap: break-word;
word-break: break-all;
}

View File

@ -243,8 +243,16 @@ function parse_document(container)
parse_document($('body'));
// Hide configlist and success message in send statistics page
phpbb.toggleDisplay('configlist', -1);
phpbb.toggleDisplay('questionnaire-thanks', -1);
$('#questionnaire-form').css('display', 'none');
var $triggerConfiglist = $('#trigger-configlist');
$triggerConfiglist.on('click', function () {
var $configlist = $('#configlist');
$configlist.closest('.send-stats-data-row').toggleClass('send-stats-data-hidden');
$configlist.closest('.send-stats-row').find('.send-stats-data-row:first-child').toggleClass('send-stats-data-only-row');
$(this).find('i').toggleClass('fa-angle-down fa-angle-up');
});
$('#configlist').closest('.send-stats-data-row').addClass('send-stats-data-hidden');
});
})(jQuery);

View File

@ -4,6 +4,101 @@
'use strict';
phpbb.prepareSendStats = function () {
var $form = $('#acp_help_phpbb');
var $dark = $('#darkenwrapper');
var $loadingIndicator;
$form.on('submit', function (event) {
var $this = $(this),
currentTime = Math.floor(new Date().getTime() / 1000),
statsTime = parseInt($this.find('input[name=help_send_statistics_time]').val(), 10);
event.preventDefault();
$this.unbind('submit');
// Skip ajax request if form is submitted too early or send stats
// checkbox is not checked
if (!$this.find('input[name=help_send_statistics]').is(':checked') ||
statsTime > currentTime) {
$form.find('input[type=submit]').click();
setTimeout(function () {
$form.find('input[type=submit]').click();
}, 300);
return;
}
/**
* Handler for AJAX errors
*/
function errorHandler(jqXHR, textStatus, errorThrown) {
if (typeof console !== 'undefined' && console.log) {
console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown);
}
phpbb.clearLoadingTimeout();
var errorText = '';
if (typeof errorThrown === 'string' && errorThrown.length > 0) {
errorText = errorThrown;
} else {
errorText = $dark.attr('data-ajax-error-text-' + textStatus);
if (typeof errorText !== 'string' || !errorText.length) {
errorText = $dark.attr('data-ajax-error-text');
}
}
phpbb.alert($dark.attr('data-ajax-error-title'), errorText);
}
/**
* This is a private function used to handle the callbacks, refreshes
* and alert. It calls the callback, refreshes the page if necessary, and
* displays an alert to the user and removes it after an amount of time.
*
* It cannot be called from outside this function, and is purely here to
* avoid repetition of code.
*
* @param {object} res The object sent back by the server.
*/
function returnHandler(res) {
phpbb.clearLoadingTimeout();
// If a confirmation is not required, display an alert and call the
// callbacks.
$dark.fadeOut(phpbb.alertTime);
if ($loadingIndicator) {
$loadingIndicator.fadeOut(phpbb.alertTime);
}
var $sendStatisticsSuccess = $('<input />', {
type: 'hidden',
name: 'send_statistics_response',
value: res
});
$sendStatisticsSuccess.appendTo('p.submit-buttons');
// Finish actual form submission
$form.find('input[type=submit]').click();
}
$loadingIndicator = phpbb.loadingIndicator();
$.ajax({
url: $this.attr('data-ajax-action').replace('&amp;', '&'),
type: 'POST',
data: 'systemdata=' + encodeURIComponent($this.find('input[name=systemdata]').val()),
success: returnHandler,
error: errorHandler,
cache: false
}).always(function() {
if ($loadingIndicator && $loadingIndicator.is(':visible')) {
$loadingIndicator.fadeOut(phpbb.alertTime);
}
});
});
};
/**
* The following callbacks are for reording items. row_down
* is triggered when an item is moved down, and row_up is triggered when
@ -225,6 +320,10 @@ $(function() {
$(this).attr('data-clicked', true);
});
}
if ($('#acp_help_phpbb')) {
phpbb.prepareSendStats();
}
});

View File

@ -7,6 +7,7 @@
<!-- IF META -->{META}<!-- ENDIF -->
<title>{PAGE_TITLE}</title>
<link href="{T_FONT_AWESOME_LINK}" rel="stylesheet">
<link href="style/admin.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">

View File

@ -88,6 +88,12 @@ services:
calls:
- [setLexer, ['@template.twig.lexer']]
user:
class: phpbb\user
arguments:
- '@language'
- '%datetime.class%'
console.exception_subscriber:
class: phpbb\console\exception_subscriber
arguments:

View File

@ -7,6 +7,16 @@ services:
tags:
- { name: install_finish, order: 10 }
installer.install_finish.install_extensions:
class: phpbb\install\module\install_finish\task\install_extensions
arguments:
- '@installer.helper.container_factory'
- '@installer.helper.config'
- '@installer.helper.iohandler'
- '%core.root_path%'
tags:
- { name: install_finish, order: 20 }
installer.install_finish.notify_user:
class: phpbb\install\module\install_finish\task\notify_user
arguments:
@ -16,7 +26,7 @@ services:
- '%core.root_path%'
- '%core.php_ext%'
tags:
- { name: install_finish, order: 20 }
- { name: install_finish, order: 30 }
installer.module.install_finish_collection:
class: phpbb\di\ordered_service_collection

View File

@ -11,6 +11,17 @@ services:
tags:
- { name: update_database_task, order: 10 }
installer.update_database.update_extensions:
class: phpbb\install\module\update_database\task\update_extensions
arguments:
- '@installer.helper.container_factory'
- '@installer.helper.config'
- '@installer.helper.iohandler'
- '@installer.helper.update_helper'
- '%core.root_path%'
tags:
- { name: update_database_task, order: 20 }
installer.module.update_database_collection:
class: phpbb\di\ordered_service_collection
arguments:

View File

@ -196,6 +196,18 @@ acp_groups_position_teampage_add_button_before
* Since: 3.1.7-RC1
* Purpose: Add content before adding group to teampage submit button
acp_help_phpbb_stats_after
===
* Location: adm/style/acp_help_phpbb.html
* Since: 3.2.0-RC2
* Purpose: Add content after send statistics tile
acp_help_phpbb_stats_before
===
* Location: adm/style/acp_help_phpbb.html
* Since: 3.2.0-RC2
* Purpose: Add content before send statistics tile
acp_logs_quick_select_forum_button_append
===
* Location: adm/style/acp_logs.html

View File

@ -34,3 +34,5 @@ installer:
server_name: localhost
server_port: 80
script_path: /
extensions: ['phpbb/viglink']

View File

@ -1,2 +1,3 @@
updater:
type: all
extensions: ['phpbb/viglink']

View File

@ -0,0 +1,143 @@
<?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.
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
class acp_help_phpbb
{
var $u_action;
function main($id, $mode)
{
global $config, $request, $template, $user, $phpbb_dispatcher, $phpbb_admin_path, $phpbb_root_path, $phpEx;
if (!class_exists('phpbb_questionnaire_data_collector'))
{
include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx);
}
$collect_url = "https://www.phpbb.com/stats/receive_stats.php";
$this->tpl_name = 'acp_help_phpbb';
$this->page_title = 'ACP_HELP_PHPBB';
$submit = ($request->is_set_post('submit')) ? true : false;
$form_key = 'acp_help_phpbb';
add_form_key($form_key);
$error = array();
if ($submit && !check_form_key($form_key))
{
$error[] = $user->lang['FORM_INVALID'];
}
// Do not write values if there is an error
if (sizeof($error))
{
$submit = false;
}
// generate a unique id if necessary
if (!isset($config['questionnaire_unique_id']))
{
$install_id = unique_id();
$config->set('questionnaire_unique_id', $install_id);
}
else
{
$install_id = $config['questionnaire_unique_id'];
}
$collector = new phpbb_questionnaire_data_collector($install_id);
// Add data provider
$collector->add_data_provider(new phpbb_questionnaire_php_data_provider());
$collector->add_data_provider(new phpbb_questionnaire_system_data_provider());
$collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config));
/**
* Event to modify ACP help phpBB page and/or listen to submit
*
* @event core.acp_help_phpbb_submit_before
* @var boolean submit Do we display the form or process the submission
* @since 3.2.0-RC2
*/
$vars = array('submit');
extract($phpbb_dispatcher->trigger_event('core.acp_help_phpbb_submit_before', compact($vars)));
if ($submit)
{
$config->set('help_send_statistics', $request->variable('help_send_statistics', false));
$response = $request->variable('send_statistics_response', '');
$config->set('help_send_statistics_time', time());
if (!empty($response))
{
if ((strpos($response, 'Thank you') !== false || strpos($response, 'Flood protection') !== false))
{
trigger_error($user->lang('THANKS_SEND_STATISTICS') . adm_back_link($this->u_action));
}
else
{
trigger_error($user->lang('FAIL_SEND_STATISTICS') . adm_back_link($this->u_action));
}
}
trigger_error($user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
}
$template->assign_vars(array(
'U_COLLECT_STATS' => $collect_url,
'S_COLLECT_STATS' => (!empty($config['help_send_statistics'])) ? true : false,
'RAW_DATA' => $collector->get_data_for_form(),
'U_ACP_MAIN' => append_sid("{$phpbb_admin_path}index.$phpEx"),
'U_ACTION' => $this->u_action,
// Pass earliest time we should try to send stats again
'COLLECT_STATS_TIME' => intval($config['help_send_statistics_time']) + 86400,
));
$raw = $collector->get_data_raw();
foreach ($raw as $provider => $data)
{
if ($provider == 'install_id')
{
$data = array($provider => $data);
}
$template->assign_block_vars('providers', array(
'NAME' => htmlspecialchars($provider),
));
foreach ($data as $key => $value)
{
if (is_array($value))
{
$value = utf8_wordwrap(serialize($value), 75, "\n", true);
}
$template->assign_block_vars('providers.values', array(
'KEY' => utf8_htmlspecialchars($key),
'VALUE' => utf8_htmlspecialchars($value),
));
}
}
}
}

View File

@ -1,91 +0,0 @@
<?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.
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
class acp_send_statistics
{
var $u_action;
function main($id, $mode)
{
global $config, $template, $phpbb_admin_path, $phpbb_root_path, $phpEx;
if (!class_exists('phpbb_questionnaire_data_collector'))
{
include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx);
}
$collect_url = "https://www.phpbb.com/stats/receive_stats.php";
$this->tpl_name = 'acp_send_statistics';
$this->page_title = 'ACP_SEND_STATISTICS';
// generate a unique id if necessary
if (!isset($config['questionnaire_unique_id']))
{
$install_id = unique_id();
$config->set('questionnaire_unique_id', $install_id);
}
else
{
$install_id = $config['questionnaire_unique_id'];
}
$collector = new phpbb_questionnaire_data_collector($install_id);
// Add data provider
$collector->add_data_provider(new phpbb_questionnaire_php_data_provider());
$collector->add_data_provider(new phpbb_questionnaire_system_data_provider());
$collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config));
$template->assign_vars(array(
'U_COLLECT_STATS' => $collect_url,
'RAW_DATA' => $collector->get_data_for_form(),
'U_ACP_MAIN' => append_sid("{$phpbb_admin_path}index.$phpEx"),
));
$raw = $collector->get_data_raw();
foreach ($raw as $provider => $data)
{
if ($provider == 'install_id')
{
$data = array($provider => $data);
}
$template->assign_block_vars('providers', array(
'NAME' => htmlspecialchars($provider),
));
foreach ($data as $key => $value)
{
if (is_array($value))
{
$value = utf8_wordwrap(serialize($value), 75, "\n", true);
}
$template->assign_block_vars('providers.values', array(
'KEY' => utf8_htmlspecialchars($key),
'VALUE' => utf8_htmlspecialchars($value),
));
}
}
}
}

View File

@ -11,15 +11,15 @@
*
*/
class acp_send_statistics_info
class acp_help_phpbb_info
{
function module()
{
return array(
'filename' => 'acp_send_statistics',
'title' => 'ACP_SEND_STATISTICS',
'filename' => 'acp_help_phpbb',
'title' => 'ACP_HELP_PHPBB',
'modes' => array(
'send_statistics' => array('title' => 'ACP_SEND_STATISTICS', 'auth' => 'acl_a_server', 'cat' => array('ACP_SERVER_CONFIGURATION')),
'help_phpbb' => array('title' => 'ACP_HELP_PHPBB', 'auth' => 'acl_a_server', 'cat' => array('ACP_SERVER_CONFIGURATION')),
),
);
}

View File

@ -88,6 +88,7 @@ function adm_page_header($page_title)
'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/",
'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/",
'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/",
'T_FONT_AWESOME_LINK' => !empty($config['allow_cdn']) && !empty($config['load_font_awesome_url']) ? $config['load_font_awesome_url'] : "{$phpbb_root_path}assets/css/font-awesome.min.css?assets_version=" . $config['assets_version'],
'T_ASSETS_VERSION' => $config['assets_version'],

View File

@ -46,9 +46,9 @@ class phpbb_questionnaire_data_collector
$this->providers = array();
}
function add_data_provider(&$provider)
function add_data_provider($provider)
{
$this->providers[] = &$provider;
$this->providers[] = $provider;
}
/**
@ -80,7 +80,7 @@ class phpbb_questionnaire_data_collector
{
foreach (array_keys($this->providers) as $key)
{
$provider = &$this->providers[$key];
$provider = $this->providers[$key];
$this->data[$provider->get_identifier()] = $provider->get_data();
}
$this->data['install_id'] = $this->install_id;

View File

@ -142,6 +142,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_postgres_
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_sphinx_indexer_mem_limit', '512');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_sphinx_stopwords', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('help_send_statistics', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('help_send_statistics_time', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('hot_threshold', '25');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('icons_path', 'images/icons');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_create_thumbnail', '0');

View File

@ -108,6 +108,8 @@ $lang = array_merge($lang, array(
'ACP_GROUPS_PERMISSIONS' => 'Group permissions',
'ACP_GROUPS_POSITION' => 'Manage group positions',
'ACP_HELP_PHPBB' => 'Help support phpBB',
'ACP_ICONS' => 'Topic icons',
'ACP_ICONS_SMILIES' => 'Topic icons/smilies',
'ACP_INACTIVE_USERS' => 'Inactive users',
@ -167,7 +169,6 @@ $lang = array_merge($lang, array(
'ACP_SEARCH_SETTINGS' => 'Search settings',
'ACP_SECURITY_SETTINGS' => 'Security settings',
'ACP_SEND_STATISTICS' => 'Send statistical information',
'ACP_SERVER_CONFIGURATION' => 'Server configuration',
'ACP_SERVER_SETTINGS' => 'Server settings',
'ACP_SIGNATURE_SETTINGS' => 'Signature settings',
@ -474,16 +475,18 @@ $lang = array_merge($lang, array(
'USER_IS_INACTIVE' => 'User is inactive',
));
// Send statistics page
// Help support phpBB page
$lang = array_merge($lang, array(
'EXPLAIN_SEND_STATISTICS' => 'Please send information about your server and board configurations to phpBB for statistical analysis. All information that could identify you or your website has been removed - the data is entirely <strong>anonymous</strong>. We base decisions about future phpBB versions on this information. The statistics are made available publically. We also share this data with the PHP project, the programming language phpBB is made with.',
'EXPLAIN_SHOW_STATISTICS' => 'Using the button below you can preview all variables that will be transmitted.',
'DONT_SEND_STATISTICS' => 'Return to the ACP if you do not wish to send statistical information to phpBB.',
'GO_ACP_MAIN' => 'Go to the ACP start page',
'HIDE_STATISTICS' => 'Hide details',
'SEND_STATISTICS' => 'Send statistical information',
'SEND_STATISTICS' => 'Send statistics',
'SEND_STATISTICS_LONG' => 'Send statistical information',
'SHOW_STATISTICS' => 'Show details',
'THANKS_SEND_STATISTICS' => 'Thank you for submitting your information.',
'FAIL_SEND_STATISTICS' => 'phpBB was unable to send statistics',
));
// Log Entries
@ -816,4 +819,5 @@ $lang = array_merge($lang, array(
'LOG_EXT_ENABLE' => '<strong>Extension enabled</strong><br />» %s',
'LOG_EXT_DISABLE' => '<strong>Extension disabled</strong><br />» %s',
'LOG_EXT_PURGE' => '<strong>Extensions data deleted</strong><br />» %s',
'LOG_EXT_UPDATE' => '<strong>Extension updated</strong><br />» %s',
));

View File

@ -104,6 +104,8 @@ $lang = array_merge($lang, array(
'CLI_EXTENSION_NAME' => 'Name of the extension',
'CLI_EXTENSION_PURGE_FAILURE' => 'Could not purge extension %s',
'CLI_EXTENSION_PURGE_SUCCESS' => 'Successfully purged extension %s',
'CLI_EXTENSION_UPDATE_FAILURE' => 'Could not update extension %s',
'CLI_EXTENSION_UPDATE_SUCCESS' => 'Successfully updated extension %s',
'CLI_EXTENSION_NOT_FOUND' => 'No extensions were found.',
'CLI_EXTENSIONS_AVAILABLE' => 'Available',
'CLI_EXTENSIONS_DISABLED' => 'Disabled',

View File

@ -301,6 +301,7 @@ $lang = array_merge($lang, array(
'TASK_ADD_MODULES' => 'Installing modules',
// Install finish tasks
'TASK_INSTALL_EXTENSIONS' => 'Installing packaged extensions',
'TASK_NOTIFY_USER' => 'Sending notification e-mail',
'TASK_POPULATE_MIGRATIONS' => 'Populating migrations',
@ -457,6 +458,8 @@ $lang = array_merge($lang, array(
'STAGE_UPDATE_DATABASE' => 'Update database',
'INLINE_UPDATE_SUCCESSFUL' => 'The database update was successful.',
'TASK_UPDATE_EXTENSIONS' => 'Updating extensions',
));
// Converter

View File

@ -0,0 +1,50 @@
<?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\v320;
class add_help_phpbb extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v320\v320rc1',
);
}
public function effectively_installed()
{
return isset($this->config['help_send_statistics']);
}
public function update_data()
{
return array(
array('config.add', array('help_send_statistics', true)),
array('config.add', array('help_send_statistics_time', 0)),
array('module.remove', array(
'acp',
false,
'ACP_SEND_STATISTICS',
)),
array('module.add', array(
'acp',
'ACP_SERVER_CONFIGURATION',
array(
'module_basename' => 'acp_help_phpbb',
'modes' => array('help_phpbb'),
),
)),
);
}
}

View File

@ -151,6 +151,7 @@ class install extends \phpbb\console\command\command
try
{
$this->installer->run();
return 0;
}
catch (installer_exception $e)
{
@ -203,5 +204,7 @@ class install extends \phpbb\console\command\command
$iohandler->set_input('server_port', $config['server']['server_port']);
$iohandler->set_input('script_path', $config['server']['script_path']);
$iohandler->set_input('submit_server', 'submit');
$iohandler->set_input('install-extensions', $config['extensions']);
}
}

View File

@ -151,6 +151,7 @@ class update extends \phpbb\console\command\command
try
{
$this->installer->run();
return 0;
}
catch (installer_exception $e)
{
@ -175,5 +176,7 @@ class update extends \phpbb\console\command\command
$iohandler->set_input('submit_update_file', 'submit');
$iohandler->set_input('submit_continue_file_update', 'submit');
$iohandler->set_input('update-extensions', $config['extensions']);
}
}

View File

@ -243,8 +243,15 @@ class installer
}
else
{
global $SID;
$acp_url = $this->web_root . 'adm/index.php' . $SID;
// Start session and try to apply session id
$auth = $this->container_factory->get('auth');
$user = $this->container_factory->get('user');
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$phpbb_root_path = $this->container_factory->get_parameter('core.root_path');
$acp_url = append_sid($phpbb_root_path . 'adm/index.php', 'i=acp_help_phpbb&mode=help_phpbb', true, $user->session_id);
$this->iohandler->add_success_message('INSTALLER_FINISHED', array(
'ACP_LINK',
$acp_url,

View File

@ -135,6 +135,10 @@ class installer_configuration implements ConfigurationInterface
->end()
->end()
->end()
->arrayNode('extensions')
->prototype('scalar')->end()
->defaultValue([])
->end()
->end()
;
return $treeBuilder;

View File

@ -0,0 +1,199 @@
<?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\install\module\install_finish\task;
use phpbb\install\exception\resource_limit_reached_exception;
/**
* Installs extensions that exist in ext folder upon install
*/
class install_extensions extends \phpbb\install\task_base
{
/**
* @var \phpbb\install\helper\config
*/
protected $install_config;
/**
* @var \phpbb\install\helper\iohandler\iohandler_interface
*/
protected $iohandler;
/**
* @var \phpbb\config\db
*/
protected $config;
/**
* @var \phpbb\log\log_interface
*/
protected $log;
/**
* @var \phpbb\user
*/
protected $user;
/** @var \phpbb\extension\manager */
protected $extension_manager;
/** @var \Symfony\Component\Finder\Finder */
protected $finder;
/** @var string Extension table */
protected $extension_table;
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/**
* Constructor
*
* @param \phpbb\install\helper\container_factory $container
* @param \phpbb\install\helper\config $install_config
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler
* @param string $phpbb_root_path phpBB root path
*/
public function __construct(\phpbb\install\helper\container_factory $container, \phpbb\install\helper\config $install_config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler, $phpbb_root_path)
{
$this->install_config = $install_config;
$this->iohandler = $iohandler;
$this->extension_table = $container->get_parameter('tables.ext');
$this->log = $container->get('log');
$this->user = $container->get('user');
$this->extension_manager = $container->get('ext.manager');
$this->config = $container->get('config');
$this->db = $container->get('dbal.conn');
$this->finder = new \Symfony\Component\Finder\Finder();
$this->finder->in($phpbb_root_path . 'ext/')
->ignoreUnreadableDirs()
->depth('< 3')
->files()
->name('composer.json');
// Make sure asset version exists in config. Otherwise we might try to
// insert the assets_version setting into the database and cause a
// duplicate entry error.
if (!isset($this->config['assets_version']))
{
$this->config['assets_version'] = 0;
}
parent::__construct(true);
}
/**
* {@inheritdoc}
*/
public function run()
{
$this->user->session_begin();
$this->user->setup(array('common', 'acp/common', 'cli'));
$install_extensions = $this->iohandler->get_input('install-extensions', array());
$all_available_extensions = $this->extension_manager->all_available();
$i = $this->install_config->get('install_extensions_index', 0);
$available_extensions = array_slice($all_available_extensions, $i);
// Install extensions
foreach ($available_extensions as $ext_name => $ext_path)
{
if (!empty($install_extensions) && $install_extensions !== ['all'] && !in_array($ext_name, $install_extensions))
{
continue;
}
try
{
$this->extension_manager->enable($ext_name);
$extensions = $this->get_extensions();
if (isset($extensions[$ext_name]) && $extensions[$ext_name]['ext_active'])
{
// Create log
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($ext_name));
$this->iohandler->add_success_message(array('CLI_EXTENSION_ENABLE_SUCCESS', $ext_name));
}
else
{
$this->iohandler->add_log_message(array('CLI_EXTENSION_ENABLE_FAILURE', $ext_name));
}
}
catch (\Exception $e)
{
// Add fail log and continue
$this->iohandler->add_log_message(array('CLI_EXTENSION_ENABLE_FAILURE', $ext_name));
}
$i++;
// Stop execution if resource limit is reached
if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0)
{
break;
}
}
$this->install_config->set('install_extensions_index', $i);
if ($i < sizeof($all_available_extensions))
{
throw new resource_limit_reached_exception();
}
}
/**
* {@inheritdoc}
*/
static public function get_step_count()
{
return 1;
}
/**
* {@inheritdoc}
*/
public function get_task_lang_name()
{
return 'TASK_INSTALL_EXTENSIONS';
}
/**
* Get extensions from database
*
* @return array List of extensions
*/
private function get_extensions()
{
$sql = 'SELECT *
FROM ' . $this->extension_table;
$result = $this->db->sql_query($sql);
$extensions_row = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
$extensions = array();
foreach ($extensions_row as $extension)
{
$extensions[$extension['ext_name']] = $extension;
}
ksort($extensions);
return $extensions;
}
}

View File

@ -211,8 +211,6 @@ class update extends task_base
$this->iohandler->add_success_message('INLINE_UPDATE_SUCCESSFUL');
$this->config->delete('version_update_from');
$this->cache->purge();
$this->config->increment('assets_version', 1);

View File

@ -0,0 +1,263 @@
<?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\install\module\update_database\task;
use phpbb\install\exception\resource_limit_reached_exception;
use phpbb\install\helper\container_factory;
use phpbb\install\helper\config;
use phpbb\install\helper\iohandler\iohandler_interface;
use phpbb\install\helper\update_helper;
use phpbb\install\task_base;
use Symfony\Component\Finder\Finder;
/**
* Installs extensions that exist in ext folder upon install
*/
class update_extensions extends task_base
{
/**
* @var \phpbb\cache\driver\driver_interface
*/
protected $cache;
/**
* @var config
*/
protected $install_config;
/**
* @var iohandler_interface
*/
protected $iohandler;
/** @var update_helper */
protected $update_helper;
/**
* @var \phpbb\config\db
*/
protected $config;
/**
* @var \phpbb\log\log_interface
*/
protected $log;
/**
* @var \phpbb\user
*/
protected $user;
/** @var \phpbb\extension\manager */
protected $extension_manager;
/** @var Finder */
protected $finder;
/** @var string Extension table */
protected $extension_table;
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/**
* @var array List of default extensions to update, grouped by version
* they were added
*/
static public $default_extensions_update = [
'3.2.0-RC2' => ['phpbb/viglink']
];
/**
* Constructor
*
* @param container_factory $container
* @param config $install_config
* @param iohandler_interface $iohandler
* @param $update_helper $update_helper
* @param string $phpbb_root_path phpBB root path
*/
public function __construct(container_factory $container, config $install_config, iohandler_interface $iohandler, update_helper $update_helper, $phpbb_root_path)
{
$this->install_config = $install_config;
$this->iohandler = $iohandler;
$this->extension_table = $container->get_parameter('tables.ext');
$this->log = $container->get('log');
$this->user = $container->get('user');
$this->extension_manager = $container->get('ext.manager');
$this->cache = $container->get('cache.driver');
$this->config = $container->get('config');
$this->db = $container->get('dbal.conn');
$this->update_helper = $update_helper;
$this->finder = new Finder();
$this->finder->in($phpbb_root_path . 'ext/')
->ignoreUnreadableDirs()
->depth('< 3')
->files()
->name('composer.json');
// Make sure asset version exists in config. Otherwise we might try to
// insert the assets_version setting into the database and cause a
// duplicate entry error.
if (!isset($this->config['assets_version']))
{
$this->config['assets_version'] = 0;
}
parent::__construct(true);
}
/**
* {@inheritdoc}
*/
public function run()
{
$this->user->session_begin();
$this->user->setup(array('common', 'acp/common', 'cli'));
$update_info = $this->install_config->get('update_info_unprocessed', []);
$version_from = !empty($update_info) ? $update_info['version']['from'] : $this->config['version_update_from'];
if (!empty($version_from))
{
$update_extensions = $this->iohandler->get_input('update-extensions', []);
// Create list of default extensions that need to be enabled in update
$default_update_extensions = [];
foreach (self::$default_extensions_update as $version => $extensions)
{
if ($this->update_helper->phpbb_version_compare($version_from, $version, '<='))
{
$default_update_extensions = array_merge($default_update_extensions, $extensions);
}
}
$all_available_extensions = $this->extension_manager->all_available();
$i = $this->install_config->get('update_extensions_index', 0);
$available_extensions = array_slice($all_available_extensions, $i);
// Update available extensions
foreach ($available_extensions as $ext_name => $ext_path)
{
// Update extensions if:
// 1) Extension is currently enabled
// 2) Extension was implicitly defined as needing an update
// 3) Extension was newly added as default phpBB extension in
// this update and should be enabled by default.
if ($this->extension_manager->is_enabled($ext_name) ||
in_array($ext_name, $update_extensions) ||
in_array($ext_name, $default_update_extensions)
)
{
try
{
$extension_enabled = $this->extension_manager->is_enabled($ext_name);
if ($extension_enabled)
{
$this->extension_manager->disable($ext_name);
}
$this->extension_manager->enable($ext_name);
$extensions = $this->get_extensions();
if (isset($extensions[$ext_name]) && $extensions[$ext_name]['ext_active'])
{
// Create log
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_UPDATE', time(), array($ext_name));
$this->iohandler->add_success_message(array('CLI_EXTENSION_UPDATE_SUCCESS', $ext_name));
}
else
{
$this->iohandler->add_log_message('CLI_EXTENSION_UPDATE_FAILURE', array($ext_name));
}
// Disable extensions if it was disabled by the admin before
if (!$extension_enabled && !in_array($ext_name, $default_update_extensions))
{
$this->extension_manager->disable($ext_name);
}
}
catch (\Exception $e)
{
// Add fail log and continue
$this->iohandler->add_log_message('CLI_EXTENSION_UPDATE_FAILURE', array($ext_name));
}
}
$i++;
// Stop execution if resource limit is reached
if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0)
{
break;
}
}
$this->install_config->set('update_extensions_index', $i);
if ($i < sizeof($all_available_extensions))
{
throw new resource_limit_reached_exception();
}
}
$this->config->delete('version_update_from');
$this->cache->purge();
$this->config->increment('assets_version', 1);
}
/**
* {@inheritdoc}
*/
static public function get_step_count()
{
return 1;
}
/**
* {@inheritdoc}
*/
public function get_task_lang_name()
{
return 'TASK_UPDATE_EXTENSIONS';
}
/**
* Get extensions from database
*
* @return array List of extensions
*/
private function get_extensions()
{
$sql = 'SELECT *
FROM ' . $this->extension_table;
$result = $this->db->sql_query($sql);
$extensions_row = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
$extensions = array();
foreach ($extensions_row as $extension)
{
$extensions[$extension['ext_name']] = $extension;
}
ksort($extensions);
return $extensions;
}
}

View File

@ -118,6 +118,17 @@ class file_check extends task_base
$this->iohandler->set_task_count($task_count);
$this->iohandler->set_progress('UPDATE_CHECK_FILES', 0);
// Create list of default extensions that should have been added prior
// to this update
$default_update_extensions = [];
foreach (\phpbb\install\module\update_database\task\update_extensions::$default_extensions_update as $version => $extensions)
{
if ($this->update_helper->phpbb_version_compare($update_info['version']['from'], $version, '>'))
{
$default_update_extensions = array_merge($default_update_extensions, $extensions);
}
}
foreach ($update_info['files'] as $key => $filename)
{
$old_file = $old_path . $filename;
@ -138,6 +149,27 @@ class file_check extends task_base
$progress_count++;
$this->iohandler->set_progress('UPDATE_CHECK_FILES', $progress_count);
// Do not copy default extension again if the previous version was
// packaged with it but it does not exist (e.g. deleted by admin)
if (strpos($file, $this->phpbb_root_path . 'ext/') !== false)
{
$skip_file = false;
foreach ($default_update_extensions as $ext_name)
{
if (strpos($file, $this->phpbb_root_path . 'ext/' . $ext_name) !== false &&
!$this->filesystem->exists($this->phpbb_root_path . 'ext/' . $ext_name . '/composer.json'))
{
$skip_file = true;
break;
}
}
if ($skip_file)
{
continue;
}
}
if (!$this->filesystem->exists($file))
{
$file_update_info['new'][] = $filename;

View File

@ -32,6 +32,10 @@ class updater_configuration implements ConfigurationInterface
->addDefaultsIfNotSet()
->children()
->enumNode('type')->values(['all','db_only'])->defaultValue('all')->end()
->arrayNode('extensions')
->prototype('scalar')->end()
->defaultValue([])
->end()
->end()
;

View File

@ -309,6 +309,8 @@ class phpbb_functional_test_case extends phpbb_test_case
$container->register('installer.install_finish.notify_user')->setSynthetic(true);
$container->set('installer.install_finish.notify_user', new phpbb_mock_null_installer_task());
$container->register('installer.install_finish.install_extensions')->setSynthetic(true);
$container->set('installer.install_finish.install_extensions', new phpbb_mock_null_installer_task());
$container->compile();
$language = $container->get('language');