Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
8ff1fa2
Apply Rector
mrliptontea Feb 26, 2026
d8f15e6
Stricter typing in ExtendedGraph
mrliptontea Feb 27, 2026
6f2502d
Use ObjectId->getTimestamp()
mrliptontea Feb 27, 2026
bde407b
Fix call expectation
mrliptontea Feb 27, 2026
bb04e72
Fixes after applying Rector
mrliptontea Feb 27, 2026
3501f5d
Fix Config::getReplicaSetName test & validate data source
mrliptontea Feb 27, 2026
f46986c
Make lowercase modifier work with Stringable values
mrliptontea Feb 27, 2026
66fbe41
Re-throw exceptions instead of wrapping them in another
mrliptontea Feb 27, 2026
4107d39
Stub sleep to speed up retry tests
mrliptontea Feb 27, 2026
00649d5
Make assertDocumentDoesNotHaveProperty pass if document doesn't exist
mrliptontea Feb 27, 2026
6b68f09
Types in MongoTripodTestBase
mrliptontea Feb 27, 2026
ae320fe
Fix types in MongoTransactionLogTest
mrliptontea Feb 27, 2026
13752a2
Apply php-cs-fixer
mrliptontea Feb 27, 2026
22c5e0f
Format tests
mrliptontea Feb 27, 2026
727c243
Format scripts
mrliptontea Feb 27, 2026
74ef976
Format src
mrliptontea Mar 3, 2026
982da60
Tolerate null values in StatsD
mrliptontea Mar 5, 2026
900b332
Refactor checks in Config
mrliptontea Mar 10, 2026
f57cdee
Add .gitattributes to exclude non-dist files
mrliptontea Mar 2, 2026
25e8be9
Cast ms to int for UTCDateTime
mrliptontea Mar 6, 2026
6aa5979
Migrate utf8_(decode|encode) to mb_convert_encoding
mrliptontea Mar 6, 2026
74ee5e8
Fix trying to access array offset on null
mrliptontea Mar 9, 2026
6184a28
Profile performance tests
mrliptontea Mar 9, 2026
06be561
Move performance suite after unit tests
mrliptontea Mar 9, 2026
4a4640d
Refactor __debugInfo()['readPreference'] to getReadPreference()
mrliptontea Mar 11, 2026
5eaa2f8
Stricter interfaces
mrliptontea Mar 11, 2026
f5be98e
Fix test
mrliptontea Mar 11, 2026
a87df41
Apply rector #2
mrliptontea Mar 11, 2026
1922094
Refactor how eTag is computed
mrliptontea Mar 12, 2026
78db718
Docblock and logic fixes
mrliptontea Mar 12, 2026
14c4766
Type improvements in graph classes
mrliptontea Mar 13, 2026
02e88ae
Drop PHP 7.3 support
mrliptontea Mar 16, 2026
efba683
Apply rector #3
mrliptontea Mar 16, 2026
cac8374
Property types
mrliptontea Mar 16, 2026
1cdb0e5
Add phpstan
mrliptontea Mar 12, 2026
f676b4b
Fixes
mrliptontea Mar 16, 2026
122d11c
Remove dead code branch; refactor expiry check
mrliptontea Mar 16, 2026
3ddd2d6
More method types
mrliptontea Mar 16, 2026
58cb4d1
Revert covariance
mrliptontea Mar 16, 2026
3c0a040
Labeller corrections
mrliptontea Mar 16, 2026
148d0db
Fix typo
mrliptontea Mar 16, 2026
18afec6
Fix missing return types
mrliptontea Mar 16, 2026
b25f9ad
Allow null offset in Driver::select()
mrliptontea Mar 17, 2026
af47f6e
Make Driver::getTableRows() more consistent with select()
mrliptontea Mar 17, 2026
747e6d3
Correct types
mrliptontea Mar 17, 2026
86ed2a3
Ensure no empty values in newCBDs
mrliptontea Mar 17, 2026
7ff25bc
Remove unneeded require
mrliptontea Mar 17, 2026
d1c6901
Check storeName is set before accessing
mrliptontea Mar 17, 2026
143e27b
Segregate methods from DriverBase
mrliptontea Mar 17, 2026
2adc875
Fix predicate (key) validation in MongoGraph::add_tarray_to_index
mrliptontea Mar 19, 2026
351eb38
Don't export phpstan files
mrliptontea Mar 24, 2026
bfc8602
Simplify option checks in scripts
mrliptontea Mar 24, 2026
3ddf74b
Correct usage text in scripts
mrliptontea Mar 24, 2026
119a88f
Fix check for initial $currentSubject
mrliptontea Mar 24, 2026
4a8479e
Stronger types in NQuadSerializer
mrliptontea Mar 25, 2026
0f19674
Add missing types
mrliptontea Mar 25, 2026
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
7 changes: 3 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ commands:
path: test-results/junit.xml
- store_artifacts:
path: test-results/junit.xml
- store_artifacts:
path: profiler

