Merge pull request #295 from marc1706/ticket/294

[ticket/294] Use composer dependencies for coveralls
This commit is contained in:
Marc Alexander
2014-07-07 23:53:06 +02:00
14 changed files with 615 additions and 117 deletions

View File

@@ -1,5 +1,5 @@
#.coveralls.yml
src_dir: .
coverage_clover: ../build/logs/clover.xml
json_path: ../build/logs/coveralls-upload.json
src_dir: ../../phpBB3
coverage_clover: ../../phpBB3/build/logs/clover.xml
json_path: ../../phpBB3/build/logs/coveralls-upload.json

3
.gitattributes vendored
View File

@@ -7,3 +7,6 @@ travis/ export-ignore
phpunit.xml.* export-ignore
README.md export-ignore
git-tools/ export-ignore
.coveralls.yml export-ignore
composer.phar export-ignore
composer.lock export-ignore

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
/.idea/*
/tests/test_config.php
/vendor/

View File

@@ -29,8 +29,8 @@ matrix:
env:
global:
- EXTNAME="board3/portal"
- SNIFF="1" # Should we run code sniffer on your code?
- IMAGE_ICC="1" # Should we run icc profile sniffer on your images?
- SNIFF="0" # Should we run code sniffer on your code?
- IMAGE_ICC="0" # Should we run icc profile sniffer on your images?
- COVERALLS="1" # Should we run coveralls?
- PHPBB_BRANCH="develop-ascraeus"
@@ -40,10 +40,10 @@ branches:
- develop-1_0_X
install:
- php composer.phar install --dev --no-interaction --prefer-source
- travis/prepare-phpbb.sh $EXTNAME $PHPBB_BRANCH
- cp .coveralls.yml ../../phpBB3/phpBB/.coveralls.yml
- cd ../../phpBB3
- sh -c "if [ '$COVERALLS' != '0' ]; then ../board3/Board3-Portal/travis/prepare-coveralls.sh $DB $TRAVIS_PHP_VERSION; fi"
- travis/prepare-extension.sh $EXTNAME $PHPBB_BRANCH
- travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION
- sh -c "if [ '$COVERALLS' != '0' ]; then ../board3/Board3-Portal/travis/prepare-coverage.sh $DB $TRAVIS_PHP_VERSION; fi"
@@ -59,7 +59,7 @@ script:
- ../board3/Board3-Portal/travis/run-testsuite.sh $DB $TRAVIS_PHP_VERSION
after_script:
- php phpBB/vendor/bin/coveralls -v
- php ../board3/Board3-Portal/vendor/bin/coveralls -v
notifications:
email:

View File

@@ -15,12 +15,9 @@ class portal_module
public $new_config = array();
protected $c_class;
protected $db, $user, $cache, $template, $display_vars, $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container;
protected $root_path, $version_check, $request, $php_ext;
protected $root_path, $version_check, $request, $php_ext, $portal_helper;
public $module_column = array();
/** @var \phpbb\di\service_collection Portal modules */
protected $modules;
public function __construct()
{
global $db, $user, $cache, $request, $template, $table_prefix;
@@ -43,7 +40,7 @@ class portal_module
$this->php_ext = $phpEx;
$this->phpbb_container = $phpbb_container;
$this->version_check = $this->phpbb_container->get('board3.version.check');
$this->register_modules($this->phpbb_container->get('board3.module_collection'));
$this->portal_helper = $this->phpbb_container->get('board3.portal.helper');
define('PORTAL_MODULES_TABLE', $this->phpbb_container->getParameter('board3.modules.table'));
define('PORTAL_CONFIG_TABLE', $this->phpbb_container->getParameter('board3.config.table'));
@@ -103,25 +100,10 @@ class portal_module
if ($module_data !== false)
{
if (!isset($this->modules[$module_data['module_classname']]))
if (!($this->c_class = $this->portal_helper->get_module($module_data['module_classname'])))
{
$class = 'portal_' . $module_data['module_classname'] . '_module';
if (!class_exists($class))
{
include($this->root_path . 'portal/modules/portal_' . $module_data['module_classname'] . '.' . $this->php_ext);
}
if (class_exists($class))
{
$this->c_class = new $class();
}
else
{
continue;
}
}
else
{
$this->c_class = $this->modules[$module_data['module_classname']];
continue;
}
if ($this->c_class->get_language())
@@ -434,11 +416,7 @@ class portal_module
trigger_error($this->user->lang['MODULE_ADD_ONCE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
if (isset($this->modules[$module_classname]))
{
$this->c_class = $this->modules[$module_classname];
}
else
if (!($this->c_class = $this->portal_helper->get_module($module_classname)))
{
continue;
}
@@ -501,9 +479,10 @@ class portal_module
$this->template->assign_var('S_EDIT', true);
$fileinfo = $name_ary = array();
$column_string = column_num_string($add_column);
$modules_list = $this->portal_helper->get_all_modules();
// Find new modules
foreach ($this->modules as $module_class => $module)
foreach ($modules_list as $module_class => $module)
{
if ($module_class !== '\board3\portal\modules\custom')
{
@@ -586,14 +565,10 @@ class portal_module
foreach($portal_modules as $row)
{
if (!isset($this->modules[$row['module_classname']]))
if (!($this->c_class = $this->portal_helper->get_module($row['module_classname'])))
{
continue;
}
else
{
$this->c_class = $this->modules[$row['module_classname']];
}
if ($this->c_class->get_language())
{
@@ -753,13 +728,11 @@ class portal_module
$module_data = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
if (!isset($this->modules[$module_data['module_classname']]))
if (!($this->c_class = $this->portal_helper->get_module($module_data['module_classname'])))
{
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
}
$this->c_class = $this->modules[$module_data['module_classname']];
$sql_ary = array(
'module_name' => $this->c_class->get_name(),
'module_image_src' => $this->c_class->get_image(),
@@ -939,12 +912,11 @@ class portal_module
{
$module_data = $this->get_move_module_data($module_id);
if (!isset($this->modules[$module_data['module_classname']]))
if (!($this->c_class = $this->portal_helper->get_module($module_data['module_classname'])))
{
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
}
$this->c_class = $this->modules[$module_data['module_classname']];
$move_action = 0;
if ($module_data !== false && $module_data['module_column'] > column_string_num('left'))
@@ -1035,12 +1007,11 @@ class portal_module
{
$module_data = $this->get_move_module_data($module_id);
if (!isset($this->modules[$module_data['module_classname']]))
if (!($this->c_class = $this->portal_helper->get_module($module_data['module_classname'])))
{
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
}
$this->c_class = $this->modules[$module_data['module_classname']];
$move_action = 0;
if ($module_data !== false && $module_data['module_column'] < column_string_num('right'))
@@ -1143,14 +1114,13 @@ class portal_module
{
$module_classname = $this->request->variable('module_classname', '');
if (!isset($this->modules[$module_classname]))
if (!($this->c_class = $this->portal_helper->get_module($module_classname)))
{
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
}
if (confirm_box(true))
{
$this->c_class = $this->modules[$module_classname];
$this->c_class->uninstall($module_data['module_id'], $this->db);
$sql = 'DELETE FROM ' . PORTAL_MODULES_TABLE . '
@@ -1178,7 +1148,6 @@ class portal_module
}
else
{
$this->c_class = $this->modules[$module_classname];
if ($this->c_class->get_language())
{
$this->user->add_lang_ext('board3/portal', 'modules/' . $this->c_class->get_language());
@@ -1209,25 +1178,6 @@ class portal_module
return preg_replace(array('/i=[0-9]+/', '/mode=[a-zA-Z0-9_]+/'), array('i=%5C' . str_replace('\\', '%5C', __CLASS__), 'mode=' . $mode), $this->u_action) . (($module_id) ? '&amp;module_id=' . $module_id : '');
}
/**
* Register list of Board3 Portal modules
*
* @param \phpbb\di\service_collection $modules Board3 Modules service
* collection
* @return null
*/
protected function register_modules($modules)
{
foreach ($modules as $current_module)
{
$class_name = '\\' . get_class($current_module);
if (!isset($this->modules[$class_name]))
{
$this->modules[$class_name] = $current_module;
}
}
}
/**
* Check if module can be moved to desired column(s)
*

View File

@@ -8,45 +8,40 @@
"license": "GPL-2.0",
"authors": [{
"name": "Marc Alexander",
"username": "marc1706",
"email": "admin@m-a-styles.de",
"homepage": "http://www.m-a-styles.de",
"role": "Lead Developer"
},
{
"name": "Joas Schilling",
"username": "nickvergessen",
"email": "nickvergessen@gmx.de",
"homepage": "http://mods.flying-bits.org",
"role": "Developer"
},
{
"name": "Kevin",
"username": "saint_hh",
"homepage": "http://www.board3.de",
"role": "Developer"
},
{
"name": "Ice",
"username": "avaren",
"homepage": "http://www.board3.de",
"role": "Developer"
},
{
"name": "Christian",
"username": "Christian_N",
"homepage": "http://www.phpbb-projekt.de",
"role": "Developer"
},
{
"name": "Walter",
"username": "Redbull254",
"email": "w.bobeth@digitalfotografie-foren.de",
"homepage": "http://www.digitalfotografie-foren.de",
"role": "Developer"
}],
"require": {
"php": ">=5.3.3"
"php": ">=5.3.3",
"satooshi/php-coveralls": "dev-master"
},
"extra": {
"display-name": "Board3 Portal",

544
composer.lock generated Normal file
View File

@@ -0,0 +1,544 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "dfb16d726d1c31c44d9dab2f34cc1d8d",
"packages": [
{
"name": "guzzle/guzzle",
"version": "v3.9.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle3.git",
"reference": "92d9934f2fca1da15178c91239576ae26e505e60"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle3/zipball/92d9934f2fca1da15178c91239576ae26e505e60",
"reference": "92d9934f2fca1da15178c91239576ae26e505e60",
"shasum": ""
},
"require": {
"ext-curl": "*",
"php": ">=5.3.3",
"symfony/event-dispatcher": "~2.1"
},
"replace": {
"guzzle/batch": "self.version",
"guzzle/cache": "self.version",
"guzzle/common": "self.version",
"guzzle/http": "self.version",
"guzzle/inflection": "self.version",
"guzzle/iterator": "self.version",
"guzzle/log": "self.version",
"guzzle/parser": "self.version",
"guzzle/plugin": "self.version",
"guzzle/plugin-async": "self.version",
"guzzle/plugin-backoff": "self.version",
"guzzle/plugin-cache": "self.version",
"guzzle/plugin-cookie": "self.version",
"guzzle/plugin-curlauth": "self.version",
"guzzle/plugin-error-response": "self.version",
"guzzle/plugin-history": "self.version",
"guzzle/plugin-log": "self.version",
"guzzle/plugin-md5": "self.version",
"guzzle/plugin-mock": "self.version",
"guzzle/plugin-oauth": "self.version",
"guzzle/service": "self.version",
"guzzle/stream": "self.version"
},
"require-dev": {
"doctrine/cache": "~1.3",
"monolog/monolog": "~1.0",
"phpunit/phpunit": "3.7.*",
"psr/log": "~1.0",
"symfony/class-loader": "~2.1",
"zendframework/zend-cache": "2.*,<2.3",
"zendframework/zend-log": "2.*,<2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.8-dev"
}
},
"autoload": {
"psr-0": {
"Guzzle": "src/",
"Guzzle\\Tests": "tests/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Guzzle Community",
"homepage": "https://github.com/guzzle/guzzle/contributors"
}
],
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
],
"time": "2014-05-07 17:04:22"
},
{
"name": "psr/log",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-0": {
"Psr\\Log\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2012-12-21 11:40:51"
},
{
"name": "satooshi/php-coveralls",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/satooshi/php-coveralls.git",
"reference": "cad73f9122027d15a43968f862cf2958e2ac5f7a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/cad73f9122027d15a43968f862cf2958e2ac5f7a",
"reference": "cad73f9122027d15a43968f862cf2958e2ac5f7a",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-simplexml": "*",
"guzzle/guzzle": ">=2.7",
"php": ">=5.3",
"psr/log": "1.0.0",
"symfony/config": ">=2.0",
"symfony/console": ">=2.0",
"symfony/stopwatch": ">=2.2",
"symfony/yaml": ">=2.0"
},
"require-dev": {
"apigen/apigen": "2.8.*@stable",
"pdepend/pdepend": "dev-master as 2.0.0",
"phpmd/phpmd": "dev-master",
"phpunit/php-invoker": ">=1.1.0,<1.2.0",
"phpunit/phpunit": "3.7.*@stable",
"sebastian/finder-facade": "dev-master",
"sebastian/phpcpd": "1.4.*@stable",
"squizlabs/php_codesniffer": "1.4.*@stable",
"theseer/fdomdocument": "dev-master"
},
"suggest": {
"symfony/http-kernel": "Allows Symfony integration"
},
"bin": [
"composer/bin/coveralls"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.7-dev"
}
},
"autoload": {
"psr-0": {
"Satooshi\\Component": "src/",
"Satooshi\\Bundle": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kitamura Satoshi",
"email": "with.no.parachute@gmail.com",
"homepage": "https://www.facebook.com/satooshi.jp"
}
],
"description": "PHP client library for Coveralls API",
"homepage": "https://github.com/satooshi/php-coveralls",
"keywords": [
"ci",
"coverage",
"github",
"test"
],
"time": "2014-06-24 23:45:40"
},
{
"name": "symfony/config",
"version": "v2.5.0",
"target-dir": "Symfony/Component/Config",
"source": {
"type": "git",
"url": "https://github.com/symfony/Config.git",
"reference": "9c8caadb38ecc69ac35ab31af4d1996944b5a09f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Config/zipball/9c8caadb38ecc69ac35ab31af4d1996944b5a09f",
"reference": "9c8caadb38ecc69ac35ab31af4d1996944b5a09f",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/filesystem": "~2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Config\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Config Component",
"homepage": "http://symfony.com",
"time": "2014-04-22 08:11:23"
},
{
"name": "symfony/console",
"version": "v2.5.0",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
"reference": "ef4ca73b0b3a10cbac653d3ca482d0cdd4502b2c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Console/zipball/ef4ca73b0b3a10cbac653d3ca482d0cdd4502b2c",
"reference": "ef4ca73b0b3a10cbac653d3ca482d0cdd4502b2c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/event-dispatcher": "~2.1"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Console\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Console Component",
"homepage": "http://symfony.com",
"time": "2014-05-22 08:54:24"
},
{
"name": "symfony/event-dispatcher",
"version": "v2.5.0",
"target-dir": "Symfony/Component/EventDispatcher",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher.git",
"reference": "cb62ec8dd05893fc8e4f0e6e21e326e1fc731fe8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/cb62ec8dd05893fc8e4f0e6e21e326e1fc731fe8",
"reference": "cb62ec8dd05893fc8e4f0e6e21e326e1fc731fe8",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~2.0",
"symfony/dependency-injection": "~2.0",
"symfony/stopwatch": "~2.2"
},
"suggest": {
"symfony/dependency-injection": "",
"symfony/http-kernel": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\EventDispatcher\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony EventDispatcher Component",
"homepage": "http://symfony.com",
"time": "2014-04-29 10:13:57"
},
{
"name": "symfony/filesystem",
"version": "v2.5.0",
"target-dir": "Symfony/Component/Filesystem",
"source": {
"type": "git",
"url": "https://github.com/symfony/Filesystem.git",
"reference": "98e831eac836a0a5911626ce82684155f21d0e4d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Filesystem/zipball/98e831eac836a0a5911626ce82684155f21d0e4d",
"reference": "98e831eac836a0a5911626ce82684155f21d0e4d",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Filesystem\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Filesystem Component",
"homepage": "http://symfony.com",
"time": "2014-04-16 10:36:21"
},
{
"name": "symfony/stopwatch",
"version": "v2.5.0",
"target-dir": "Symfony/Component/Stopwatch",
"source": {
"type": "git",
"url": "https://github.com/symfony/Stopwatch.git",
"reference": "724d73604ebe6c1c9bdf36533b556123bd9075a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Stopwatch/zipball/724d73604ebe6c1c9bdf36533b556123bd9075a1",
"reference": "724d73604ebe6c1c9bdf36533b556123bd9075a1",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Stopwatch\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Stopwatch Component",
"homepage": "http://symfony.com",
"time": "2014-04-18 20:40:13"
},
{
"name": "symfony/yaml",
"version": "v2.5.0",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "b4b09c68ec2f2727574544ef0173684281a5033c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/b4b09c68ec2f2727574544ef0173684281a5033c",
"reference": "b4b09c68ec2f2727574544ef0173684281a5033c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
"time": "2014-05-16 14:25:18"
}
],
"packages-dev": [
],
"aliases": [
],
"minimum-stability": "stable",
"stability-flags": {
"satooshi/php-coveralls": 20
},
"platform": {
"php": ">=5.3.3"
},
"platform-dev": [
]
}

BIN
composer.phar Executable file

Binary file not shown.

View File

@@ -80,7 +80,7 @@ class main
* @param \phpbb\template $template Template object
* @param \phpbb\user $user User object
* @param \phpbb\path_helper $path_helper phpBB path helper
* @param \board3\portal\includes\portal_helper $portal_helper Portal helper class
* @param \board3\portal\includes\helper $portal_helper Portal helper class
* @param string $phpbb_root_path phpBB root path
* @param string $php_ext PHP file extension
* @param string $config_table Board3 config table
@@ -120,19 +120,9 @@ class main
*/
public function handle()
{
$this->check_permission();
// We defined the phpBB objects in __construct() and can use them in the rest of our class like this
//echo 'Welcome, ' . $this->user->data['username'];
$this->run_initial_tasks();
// The following takes two arguments:
// 1) which extension language folder we're using (it's not smart enough to use its own automatically)
// 2) what language file to use
$this->user->add_lang_ext('board3/portal', 'portal');
/**
* get initial data
*/
$portal_config = obtain_portal_config();
// Set default data
$portal_modules = obtain_portal_modules();
$display_online = false;
@@ -182,19 +172,16 @@ class main
if ($row['module_column'] == column_string_num('left') && $this->config['board3_left_column'])
{
$template_module = $module->get_template_side($row['module_id']);
$template_column = 'left';
++$module_count['left'];
}
if ($row['module_column'] == column_string_num('center'))
{
$template_module = $module->get_template_center($row['module_id']);
$template_column = 'center';
++$module_count['center'];
}
if ($row['module_column'] == column_string_num('right') && $this->config['board3_right_column'])
{
$template_module = $module->get_template_side($row['module_id']);
$template_column = 'right';
++$module_count['right'];
}
if ($row['module_column'] == column_string_num('top'))
@@ -279,7 +266,12 @@ class main
page_footer();
}
// check if user should be able to access this page
/**
* Check if user should be able to access this page. Redirect to index
* if this does not apply.
*
* @return null
*/
protected function check_permission()
{
if (!isset($this->config['board3_enable']) || !$this->config['board3_enable'] || !$this->auth->acl_get('u_view_portal'))
@@ -287,4 +279,21 @@ class main
redirect(append_sid($this->phpbb_root_path . 'index' . $this->php_ext));
}
}
/**
* Run initial tasks that are required for a properly setup extension
*
* @return null
*/
protected function run_initial_tasks()
{
// Check for permissions first
$this->check_permission();
// Load language file
$this->user->add_lang_ext('board3/portal', 'portal');
// Obtain portal config
obtain_portal_config();
}
}

View File

@@ -52,6 +52,8 @@ class helper
* Get module specified by module class name
*
* @param string $module_name Module class name
*
* @return bool|object The module object if it exists, false if not
*/
public function get_module($module_name)
{
@@ -64,4 +66,14 @@ class helper
return false;
}
}
/**
* Get all supported modules
*
* @return array An array containing all supported modules
*/
public function get_all_modules()
{
return $this->modules;
}
}

View File

@@ -38,6 +38,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
new \board3\portal\modules\welcome($config, new \phpbb_mock_request, $this->db, $user, $phpbb_root_path, $phpEx),
new \board3\portal\modules\donation($config, $template, $user),
));
$phpbb_container->set('board3.portal.helper', new \board3\portal\includes\helper($phpbb_container->get('board3.module_collection')));
$phpbb_container->setParameter('board3.modules.table', $table_prefix . 'portal_modules');
$phpbb_container->setParameter('board3.config.table', $table_prefix . 'portal_config');
$cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put'));

View File

@@ -50,4 +50,9 @@ class board3_includes_helper_test extends \board3\portal\tests\testframework\tes
}
$this->assertEquals($expected, $this->portal_helper->get_module($module_name));
}
public function test_get_all_modules()
{
$this->assertEquals($this->modules, $this->portal_helper->get_all_modules());
}
}

View File

@@ -13,6 +13,6 @@ TRAVIS_PHP_VERSION=$2
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
then
sed -n '1h;1!H;${;g;s/<\/php>/<\/php>\n\t<filter>\n\t\t<whitelist>\n\t\t\t<directory>..\/<\/directory>\n\t\t\t<exclude>\n\t\t\t\t<directory>..\/tests\/<\/directory>\n\t\t\t\t<directory>..\/develop\/<\/directory>\n\t\t\t\t<directory>..\/language\/<\/directory>\n\t\t\t<\/exclude>\n\t\t<\/whitelist>\n\t<\/filter>/g;p;}' phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml &> phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml.bak
sed -n '1h;1!H;${;g;s/<\/php>/<\/php>\n\t<filter>\n\t\t<whitelist>\n\t\t\t<directory>..\/<\/directory>\n\t\t\t<exclude>\n\t\t\t\t<directory>..\/tests\/<\/directory>\n\t\t\t\t<directory>..\/develop\/<\/directory>\n\t\t\t\t<directory>..\/language\/<\/directory>\n\t\t\t\t<directory>..\/vendor\/<\/directory>\n\t\t\t<\/exclude>\n\t\t<\/whitelist>\n\t<\/filter>/g;p;}' phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml &> phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml.bak
cp phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml.bak phpBB/ext/board3/portal/travis/phpunit-mysqli-travis.xml
fi

View File

@@ -1,22 +0,0 @@
#!/bin/bash
#
# This file is part of the Board3 Portal package.
#
# @copyright (c) Board3 Group <http://www.board3.de>
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
#
set -e
set -x
DB=$1
TRAVIS_PHP_VERSION=$2
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
then
sed -n '1h;1!H;${;g;s/\"squizlabs\/php_codesniffer\": \"1.*\"/\"squizlabs\/php_codesniffer\": \"1.*\",\n\t\t\"satooshi\/php-coveralls\"\: \"dev-master\"/g;p;}' phpBB/composer.json &> composer.json
cp composer.json phpBB/composer.json
cd phpBB
rm composer.lock
php ../composer.phar update
cd ..
fi