Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactoring #15

Merged
merged 123 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 120 commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
4a4eb28
fix: update & ignore vendor.
Oct 22, 2024
2d8ce7d
fix: add context detection js.
Oct 23, 2024
0d68dad
fix: add ts support.
Oct 23, 2024
22be543
fix: add test suite, add hookable, add acf service, add settings page.
Oct 23, 2024
cdd34d5
fix: utilize wpservice and acf service.
Oct 23, 2024
98de42f
fix: restructuring in progress. tests.
Oct 23, 2024
95f1fbf
Create Installer.php
Oct 23, 2024
8a87f1c
feat: installer, db, config
Oct 24, 2024
3fae1c7
fix: update config, utilize in installer. Remove static stuff, outsid…
Oct 25, 2024
da29f93
fix: remove depecnecy of constants.
Oct 25, 2024
cde7f6f
fix: make runable.
Oct 25, 2024
4e5ed01
wip: log, and db stuff.
Oct 25, 2024
2793a30
feat: link updater.
Oct 25, 2024
acb01c5
fix: rename log to registry, refactor internal link updater.
Oct 25, 2024
bea7320
fix: add interface & docs to LinkUpdater class.
Oct 25, 2024
f9aaad9
fix: add interface for installer
Oct 25, 2024
0b9b84b
fix: add if to text domain
Oct 28, 2024
e672025
fix: add editor as hookable if
Oct 28, 2024
1cda104
fix: add tests to link replacer
Oct 28, 2024
137a39e
fix: move detector of broken links to detect dir.
Oct 28, 2024
8fd9335
fix: enshure that all permalinks lack / at the end.
Oct 28, 2024
4242e85
fix: add test to link change detect.
Oct 28, 2024
2e57d15
fix: add isEnabledEnumList.
Oct 28, 2024
991fa77
fix: use feature enum in app.
Oct 28, 2024
11a937b
fix: add more enums to isEnabled, utilize isEnabled in App
Oct 28, 2024
aeb2f94
feat: add classification of urls function.
Oct 28, 2024
8bcc4a6
feat: add feature interface configuration.
Oct 28, 2024
a0a7bca
feat: add linklist and link items. Expand classify to do link checkin…
Oct 29, 2024
fce6084
Add link checking to classification method.
Oct 29, 2024
cb4586b
fix: restructure link registry, wip link finder.
Oct 29, 2024
8f64f85
Fix manage registry
Oct 29, 2024
e4c9e3f
fix: link finder in posts, and dns lookup fix.
Oct 30, 2024
14246e6
fix: return type and docs for new dns lookup feature.
Oct 30, 2024
6d9a436
fix: docs
Oct 30, 2024
6db857c
fix: docs and return type
Oct 30, 2024
a247547
fix: check dns before probing url
Oct 30, 2024
5bc5ab4
fix: change to 503 error when domain wasent found
Oct 30, 2024
bd92efd
fix: add http code in results table
Oct 30, 2024
c27b7bc
fix: handle Link & LinkList add function in registry management.
Oct 31, 2024
ad8bc0f
feat: cli actions
Oct 31, 2024
90c85e1
fix: add database management cli.
Oct 31, 2024
5488a56
fix: add feature
Oct 31, 2024
22f21f8
fix: make command commons an abstract to avoid lint errors
Oct 31, 2024
13227f6
fix: change abstract.
Oct 31, 2024
be7894d
fix: installers cli
Nov 1, 2024
379b0da
fix: nullable classification
Nov 1, 2024
539e578
feat: link classification cli
Nov 1, 2024
5c22fc6
fix: manage log messages to make output clear.
Nov 5, 2024
fa49646
fix: cache dns responses.
Nov 5, 2024
7270bfc
fix: update by url, normalize urls in database.
Nov 5, 2024
37b45e5
fix: summary.
Nov 5, 2024
0815aaa
fix: cache results if a link occurs multiple times.
Nov 5, 2024
b05637e
Allow getUnclassifiedLinks to limit number of links.
Nov 5, 2024
62f2b6a
fix: set a timelimit on how old a classification can be to be conside…
Nov 5, 2024
5bf1514
fix: reformulate, use different types of logs deptending on results.
Nov 5, 2024
9645be5
fix: show progress and estimated time in cli.
Nov 6, 2024
305e2aa
fix: implement limit argument on classify links.
Nov 6, 2024
191dda9
fix: add tests for link classification
Nov 6, 2024
e6b26c7
chore: add .devcontainer config files
thorbrink Nov 6, 2024
fd34cfd
chore: test for link classifications
Nov 6, 2024
02d6ca9
Merge branch 'feat/link-not-avabile' of https://github.com/helsingbor…
Nov 6, 2024
79fa8c3
chore: add test suite for e2e tests
thorbrink Nov 6, 2024
3ab5fda
Merge branch 'merge' into feat/link-not-avabile
thorbrink Nov 6, 2024
2b13032
chore: setup e2e test suite on devcontainer start
thorbrink Nov 6, 2024
3577ad2
fix: link replacer tests by minimizing test scope to relevant size.
Nov 6, 2024
d4299e2
Merge branch 'feat/link-not-avabile' of https://github.com/helsingbor…
Nov 6, 2024
71b4a18
fix: re-add commented out code
thorbrink Nov 6, 2024
91f8e94
Merge remote-tracking branch 'refs/remotes/origin/feat/link-not-avabi…
thorbrink Nov 6, 2024
74742e9
test: add test to verify broken link
thorbrink Nov 6, 2024
16a22e8
fix: add useragent to classify request
thorbrink Nov 6, 2024
d4dcbbb
test: http scb
thorbrink Nov 6, 2024
d02381a
fix: add Sec-Fetch-Mode header for facebook requests
thorbrink Nov 6, 2024
c73353a
feat: list broken links on results page.
Nov 7, 2024
7ed9eea
fix: render links in report with filter / order.
Nov 8, 2024
7e852f7
fix: fatal fix, do not classify domains in list.
Nov 8, 2024
9498ea2
feat: assets
Nov 8, 2024
62db1e0
fix: rename configuration field.
Nov 11, 2024
c75254e
fix: get links to classify random.
Nov 11, 2024
1933485
fix: field config, and move file location.
Nov 11, 2024
8551b12
fix: correctly enqueue js.
Nov 11, 2024
5f0c581
fix: pass data from config, rename public var.
Nov 11, 2024
7715512
fix: dist build
Nov 11, 2024
ce4669b
fix: add labels to unavabile links.
Nov 11, 2024
429f1ff
fix: add config functions
Nov 11, 2024
8273953
fix: context detector tooltip.
Nov 12, 2024
1c49c9c
fix: handle source uncreachable.
Nov 12, 2024
3e75fe6
feat: allow asset registry to define hook.
Nov 12, 2024
9422e1d
fix: update interface with all functions avabile in config.
Nov 12, 2024
763d6ea
fix: structure features.
Nov 12, 2024
67dd432
feat: allow a number to be targeted in isEnabled feature select.
Nov 12, 2024
b8c97f0
fix: cleanup
Nov 12, 2024
f6f8c0f
fix: add cli runner to constructor. Prepare asset registry for MCE su…
Nov 12, 2024
4ab49a9
fix: pass registry to assets if needed.
Nov 12, 2024
b87918b
fix: editor highlight outline
Nov 12, 2024
aa67bea
fix: mark links as unavabile in the editor when broken
Nov 12, 2024
5b25b1f
fix: remove old enqueue function for editor js.
Nov 12, 2024
6406908
fix: update documentation.
Nov 12, 2024
adbc099
fix: add posibility to only query links in single post.
Nov 12, 2024
51cc0a6
feat: add link maintainging logic
Nov 12, 2024
d14e4e2
fix: add acf service to failing tests.
Nov 13, 2024
457f20e
fix: add missing use statement, add doc to maintainer.
Nov 13, 2024
41ca73a
fix: do not add links that shouldent be classified to results list.
Nov 13, 2024
8952661
fix: delete unused files.
Nov 13, 2024
7bf330b
fix: update package json
Nov 13, 2024
c2befd8
fix: remove public functions
Nov 13, 2024
f85d297
fix: remove template path since this is never used.
Nov 13, 2024
9ff3efb
fix: remove old uninstall file
Nov 13, 2024
5cb407c
fix: register css to show not-allowed pointer event. Remove old mce c…
Nov 13, 2024
a12cb45
fix: update swedish translations
Nov 13, 2024
993bede
fix: check for tiny mce less.
Nov 13, 2024
00d8385
fix: implement retries limit for tinymce.
Nov 13, 2024
1b92c46
fix: remove obvious comments.
Nov 13, 2024
c9cf2bd
chore: add cli documentation
Nov 13, 2024
838e47d
fix: hirarcy docs
Nov 13, 2024
37059e2
chore: update buildfiles and test workflows
Nov 13, 2024
1a0478b
fix: do not register cli commands outside the cli context
Nov 13, 2024
da27e1b
fix: documentation for admin user interface.
Nov 13, 2024
c7f4386
fix: search in correct post statuses
Nov 14, 2024
f3f8d9a
fix: check if dns_get_record is avabile before using it.
Nov 14, 2024
53f1526
fix: remove som more files from built version.
Nov 14, 2024
b5ac32c
fix: avoid warnings from dns_get_record.
Nov 14, 2024
48ebe61
fix: increase recheck interval to a high value.
Nov 14, 2024
46f70a4
feat!: upgrade to new major.
Nov 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# WordPress version can be any of the listed tags from https://hub.docker.com/_/wordpress/tags
# E.g. latest, 6.2, ...
ARG WORDPRESS_VERSION=latest

