Skip to content

Commit 3e66d18

Browse files
committed
Merge branch 'release-4.9.0-beta'
# Conflicts: # HISTORY.txt # INSTALL.txt # README.txt # UPGRADE.txt # package.json # textpattern/checksums.txt # textpattern/index.php # textpattern/textpattern.js # textpattern/vendors/Textpattern/DB/Data/core.prefs
2 parents b166539 + 6a16791 commit 3e66d18

479 files changed

Lines changed: 29628 additions & 7933 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODE_OF_CONDUCT.md

Lines changed: 0 additions & 72 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ Web server vendor and version: {Please write here}
2525
Database server vendor and version: {Please write here}
2626

2727
PHP version: {Please write here}
28+
29+
Operating system: {Please write here}

.github/get-classic-admin-theme.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ REPO="textpattern-classic-admin-theme";
66
EXTRACT="textpattern/admin-themes/classic";
77

88

9-
TAG="master";
9+
TAG="main";
1010
if [ ! -z "$1" ]; then
1111
TAG="$1";
1212
fi

.github/get-default-theme.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ REPO="textpattern-default-theme";
66
EXTRACT="textpattern/setup/themes";
77

88

9-
TAG="master";
9+
TAG="main";
1010
if [ ! -z "$1" ]; then
1111
TAG="$1";
1212
fi

.github/get-hive-admin-theme.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ EXTRACT1="textpattern/admin-themes";
77
EXTRACT2="sites/site1/admin/setup";
88

99

10-
TAG="master";
10+
TAG="main";
1111
if [ ! -z "$1" ]; then
1212
TAG="$1";
1313
fi

.github/txp-checksums.php

Lines changed: 71 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
* Textpattern Content Management System
55
* https://textpattern.com/
66
*
7-
* Copyright (C) 2022 The Textpattern Development Team
8-
*
9-
* This file is part of Textpattern.
7+
* Copyright (C) 2024 The Textpattern Development Team
108
*
119
* Textpattern is free software; you can redistribute it and/or
1210
* modify it under the terms of the GNU General Public License
@@ -18,58 +16,96 @@
1816
* GNU General Public License for more details.
1917
*
2018
* You should have received a copy of the GNU General Public License
21-
* along with Textpattern. If not, see <https://www.gnu.org/licenses/>.
19+
* along with Textpattern. If not, see <http://www.gnu.org/licenses/>.
2220
*/
2321

22+
define('txpinterface', 'cli');
23+
2424
if (php_sapi_name() !== 'cli') {
2525
die('command line only');
2626
}
2727

28-
define('txpath', 'textpattern');
28+
if (empty($argv[1])) {
29+
die("usage: {$argv[0]} <txpath> [update|rebuild]\n");
30+
}
31+
32+
$action = empty($argv[2]) ? 'update' : $argv[2];
33+
34+
define('txpath', rtrim(realpath($argv[1]), '/'));
2935
define('n', "\n");
3036

31-
// Find `.php` and `.js` files in `textpattern` directory.
32-
$files = glob_recursive('textpattern/*\.{php,js}', GLOB_BRACE);
33-
$files = preg_replace('%^textpattern%', '', $files);
34-
$files = array_flip($files);
37+
$event = '';
38+
$prefs['enable_xmlrpc_server'] = true;
39+
require_once(txpath.'/lib/constants.php');
40+
require_once(txpath.'/lib/txplib_misc.php');
41+
require_once(txpath.'/lib/txplib_admin.php');
42+
$files = array();
43+
$destination = txpath.DS.'checksums.txt';
3544

