Skip to content

Commit

Permalink
UNC v1.0.3
Browse files Browse the repository at this point in the history
Signed-off-by: Dark❶ <dark-1@users.noreply.github.com>
  • Loading branch information
Dark❶ committed Feb 5, 2021
1 parent 047563a commit 0acf122
Show file tree
Hide file tree
Showing 14 changed files with 340 additions and 180 deletions.
137 changes: 83 additions & 54 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,87 @@
name: Actions CI

env:
EXTNAME: dark1/usernotificationcontrol # Your extension vendor/package name
SNIFF: 1 # Run code sniffer on your code? 1 or 0
IMAGE_ICC: 1 # Run icc profile sniffer on your images? 1 or 0
EPV: 1 # Run EPV (Extension Pre Validator) on your code? 1 or 0
EXECUTABLE_FILES: 1 # Run check for executable files? 1 or 0
PHPBB_BRANCH: 3.3.x # The phpBB branch to run tests on

on:
push:
branches:
- master
pull_request:
branches:
- master
push:
branches: # Run tests when commits are pushed to these branches in your repo
- master
pull_request: # Run tests when pull requests are made on these branches in your repo
branches:
- master

jobs:
check:
name: Check
if: (!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]'))
runs-on: ubuntu-latest
env:
PHPBB_BRANCH: 3.3.x # phpBB Branch
EXTNAME: dark1/usernotificationcontrol # CHANGE name of the extension HERE
SNIFF: 1 # Should we run code sniffer on your code?
EPV: 1 # Should we run EPV (Extension Pre Validator) on your code?

steps:

- name: Actions Checkout
uses: actions/checkout@v1