jobs:
lint:
Expand All @@ -66,6 +68,7 @@ jobs:
- checkout
- run: composer install
- run: composer lint
- run: composer analyse

test:
parameters:
Expand Down Expand Up @@ -149,10 +152,6 @@ workflows:
build_and_test:
jobs:
- lint
- test:
name: test-php73
php_version: php73
mongo_version: 3.6.23
- test:
name: test-php74
php_version: php74
Expand Down
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/.circleci/ export-ignore
/docker export-ignore
/test export-ignore
.editorconfig export-ignore
.env export-ignore
.php-cs-fixer* export-ignore
*.log export-ignore
docker-compose*.yml export-ignore
logo.png export-ignore
phpunit.xml export-ignore
phpstan*.neon export-ignore
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ tags
atlassian-ide-plugin.xml

composer.lock
profiler
test-results
.phpunit.result.cache
.php-cs-fixer.cache
Expand Down
17 changes: 17 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,25 @@
->setRules([
'@auto' => true,
'@PhpCsFixer' => true,
'blank_line_before_statement' => ['statements' => [
'break',
'case',
'continue',
'declare',
'default',
'exit',
'goto',
'phpdoc',
'return',
'switch',
'throw',
'try',
]],
'concat_space' => ['spacing' => 'one'],
'increment_style' => false,
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
'ordered_types' => ['null_adjustment' => 'always_last'],
'phpdoc_no_empty_return' => false,
'phpdoc_types_order' => ['null_adjustment' => 'always_last'],
'yoda_style' => false,
'php_unit_method_casing' => false,
Expand All @@ -23,5 +38,7 @@
->setFinder(
(new Finder())
->in(__DIR__)
->ignoreVCSIgnored(true)
->ignoreDotFiles(false)
->notPath('rector.php')
);
12 changes: 5 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,21 @@
"homepage": "http://talis.com/"
}
],
"config": {
"audit": {
"ignore": ["PKSA-gk21-j82g-2hhy"]
}
},
"suggest": {
"resque/php-resque": "Redis backed library for background jobs"
},
"require": {
"php" : ">=7.3",
"php" : ">=7.4",
"mongodb/mongodb": "*",
"monolog/monolog" : "~1.13",
"semsol/arc2": "2.2.6"
},
"require-dev": {
"phpunit/phpunit": "^9.6.20",
"resque/php-resque": "v1.3.6",
"friendsofphp/php-cs-fixer": "^3.4"
"friendsofphp/php-cs-fixer": "^3.4",
"perftools/php-profiler": "^1.2",
"phpstan/phpstan": "^2.1"
},
"autoload": {
"classmap": ["src/"]
Expand All @@ -44,6 +41,7 @@
},
"scripts": {
"lint": "php-cs-fixer check",
"analyse": "phpstan analyse --memory-limit 1024M",
"test": [
"Composer\\Config::disableProcessTimeout",
"phpunit"
Expand Down
7 changes: 0 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ x-base-config: &base-config
env_file: .env

services:
php73:
build:
context: ./docker
dockerfile: Dockerfile-php73
image: talis/tripod-php:php73-latest
<<: *base-config

php74:
build:
context: ./docker
Expand Down
18 changes: 0 additions & 18 deletions docker/Dockerfile-php73

This file was deleted.

2 changes: 1 addition & 1 deletion docker/Dockerfile-php74
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ RUN curl -sLo /tmp/mongosh.deb https://downloads.mongodb.com/compass/mongodb-mon
COPY --from=mlocati/php-extension-installer:2.3.2 /usr/bin/install-php-extensions /usr/local/bin/
COPY --from=composer:2.7.7 /usr/bin/composer /usr/local/bin/

RUN install-php-extensions pcntl mongodb-1.19.3
RUN install-php-extensions pcntl mongodb-1.19.3 xhprof
17 changes: 17 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
parameters:
level: 5
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woop woop

phpVersion:
min: 70400 # PHP 7.4
max: 80419 # PHP 8.4.19
tips:
treatPhpDocTypesAsCertain: false
ignoreErrors:
- '#Access to undefined constant MongoDB\\Driver\\ReadPreference\:\:RP_.*#'
- '#Call to an undefined method MongoDB\\Driver\\ReadPreference\:\:getMode\(\)#'
- identifier: missingType.iterableValue
reportUnmatched: false
- identifier: unset.possiblyHookedProperty
reportUnmatched: false
paths:
- src
- test
6 changes: 3 additions & 3 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
</php>

<testsuites>
<testsuite name="Tripod_Performance_Tests">
<directory>test/performance</directory>
</testsuite>
<testsuite name="Tripod_Unit_Tests">
<directory>test/unit</directory>
</testsuite>
<testsuite name="Tripod_Performance_Tests">
<directory>test/performance</directory>
</testsuite>
</testsuites>
</phpunit>
3 changes: 1 addition & 2 deletions scripts/mongo/BSONToQuads.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
use Tripod\Mongo\TriplesUtil;

require_once __DIR__ . '/common.inc.php';

require_once dirname(__FILE__, 3) . '/src/tripod.inc.php';

if ($argc != 2) {
if ($argc !== 2) {
echo "usage: ./BSONToQuads.php tripodConfig.json < bsondata\n";
echo " When exporting bson data from Mongo use: \n";
echo " mongoexport -d <dbname> -c <collectionName> > bsondata.txt \n";
Expand Down
4 changes: 2 additions & 2 deletions scripts/mongo/BSONToTriples.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
use Tripod\Mongo\TriplesUtil;

require_once __DIR__ . '/common.inc.php';

require_once dirname(__FILE__, 3) . '/src/tripod.inc.php';

if ($argc != 2) {
if ($argc !== 2) {
echo "usage: ./BSONToTriples.php tripodConfig.json < bsondata\n";
echo " When exporting bson data from Mongo use: \n";
echo " mongoexport -d <dbname> -c <collectionName> > bsondata.txt \n";

exit;
}

array_shift($argv);
$config = json_decode(file_get_contents($argv[0]), true);
Config::setConfig($config);
Expand Down
6 changes: 2 additions & 4 deletions scripts/mongo/common.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
}

if (!defined('TRIPOD_COMPOSER_INSTALL')) {
exit(
'You need to set up the project dependencies using the following commands:' . PHP_EOL
exit('You need to set up the project dependencies using the following commands:' . PHP_EOL
. 'curl -sS https://getcomposer.org/installer | php' . PHP_EOL
. 'php composer.phar install' . PHP_EOL
);
. 'php composer.phar install' . PHP_EOL);
}

require TRIPOD_COMPOSER_INSTALL;
52 changes: 16 additions & 36 deletions scripts/mongo/createSearchDocuments.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use Tripod\Config;
use Tripod\iTripodStat;
use Tripod\ITripodStat;
use Tripod\Mongo\Driver;
use Tripod\Timer;

Expand All @@ -20,20 +20,23 @@
]
);

function showUsage($scriptName)
function showUsage(): void
{
$scriptName = basename(__FILE__);
$help = <<<END
{$scriptName}

Usage:

php {$scriptName} -c/--config path/to/tripod-config.json -s/--storename store-name [options]

Options:
-h --help This help
-c --config path to MongoTripodConfig configuration (required)
-s --storename Store to create views for (required)
-s --storename Store to create search documents for (required)
-d --spec Only create for specified search document specs
-i --id Resource ID to regenerate search documents for
-a --async Generate table rows via queue
-a --async Generate search documents via queue
-q --queue Queue name to place jobs on (defaults to configured TRIPOD_APPLY_QUEUE value)

--stat-loader Path to script to initialize a Stat object. Note, it *must* return an iTripodStat object!
Expand All @@ -42,32 +45,27 @@ function showUsage($scriptName)
echo $help;
}

if (empty($options) || isset($options['h']) || isset($options['help'])
if (
$options === [] || $options === false || isset($options['h']) || isset($options['help'])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: I am surprised that $options === [] works as intended to be honest. empty does check for false-y values, so I am surprised this is necessary.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is on Rector: https://getrector.com/rule-detail/disallowed-empty-rule-fixer-rector.

Since PHP's getopt can return array|false that's what's it checking for.

From type safety standpoint this make more sense, since the definition of what "empty" means in PHP is quite loose...

$ php -r 'var_dump(empty("0"));'
bool(true)

|| (!isset($options['c']) && !isset($options['config']))
|| (!isset($options['s']) && !isset($options['storename']))
) {
showUsage();

exit;
}

$configLocation = $options['c'] ?? $options['config'];

require_once dirname(__FILE__, 3) . '/src/tripod.inc.php';

/**
* @param string|null $id
* @param string|null $specId
* @param string|null $storeName
* @param iTripodStat|null $stat
* @param string|null $queue
*/
function generateSearchDocuments($id, $specId, $storeName, $stat = null, $queue = null)
function generateSearchDocuments(?string $id, string $specId, string $storeName, ?ITripodStat $stat = null, ?string $queue = null): void
{
$spec = Config::getInstance()->getSearchDocumentSpecification($storeName, $specId);
if (array_key_exists('from', $spec)) {
Config::getInstance()->setMongoCursorTimeout(-1);

echo "Generating {$specId}";
echo 'Generating ' . $specId;
$tripod = new Driver($spec['from'], $storeName, ['stat' => $stat]);
$search = $tripod->getSearchIndexer();
if ($id) {
Expand All @@ -85,31 +83,13 @@ function generateSearchDocuments($id, $specId, $storeName, $stat = null, $queue

Config::setConfig(json_decode(file_get_contents($configLocation), true));

if (isset($options['s']) || isset($options['storename'])) {
$storeName = $options['s'] ?? $options['storename'];
} else {
$storeName = null;
}

if (isset($options['d']) || isset($options['spec'])) {
$specId = isset($options['d']) ? $options['t'] : $options['spec'];
} else {
$specId = null;
}

if (isset($options['i']) || isset($options['id'])) {
$id = $options['i'] ?? $options['id'];
} else {
$id = null;
}
$storeName = $options['s'] ?? $options['storename'] ?? null;
$specId = $options['d'] ?? $options['spec'] ?? null;
$id = $options['i'] ?? $options['id'] ?? null;

$queue = null;
if (isset($options['a']) || isset($options['async'])) {
if (isset($options['q']) || isset($options['queue'])) {
$queue = $options['queue'];
} else {
$queue = Config::getInstance()->getApplyQueueName();
}
$queue = $options['q'] ?? $options['queue'] ?? Config::getInstance()->getApplyQueueName();
}

$stat = null;
Expand Down
Loading