# PHP Variant can be any of the listed tags from https://mcr.microsoft.com/v2/devcontainers/php/tags/list
ARG PHP_VARIANT=8.3-bullseye

FROM wordpress:${WORDPRESS_VERSION}
FROM mcr.microsoft.com/vscode/devcontainers/php:${PHP_VARIANT}

# Copy WordPress files from wordpress container.
COPY --from=0 /usr/src/wordpress/ /var/www/html/

# Make vscode owner of all WordPress files.
RUN chown -R vscode:vscode /var/www/html

# Install php-mysql driver
RUN docker-php-ext-install mysqli pdo pdo_mysql

# Install additional packages for running e2e tests
RUN apt-get update && \
apt-get install -y subversion && \
apt-get install -y default-mysql-client

# Enable apache mods
RUN a2enmod rewrite expires

# Install WP-CLI
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar && sudo mv wp-cli.phar /usr/local/bin/wp
1 change: 1 addition & 0 deletions .devcontainer/config/_.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MUNICIPIO_ACF_PRO_KEY=b3JkZXJfaWQ9ODE2NDZ8dHlwZT1kZXZlbG9wZXJ8ZGF0ZT0yMDE2LTA1LTE2IDExOjEyOjQ4
58 changes: 58 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/php-mariadb
{
"name": "PHP & MySQL",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"forwardPorts": [
80,
3306
],
"portsAttributes": {
"80": {
"label": "WordPress"
},
"3306": {
"label": "Database"
}
},
"remoteEnv": {
"XDEBUG_MODE": "off"
},
"customizations": {
"vscode": {
"extensions": [
"xdebug.php-debug",
"ms-azuretools.vscode-docker",
"ritwickdey.liveserver"
],
"settings": {
"intelephense.environment.includePaths": [
"/var/www/html",
"/tmp/wordpress-tests-lib/includes"
],
"intelephense.environment.phpVersion": "8.3"
}
}
},
"features": {
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
"packages": "curl,nano,bash-completion",
"upgradePackages": true
},
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,
"version": "16"
}
},
"postCreateCommand": {
"symlink-plugin": "ln -s \"$(pwd)\" \"/var/www/html/wp-content/plugins/$(basename \"$PWD\")\"",
"symlink-wp-config-local": "ln -s \"$(pwd)/.devcontainer/wp-config-local.php\" /var/www/html/wp-config-local.php",
"symlink-wp-config": "ln -s \"$(pwd)/.devcontainer/wp-config.php\" /var/www/html/wp-config.php",
"start-apache": "service apache2 start",
"setup-e2e-tests": "composer test:setup:e2e"
},
"waitFor": "postCreateCommand",
"remoteUser": "vscode"
}
37 changes: 37 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: '3.8'