36-
$cs = @file_get_contents(txpath.'/checksums.txt');
37-
if (preg_match_all('%^(\S+):\s+([\da-f]+)%im', $cs, $mm)) {
38-
$out = '';
45+
switch ($action) {
46+
case 'update':
47+
$files = calculate_checksums();
48+
break;
49+
case 'rebuild':
50+
$files = files_to_checksum(txpath, '/.*\.(?:php|js)$/');
3951

40-
foreach ($mm[1] as $key => $file) {
41-
$md5 = md5_file(txpath.$file);
42-
$out .= "$file: $md5".n;
43-
unset($files[$file]);
44-
}
52+
// Append root and rpc files.
53+
$files = array_merge($files, glob(txpath.DS.'..'.DS.'*.php'));
54+
$files = array_merge($files, glob(txpath.DS.'..'.DS.'rpc'.DS.'*.php'));
55+
56+
// Remove setup and config-dist.php.
57+
$files = array_filter($files, function($e) { return (strpos($e, '/setup') === false); });
58+
$files = array_filter($files, function($e) { return (strpos($e, '/config-dist') === false); });
4559

46-
file_put_contents(txpath.'/checksums.txt', $out);
47-
echo "Checksums updated.\n\n";
60+
// Output list.
61+
if ($files) {
62+
$files = array_map(function ($str) { return str_replace(txpath, '', $str.": ".str_repeat('a', 32)); }, $files);
63+
file_put_contents($destination, implode(n, $files));
64+
$files = calculate_checksums();
65+
}
66+
break;
4867
}
4968

50-
// New files.
51-
$out = '';
69+
if ($files) {
70+
file_put_contents($destination, implode(n, $files));
71+
echo "Checksums updated in ".$destination.".\n";
72+
}
5273

53-
foreach ($files as $file => $val) {
54-
if (! preg_match('%^/(config-dist\.php|setup)%', $file)) {
55-
$out .= "$file: ".md5_file(txpath.'/'.$file).n;
74+
/**
75+
* Recursively fetch files from the given root.
76+
*
77+
* Dot files and directories are skipped.
78+
*
79+
* @param string $folder Path to the start point (root directory to traverse)
80+
* @param string $pattern Full regex filter to apply
81+
* @return array List of files
82+
*/
83+
function files_to_checksum($folder, $pattern)
84+
{
85+
$dir = new RecursiveDirectoryIterator($folder, RecursiveDirectoryIterator::SKIP_DOTS);
86+
$iter = new RecursiveIteratorIterator($dir);
87+
$files = new RegexIterator($iter, $pattern, RegexIterator::GET_MATCH);
88+
$fileList = array();
89+
90+
foreach ($files as $file) {
91+
$fileList = array_merge($fileList, $file);
5692
}
57-
}
5893

59-
if ($out) {
60-
echo "New files without checksums:".n.$out.n;
61-
echo "Add new files to 'checksums.txt' before release.".n.n;
94+
return $fileList;
6295
}
6396

64-
exit;
65-
66-
function glob_recursive($pattern, $flags = 0)
97+
/**
98+
* Recalculate checksums of all files in the destination file.
99+
*
100+
* @return array List of files and their checksums
101+
*/
102+
function calculate_checksums()
67103
{
68-
$files = glob($pattern, $flags);
104+
$fileList = array();
69105

70-
foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
71-
$files = array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags));
106+
foreach (check_file_integrity(INTEGRITY_MD5) as $file => $md5) {
107+
$fileList[] = "$file: $md5";
72108
}
73109

74-
return $files;
110+
return $fileList;
75111
}

.github/txp-gitdist.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# * Textpattern Content Management System
55
# * https://textpattern.com/
66
# *
7-
# * Copyright (C) 2022 The Textpattern Development Team
7+
# * Copyright (C) 2024 The Textpattern Development Team
88
# *
99
# * This file is part of Textpattern.
1010
# *

.github/txp-index.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
index_code('callback_event');
99
index_code('callback_event_ref');
10+
index_code('pluggable_ui');
1011

1112
$files_php = array_merge(
1213
glob('*\.php'),
@@ -19,15 +20,15 @@
1920
index_file_save('gtxt_parse_ok', array_keys($gtxt_ok));
2021
index_file_save('gtxt_parse_ok_count', print_r($gtxt_ok, true));
2122

22-
$lang_gtxt = lang_gtxt('textpattern/lang/en.txt');
23+
$lang_gtxt = lang_gtxt('textpattern/lang/en.ini');
2324
foreach (array_keys($gtxt_ok) as $key) {
2425
if (isset($lang_gtxt[$key])) {
2526
unset($lang_gtxt[$key]);
2627
unset($gtxt_ok[$key]);
2728
}
2829
}
2930

30-
$lang_debug = parse_ini_file('textpattern/config.ini');
31+
$lang_debug = parse_ini_file('textpattern/mode.ini');
3132
foreach (array_keys($lang_debug) as $key) {
3233
unset($gtxt_ok[$key]);
3334
}
@@ -103,7 +104,7 @@ function index_code($search)
103104
global $gitview, $branch;
104105
$out = array();
105106
$out2 = array();
106-
$txt = shell_exec('grep --exclude-dir=.github --include=\*.php -rn . -e "'.escapeshellcmd($search).'("');
107+
$txt = shell_exec('grep --exclude-dir={.github,sites} --include=\*.php -rn . -e "'.escapeshellcmd($search).'("');
107108

108109
if (preg_match_all('%^\./(.*?):(.*?):(?:\s+)?(.*?'.preg_quote($search).'\((.*))$%ium', $txt, $mm)) {
109110
foreach ($mm[3] as $key=>$d) {

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
Icon?
1010
ehthumbs.db
1111
Thumbs.db
12-
/vendor
13-
/composer.lock
1412
/images/*
1513
/images/!.gitignore
1614
/files/*
@@ -27,4 +25,5 @@ Thumbs.db
2725
/yarn.lock
2826
/yarn-error.log
2927
.github/index
30-
.vscode/settings.json
28+
.nova
29+
.vscode

.phpstorm.meta.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Textpattern Content Management System
55
* https://textpattern.com/
66
*
7-
* Copyright (C) 2022 The Textpattern Development Team
7+
* Copyright (C) 2024 The Textpattern Development Team
88
*
99
* This file is part of Textpattern.
1010
*

0 commit comments

Comments
 (0)