Skip to content

Commit 4229009

Browse files
committed
remove todo mentions
1 parent 59688c3 commit 4229009

File tree

10 files changed

+6
-45
lines changed

10 files changed

+6
-45
lines changed

.github/workflows/build_package.yml

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

crowdsec.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
Text Domain: crowdsec-wp
1515
*/
1616

17-
// TODO P2 check WP minimum compatible version + add a tag: "Requires at least: X.Y"
18-
// TODO P2 check WP maximum compatible version + add a tag: "Tested up to: 4.8"
19-
2017

2118
session_start();
2219
require_once __DIR__ . '/vendor/autoload.php';

inc/admin/advanced-settings.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,9 @@ function adminAdvancedSettings()
5555
addFieldSelect('crowdsec_cache_system', 'Technology', 'crowdsec_plugin_advanced_settings', 'crowdsec_advanced_settings', 'crowdsec_admin_advanced_cache', function ($input) {
5656
if (!in_array($input, [CROWDSEC_CACHE_SYSTEM_PHPFS, CROWDSEC_CACHE_SYSTEM_REDIS, CROWDSEC_CACHE_SYSTEM_MEMCACHED])) {
5757
$input = CROWDSEC_CACHE_SYSTEM_PHPFS;
58-
// TODO P3 throw error
58+
add_settings_error("Technology", "crowdsec_error", "Technology: Incorrect cache technology selected.");
5959
}
6060

61-
// TODO P1 big bug: fatal error when changing techno without dsn already set at previous state. Quick fix: Add error if no dsn and ask to set dsn then save then select techno.
62-
6361
$bouncer = getBouncerInstance();
6462
$bouncer->clearCache();
6563
$message = __('Cache system changed. Previous cache data has been cleared.');
@@ -86,13 +84,11 @@ function adminAdvancedSettings()
8684

8785
// Field "crowdsec_redis_dsn"
8886
addFieldString('crowdsec_redis_dsn', 'Redis DSN<br>(if applicable)', 'crowdsec_plugin_advanced_settings', 'crowdsec_advanced_settings', 'crowdsec_admin_advanced_cache', function ($input) {
89-
// TODO P2 check if it's a valid DSN
9087
return $input;
9188
}, '<p>Fill in this field only if you have chosen the Redis cache.<br>Example of DSN: redis://localhost:6379.', 'redis://...', '');
9289

9390
// Field "crowdsec_memcached_dsn"
9491
addFieldString('crowdsec_memcached_dsn', 'Memcached DSN<br>(if applicable)', 'crowdsec_plugin_advanced_settings', 'crowdsec_advanced_settings', 'crowdsec_admin_advanced_cache', function ($input) {
95-
// TODO P2 check if it's a valid DSN
9692
return $input;
9793
}, '<p>Fill in this field only if you have chosen the Memcached cache.<br>Example of DSN: memcached://localhost:11211.', 'memcached://...', '');
9894

@@ -130,7 +126,7 @@ function adminAdvancedSettings()
130126
addFieldSelect('crowdsec_fallback_remediation', 'Fallback to', 'crowdsec_plugin_advanced_settings', 'crowdsec_advanced_settings', 'crowdsec_admin_advanced_remediations', function ($input) {
131127
if (!in_array($input, Constants::ORDERED_REMEDIATIONS)) {
132128
$input = CROWDSEC_BOUNCING_LEVEL_DISABLED;
133-
// TODO P3 throw error
129+
add_settings_error("Fallback to", "crowdsec_error", "Fallback to: Incorrect Fallback selected.");
134130
}
135131
return $input;
136132
}, '<p>Which remediation to apply when CrowdSec advises unhandled remediation.</p>', $choice);

inc/admin/init.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function clearBouncerCacheInAdminPage()
2424

2525
AdminNotice::displaySuccess($message);
2626

27-
// TODO P3 i18n the whole lib https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/
2827
} catch (WordpressCrowdSecBouncerException $e) {
2928
getCrowdSecLoggerInstance()->error(null, [
3029
'type' => 'WP_EXCEPTION_WHILE_CLEARING_CACHE',

inc/admin/settings.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ function adminSettings()
1515

1616
// Field "crowdsec_api_url"
1717
addFieldString('crowdsec_api_url', 'LAPI URL', 'crowdsec_plugin_settings', 'crowdsec_settings', 'crowdsec_admin_connection', function ($input) {
18-
// P2 TODO ping API to see if it's available if not: add_settings_error("LAPI URL", "crowdsec_error", "LAPI URL " . $input . " is not reachable.");
1918
return $input;
2019
}, '<p>If the CrowdSec Agent is installed on this server, you will set this field to http://localhost:8080.</p>', 'Your LAPI URL', '');
2120

2221

2322
// Field "crowdsec_api_key"
2423
addFieldString('crowdsec_api_key', 'Bouncer API key', 'crowdsec_plugin_settings', 'crowdsec_settings', 'crowdsec_admin_connection', function ($input) {
25-
// TODO check api key format / ping api if not: add_settings_error("LAPI URL", "crowdsec_error", "LAPI URL " . $input . " is not reachable.");
2624
return $input;
2725
}, '<p>Generated with the cscli command, ex: <em>cscli bouncers add wordpress-bouncer</em></p>', 'Your bouncer key', 'width: 280px;', 'text');
2826

@@ -43,7 +41,7 @@ function adminSettings()
4341
CROWDSEC_BOUNCING_LEVEL_PARANOID
4442
])) {
4543
$input = CROWDSEC_BOUNCING_LEVEL_DISABLED;
46-
// TODO P3 throw error
44+
add_settings_error("Bouncing level", "crowdsec_error", "Bouncing level: Incorrect bouncing level selected.");
4745
}
4846
return $input;
4947
}, '<p>