services:
app:
# env_file: devcontainer.env
build:
context: .
dockerfile: Dockerfile

volumes:
- ../..:/workspaces:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db

# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

db:
image: mariadb:10.4
restart: always
volumes:
- db-data:/var/lib/mysql
environment:
MYSQL_DATABASE: dev
MYSQL_ROOT_PASSWORD: dev
MYSQL_USER: dev
MYSQL_PASSWORD: dev

# Add "forwardPorts": ["3306"] to **devcontainer.json** to forward MariaDB locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

volumes:
db-data:
106 changes: 106 additions & 0 deletions .devcontainer/wp-config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php

/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the installation.
* You don't have to use the web site, you can copy this file to "wp-config.php"
* and fill in the values.
*
* This file contains the following configurations:
*
* * Database settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://wordpress.org/documentation/article/editing-wp-config-php/
*
* @package WordPress
*/

if (file_exists(__DIR__ . '/wp-config-local.php')) {
require __DIR__ . '/wp-config-local.php';
}

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
if (!defined('DB_NAME')) define('DB_NAME', 'dev');

/** Database username */
if (!defined('DB_USER')) define('DB_USER', 'dev');

/** Database password */
if (!defined('DB_PASSWORD')) define('DB_PASSWORD', 'dev');

/** Database hostname */
if (!defined('DB_HOST')) define('DB_HOST', 'db');