- name: Actions Setup - Copy to Temp Location
run: |
mkdir --parents ../tmp
cp -R . ../tmp
- name: Actions Setup - Clone phpBB
run: |
git clone --depth=1 git://github.com/phpbb/phpbb.git phpBB3 --branch=$PHPBB_BRANCH
- name: Actions Setup - Composer Install/Remove/Require
run: |
cd phpBB3/phpBB
composer install --no-interaction --no-progress --no-suggest --ignore-platform-reqs
composer remove sami/sami --no-interaction --no-progress --ignore-platform-reqs --dev
composer require phpbb/epv:dev-master --no-interaction --no-progress --no-suggest --ignore-platform-reqs --dev
cd ../../
- name: Actions Setup - Copy from Temp Location
run: |
mkdir --parents phpBB3/phpBB/ext/$EXTNAME/$EXTNAME
cp -R ../tmp/* phpBB3/phpBB/ext/$EXTNAME/$EXTNAME
- name: Actions Test - Code Sniffer
run: |
cd phpBB3
sh -c "if [ '$SNIFF' != '0' ]; then phpBB/vendor/bin/phpcs -s --extensions=php --standard=build/code_sniffer/ruleset-php-extensions.xml "--ignore=*/$EXTNAME/tests/*" "--ignore=*/$EXTNAME/vendor/*" "phpBB/ext/$EXTNAME"; fi"
cd ../
- name: Actions Test - EPV (Extension Pre Validator)
run: |
cd phpBB3
sh -c "if [ '$EPV' != '0' ]; then phpBB/vendor/bin/EPV.php run --dir='phpBB/ext/$EXTNAME' --debug; fi"
cd ../
# START Basic Checks Job (EPV, code sniffer, images check, etc.)
basic-checks:
if: (!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]'))
runs-on: ubuntu-18.04
strategy:
matrix:
include:
- php: '7.1'
db: "none"
NOTESTS: 1

name: PHP ${{ matrix.php }} - ${{ matrix.db }}

steps:
- name: Checkout phpBB
uses: actions/checkout@v2
with:
repository: phpbb/phpbb
ref: ${{ env.PHPBB_BRANCH }}
path: phpBB3

- name: Checkout extension
uses: actions/checkout@v2
with:
path: phpBB3/phpBB/ext/${{ env.EXTNAME }}/${{ env.EXTNAME }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysqli, sqlite, pdo_sqlite, intl, gd, exif, iconv, sqlsrv, pdo_sqlsrv, ldap
coverage: none

- name: Setup environment for phpBB
env:
DB: ${{ matrix.db }}
PHP_VERSION: ${{ matrix.php }}
NOTESTS: '1'
run: .github/setup-phpbb.sh $DB $PHP_VERSION $NOTESTS
working-directory: ./phpBB3

- name: Setup EPV
if: ${{ env.EPV != 0 }}
run: composer require phpbb/epv:dev-master --dev --no-interaction --ignore-platform-reqs
working-directory: ./phpBB3/phpBB

- name: Run code sniffer
if: ${{ env.SNIFF != 0 }}
env:
NOTESTS: '1'
run: .github/ext-sniff.sh $EXTNAME/$EXTNAME $NOTESTS
working-directory: ./phpBB3

- name: Check image ICC profiles
if: ${{ env.IMAGE_ICC != 0 }}
run: .github/check-image-icc-profiles.sh
working-directory: ./phpBB3

- name: Check executable files
if: ${{ env.EXECUTABLE_FILES != 0 }}
run: .github/ext-check-executable-files.sh ./ $EXTNAME/$EXTNAME
working-directory: ./phpBB3

- name: Run EPV
if: ${{ env.EPV != 0 }}
run: phpBB/vendor/bin/EPV.php run --dir="phpBB/ext/$EXTNAME/" --debug
working-directory: ./phpBB3
# END Basic Checks Job
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ Kindly note , this Extension does not allow to Create any New OR Delete any Noti


#### Status Badge for User Notification Control [UNC] on phpBB v3.3.x :
![Travis-CI](https://img.shields.io/badge/Travis-CI-8000FF.svg) : [![Build Status](https://travis-ci.com/dark-1/usernotificationcontrol.svg?branch=master)](https://travis-ci.com/dark-1/usernotificationcontrol)
![Scrutinizer-CI](https://img.shields.io/badge/Scrutinizer-CI-8000FF.svg) : [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/dark-1/usernotificationcontrol/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dark-1/usernotificationcontrol/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/dark-1/usernotificationcontrol/badges/build.png?b=master)](https://scrutinizer-ci.com/g/dark-1/usernotificationcontrol/build-status/master)
![Actions-CI](https://img.shields.io/badge/Actions-CI-8000FF.svg) : [![Actions Status](https://github.com/dark-1/usernotificationcontrol/workflows/Actions%20CI/badge.svg)](https://github.com/dark-1/usernotificationcontrol/actions?workflow=Actions%20CI)
![Scrutinizer-CI](https://img.shields.io/badge/Scrutinizer-CI-8000FF.svg) : [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/dark-1/usernotificationcontrol/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dark-1/usernotificationcontrol/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/dark-1/usernotificationcontrol/badges/build.png?b=master)](https://scrutinizer-ci.com/g/dark-1/usernotificationcontrol/build-status/master)
![Shields.IO](https://img.shields.io/badge/Shields-IO-8000FF.svg?style=flat-square) : [![GitHub release](https://img.shields.io/github/release/dark-1/usernotificationcontrol.svg?style=flat-square) ![license](https://img.shields.io/github/license/dark-1/usernotificationcontrol.svg?style=flat-square)](https://github.com/dark-1/usernotificationcontrol)


Expand Down
2 changes: 1 addition & 1 deletion acp/main_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function main($id, $mode)
$mode = strtolower($mode);

// check for valid Mode
if (class_exists('dark1\usernotificationcontrol\controller\acp_' . $mode))
if ($phpbb_container->has('dark1.usernotificationcontrol.controller.acp.' . $mode))
{
// Get ACP controller for Mode
$acp_controller = $phpbb_container->get('dark1.usernotificationcontrol.controller.acp.' . $mode);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "phpbb-extension",
"description": "User Notification Control [UNC]",
"homepage": "https://phpbb.com/customise/db/extension/user_notification_control",
"version": "1.0.2",
"version": "1.0.3",
"time": "2021-01-21",
"keywords": [
"phpbb",
Expand Down
12 changes: 10 additions & 2 deletions config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ services:
- '@cache.driver'
- '%core.table_prefix%'

dark1.usernotificationcontrol.unc_helper:
class: dark1\usernotificationcontrol\core\unc_helper
arguments:
- '@user'
- '@ext.manager'
- '@notification.type_collection'
- '@notification.method_collection'
- '%core.php_ext%'

dark1.usernotificationcontrol.controller.acp.main:
class: dark1\usernotificationcontrol\controller\acp_main
arguments:
Expand All @@ -18,8 +27,7 @@ services:
- '@config'
- '@dispatcher'
- '@dark1.usernotificationcontrol.unc_table'
- '@notification.type_collection'
- '@notification.method_collection'
- '@dark1.usernotificationcontrol.unc_helper'

dark1.usernotificationcontrol.listener:
class: dark1\usernotificationcontrol\event\main_listener
Expand Down
20 changes: 10 additions & 10 deletions controller/acp_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@
*/
class acp_base
{
/** @var \phpbb\language\language */
/** @var language */
protected $language;

/** @var \phpbb\log\log */
/** @var log */
protected $log;

/** @var \phpbb\request\request */
/** @var request */
protected $request;

/** @var \phpbb\template\template */
/** @var template */
protected $template;

/** @var \phpbb\user */
/** @var user */
protected $user;

/** @var string The module ID */
Expand All @@ -51,11 +51,11 @@ class acp_base
/**
* Constructor.
*
* @param \phpbb\language\language $language Language object
* @param \phpbb\log\log $log Log object
* @param \phpbb\request\request $request Request object
* @param \phpbb\template\template $template Template object
* @param \phpbb\user $user User object
* @param language $language Language object
* @param log $log Log object
* @param request $request Request object
* @param template $template Template object
* @param user $user User object
*/
public function __construct(language $language, log $log, request $request, template $template, user $user)
{
Expand Down
Loading

0 comments on commit 0acf122

Please sign in to comment.