inc/bounce-current-ip.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function handleRemediation(string $remediation, string $ip)
128128
$remediation = $bouncer->getRemediationForIp($ip);
129129
handleRemediation($remediation, $ip);
130130
} catch (WordpressCrowdSecBouncerException $e) {
131-
// TODO log error for debug mode only.
131+
132132
}
133133
}
134134
}

inc/bouncer-instance.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ function getCacheAdapterInstance(string $forcedCacheSystem = null): AbstractAdap
5757
$redisDsn = esc_attr(get_option('crowdsec_redis_dsn'));
5858
if (empty($redisDsn)) {
5959
throw new WordpressCrowdSecBouncerException('Redis selected but no DSN provided.');
60-
// TODO P2 fix: when redis is selected and the dsn is filled at the same moment, this error is thrown or it should not be.
6160
}
6261
return new RedisAdapter(RedisAdapter::createConnection($redisDsn));
6362
}
@@ -101,7 +100,6 @@ function getBouncerInstance(string $forcedCacheSystem = null): Bouncer
101100
break;
102101
case CROWDSEC_BOUNCING_LEVEL_PARANOID:
103102
$maxRemediationLevel = Constants::REMEDIATION_BAN;
104-
// TODO P2 add "minimum remediation" feature in lib + set it to ban in this case
105103
break;
106104
default:
107105
throw new Exception("Unknown $bouncingLevel");
@@ -116,7 +114,6 @@ function getBouncerInstance(string $forcedCacheSystem = null): Bouncer
116114
'api_key' => $apiKey,
117115
'api_url' => $apiUrl,
118116
'api_user_agent' => CROWDSEC_BOUNCER_USER_AGENT,
119-
//'api_timeout' => null // TODO P3 make a advanced settings
120117
'live_mode' => !$isStreamMode,
121118
'max_remediation_level' => $maxRemediationLevel,
122119
'fallback_remediation' => $fallbackRemediation,

inc/constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
define('CROWDSEC_CAPTCHA_TECHNOLOGY_LOCAL', "local");
1616
define('CROWDSEC_CAPTCHA_TECHNOLOGY_RECAPTCHA', "recaptcha");
1717

18-
define('CROWDSEC_BOUNCER_USER_AGENT', "Wordpress CrowdSec Bouncer/0.0.1");// TODO P1 SET THE CORRECT VERSION ON BUILD
18+
define('CROWDSEC_BOUNCER_USER_AGENT', "Wordpress CrowdSec Bouncer/0.0.1");

inc/scheduling.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
define('CROWDSEC_REFRESH_BLOCKLIST_CRON_INTERVAL', 'crowdsec_refresh_blocklist_cron_interval');
55

66
// Create a WP custom cron interval (ovewrite previous if any).
7-
// TODO P3 create get_bool_option / get_int_option / get_string_option etc to sanitize theme all.
87
add_filter('cron_schedules', function ($schedules) {
98
$refreshFrequency = (int)get_option("crowdsec_stream_mode_refresh_frequency");
109
if ($refreshFrequency > 0) {
@@ -22,7 +21,6 @@ function crowdSecRefreshBlocklist()
2221
$bouncer = getBouncerInstance();
2322
$bouncer->refreshBlocklistCache();
2423
} catch (WordpressCrowdSecBouncerException $e) {
25-
// TODO log error for debug mode only.
2624
}
2725
}
2826

uninstall.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@
66

77
if ( ! defined ( 'WP_UNINSTALL_PLUGIN' )) {
88
die;
9-
}
10-
11-
// TODO P3 if we don't deactivate before deleting, are the wp_option delete ? test this case.
9+
}

0 commit comments

Comments
 (0)