/** Database charset to use in creating database tables. */
if (!defined('DB_CHARSET')) define('DB_CHARSET', 'utf8mb4');

/** The database collate type. Don't change this if in doubt. */
if (!defined('DB_COLLATE')) define('DB_COLLATE', '');

if (!defined('WP_SITEURL')) define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] ?? 'localhost');
if (!defined('WP_HOME')) define('WP_HOME', WP_SITEURL);
if (!defined('WP_CONTENT_URL')) define('WP_CONTENT_URL', WP_SITEURL . '/wp-content');

/**#@+
* Authentication unique keys and salts.
*
* Change these to different unique phrases! You can generate these using
* the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
*
* You can change these at any point in time to invalidate all existing cookies.
* This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', '(J.hL1=7inY7O%xo.1K^b1*=NQ!AvkBfq>HHW}D6T#6ktdvZ4qMpm7OW+vR:pHxm');
define('SECURE_AUTH_KEY', 'pPwN{M1g=?j`me{7rE-7OtJN$zDS(y#uM7.1~.X~>m+#/ln~%Myo$Ca2mBFEa0s:');
define('LOGGED_IN_KEY', '8-AQ.XlAXQTq8:f2ddzxIs]xeC cE`ZdvAv9S=*bg>I~bHT/jGLyXW4=)!rhjz+g');
define('NONCE_KEY', '9{1MgwMd|^-i3OIy(`4jmEk5T/%1Q_i^bB&h%Jc7: :m]Ic7e&fkc=8YV_2|A~Fs');
define('AUTH_SALT', 'P(}]`j]rI]Rzd<NTP`1A|aNg`)I&5cNjxZ3cb,C]PDRFeOgys@?}lV)8omoqq|UZ');
define('SECURE_AUTH_SALT', 'r./W6cc]R;#&[Isz7$`<G@4UM0qIe|mLwu;kZzG:o@[T^ML&QyN!K!Lb88X3n{<h');
define('LOGGED_IN_SALT', 'R:O%d{!<Ua/sf9zc6/^G;I*!+,&<UFgJ&hD r6GZ]x@Q[j#;&;X&&JQdJG~eqN1[');
define('NONCE_SALT', '^G^t@e9n!ys-{?yz V9&U2zCsyEVI_P3C4>S*{U]Y#(n~NzR|*Xx)6{0*/kvY^pc');

/**#@-*/

/**
* WordPress database table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
if (!isset($table_prefix)) $table_prefix = 'wp_';

/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://wordpress.org/documentation/article/debugging-in-wordpress/
*/
define('WP_DEBUG', true);
if (!defined('WP_DEBUG')) define('WP_DEBUG', false);

define('WP_DEBUG_LOG', true);

/* Add any custom values between this line and the "stop editing" line. */



/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if (!defined('ABSPATH')) define('ABSPATH', __DIR__ . '/');

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
50 changes: 50 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build assets and create a release on version tags

on:
push:
tags:
- 'v*.*.*'
jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: '16'

- name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer:v2

- name: Inject access token in .npmrc
run: |
echo "registry=https://npm.pkg.github.com/helsingborg-stad" >> ~/.npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> ~/.npmrc

- name: Run full build.
run: php ./build.php --cleanup

- name: Cleanup .npmrc
run: rm ~/.npmrc

- name: Archive Release
uses: thedoctor0/zip-release@master
with:
filename: 'full-release.zip'

- name: Release
uses: docker://antonyurchenko/git-release:latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRAFT_RELEASE: "false"
PRE_RELEASE: "false"
CHANGELOG_FILE: "none"
with:
args: |
full-release.zip
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Create Release and bump version files
uses: helsingborg-stad/[email protected]
with:
php-version: 8.2
php-version: 8.3
node-version: 20.6.0
build-assets:
needs: ['release']
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20.6.0
node-version: 20
- name: Inject access token in .npmrc
run: |
echo "registry=https://npm.pkg.github.com/helsingborg-stad" >> ~/.npmrc
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
if: ${{ hashFiles('composer.json') != '' }}
with:
tools: composer
php-version: '7.4'
php-version: '8.3'

- name: Build PHP
if: ${{ hashFiles('composer.json') != '' }}
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/test-js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test JS

on:
push:
branches: [ 3.0/develop, master ]
pull_request:
branches: [ 3.0/develop, master ]

jobs:
test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '16.x'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
29 changes: 29 additions & 0 deletions .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test:PHP

on:
pull_request:

jobs:

test:

runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
php-version: '8.2'
tools: composer:v2

- name: Install dependencies
run: composer i

- name: Run tests
run: composer test
Loading
Loading