Conversation
|
Lacks auto-create column for SQLite and PostgreSQL. |
aledeg
left a comment
There was a problem hiding this comment.
I am not very keen of the column name but apart from that, good job!
|
@aledeg Any other name suggestion? |
|
I prefer to have the full name like |
|
@aledeg What about |
|
I think |
|
I agree with @aledeg. |
|
This JSON column will actually be with anything inside :-)
I think I can now better like |
|
json_attributes, jattr, j_attr, jsonAttributes |
|
|
|
Ok, go for @aledeg Didn't you make the code to auto-add a column in PostgreSQL when you did the first version of the mute feed thing? I cannot find it anymore due to the squash inside the pull request. If you can find it again, I am interested :-) |
|
@Alkarex I am not sure I've done such thing. And if I did, I am afraid I've deleted it. Sorry |
|
Tested with success in MySQL, SQLite, PostgreSQL |
* Feed cURL timeout * Mark updated articles as read * Mark as read upon reception FreshRSS#1702 * Ignore SSL (unsafe) FreshRSS#1811
app/Controllers/feedController.php
Outdated
| // This entry should not be added considering configuration and date. | ||
| $oldGuids[] = $entry->guid(); | ||
| } else { | ||
| $read_upon_reception = $feed->$attributes['read_upon_reception'] !== null |
There was a problem hiding this comment.
@Frenzie Do you know how those lines are supposed to be written to pass Travis / PHPCS?
I have already tried two variations without success...
There was a problem hiding this comment.
Unfortunately it wants it all to be on one line like this:
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index eb82a797..aa322a8b 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -353,9 +353,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
} else { //This entry already exists but has been updated
//Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->id() .
//', old hash ' . $existingHash . ', new hash ' . $entry->hash());
- $mark_updated_article_unread = $feed->$attributes['mark_updated_article_unread'] !== null
- ? $feed->$attributes['mark_updated_article_unread']
- : FreshRSS_Context::$user_conf->mark_updated_article_unread;
+ $mark_updated_article_unread = $feed->$attributes['mark_updated_article_unread'] !== null ? $feed->$attributes['mark_updated_article_unread'] : FreshRSS_Context::$user_conf->mark_updated_article_unread;
$needFeedCacheRefresh = $mark_updated_article_unread;
$entry->_isRead(FreshRSS_Context::$user_conf->mark_updated_article_unread ? false : null); //Change is_read according to policy.
if (!$entryDAO->inTransaction()) {
@@ -367,9 +365,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
// This entry should not be added considering configuration and date.
$oldGuids[] = $entry->guid();
} else {
- $read_upon_reception = $feed->$attributes['read_upon_reception'] !== null
- ? $feed->$attributes['read_upon_reception']
- : FreshRSS_Context::$user_conf->mark_when['reception'];
+ $read_upon_reception = $feed->$attributes['read_upon_reception'] !== null ? $feed->$attributes['read_upon_reception'] : FreshRSS_Context::$user_conf->mark_when['reception'];
if ($isNewFeed) {
$id = min(time(), $entry_date) . uSecString();
$entry->_isRead($read_upon_reception);So for legibility it might be better to use an if/else statement. I could also try to find out if there's a way to coax PHPCS into accepting this if you like but I don't know if that's an option.
There was a problem hiding this comment.
Yes @Frenzie , please check if you can find a way to allow multiline ternary expressions
|
While waiting for a better syntax support
|
One workaround would be to simply remove the There are a few more targeted approaches: diff --git a/phpcs.xml b/phpcs.xml
index d79e2a4d..1d10d277 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -92,7 +92,9 @@
<!-- Do not add spaces when casting -->
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
<!-- Operators must have a space around them -->
- <rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
+ <rule ref="Squiz.WhiteSpace.OperatorSpacing">
+ <exclude-pattern>./app/Controllers/feedController.php</exclude-pattern>
+ </rule>
<!-- Do not add a whitespace before a semicolon -->
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
<!-- Do not add whitespace at start or end of a file or end of a line -->If we updated to a newer PHPCS we could also selectively ignore rules for a few lines instead of for whole files (docs): // phpcs:disable Generic.Commenting.Todo, PSR1.Files.SideEffects -- Because reasons
breaking_code();
// phpcs:enable Generic.Commenting.Todo, PSR1.Files.SideEffectsHowever, updating it would require some effort as well, also due to indentation issues. That being said, in our current version we can still do this (i.e., selectively disable all checks): diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index eb82a797..4f478994 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -353,9 +353,11 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
} else { //This entry already exists but has been updated
//Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->id() .
//', old hash ' . $existingHash . ', new hash ' . $entry->hash());
+ // @codingStandardsIgnoreStart
$mark_updated_article_unread = $feed->$attributes['mark_updated_article_unread'] !== null
? $feed->$attributes['mark_updated_article_unread']
: FreshRSS_Context::$user_conf->mark_updated_article_unread;
+ // @codingStandardsIgnoreEnd
$needFeedCacheRefresh = $mark_updated_article_unread;
$entry->_isRead(FreshRSS_Context::$user_conf->mark_updated_article_unread ? false : null); //Change is_read according to policy.
if (!$entryDAO->inTransaction()) { |
|
@Frenzie Thanks for the feedback and for trying to find a better rule. I think the current workaround is good enough for now, while waiting for a potential better approach later. |
|
@Alkarex Test in what sense exactly? Just some basic use it for a few days or actually trying to find where it might break? (The first is easier to squeeze in somewhere, naturally. :-P) |
|
@Frenzie I only meant a quick look / run before merging, as further testing by more people can also be done once landed in /dev. I am already running this patch on my main instance. |
|
I need to do some sewing right now but I should be able to do a basic test tomorrow. :-) |
|
@Alkarex Nothing obviously broken so far. :-P |
* Draft of JSON column for feeds FreshRSS#1654 * Add some per-feed options * Feed cURL timeout * Mark updated articles as read FreshRSS#891 * Mark as read upon reception FreshRSS#1702 * Ignore SSL (unsafe) FreshRSS#1811 * Try PHPCS workaround While waiting for a better syntax support
* Feed attributes only for admin FreshRSS#1838 * Changelog 1905 FreshRSS#1905
Should help with some DB lock issues. Complete FreshRSS#3558 after FreshRSS#5625 already cherry-picked from it. * Removed auto-update of MySQL GUID case sensitivity FreshRSS#2078 * Contributed to a DB lock in FreshRSS#5008 Also removed the following non-problematic auto-updates, simply because they were older than the above ones * Auto-create custom labels (1.12.0) FreshRSS#2027 * Auto-add JSON column for feeds (1.11.0) FreshRSS#1838 * Auto-create temporary tables (1.7.0) FreshRSS#1470
Should help with some DB lock issues. Complete #3558 after #5625 already cherry-picked from it. * Removed auto-update of MySQL GUID case sensitivity #2078 * Contributed to a DB lock in #5008 Also removed the following non-problematic auto-updates, simply because they were older than the above ones * Auto-create custom labels (1.12.0) #2027 * Auto-add JSON column for feeds (1.11.0) #1838 * Auto-create temporary tables (1.7.0) #1470
#1654