friendica / red

The Red Matrix
MIT License
214 stars 50 forks source link

Add alert to admin page about old PHP version. Fixing (un)blocking accounts in admin. #920

Closed dawnbreak closed 9 years ago

dawnbreak commented 9 years ago

Add an alert message to admin summary page when a PHP version < 5.4 was detected as this has reached EOL and will not be supported with the new SabreDAV library. Tried to fix (un)blocking accounts in /admin/users. Not finished yet for multiple selections. Some styleguide optimisation. Add NULL_DATE example to doc/sql_conventions.bb. Display a "0" when no plugins active in summary page. Added some more numbers to summary admin page, expired accounts, channels. Hope I interpreted them right. I have no PostgreSQL dev environment. Maybe someone can check before merging.

dawnbreak commented 9 years ago

My concern about PostgreSQL is how I did multiple counts in one query. No idea if this is only MySQL valid: SELECT COUNT(*) AS total, COUNT(IF(account_expires>NOW(),1,null)) AS expiring, COUNT(IF(account_expires<NOW() ANDaccount_expires!='0000-00-00',1,null)) AS expired FROMaccount``

habeascodice commented 9 years ago

It will not work because you are hardcoding the "fake null" into the string. You must use the sprintf format chars and constant NULL_DATE as described in the coding standards. Also, do not quote identifiers unless they are SQL keywords. (remove the backticks)

dawnbreak commented 9 years ago

My 5th try to get the SQL query hopefully right now. Could you please check again. Thank you very much. Also saw that blocking/unblocking accounts was not working anymore. Tried to fix it with help of the sql_conventions.bb. It is not completely finished yet, as multiple selections for (un)blocking seems not to work still. Is there some bit-flag toggle logic I don't see or do we need to rewrite the query in two, like I did for the single (un)blocking actions?

habeascodice commented 9 years ago

you can get an abstracted xor operator with db_getfunc('^'), but if you're talking about https://github.com/friendica/red/pull/920/files#diff-193500fd936e6e8fcd31e1020682ba20R654 you should still use | and & ~ separately because let's say you have 3 toggles, on, off, on, after the xor operation they would be off, on, off, which is undesirable. Most of the time you want to be deliberate rather than toggle which is why it is discouraged.

dawnbreak commented 9 years ago

Okay, blocking and unblocking accounts in /admin/users should work now for single operations and multiselects, too. If the queries are fine for PostgreSQL we could merge it from my side.

friendica commented 9 years ago

I'm going to let habeascodice make the call, as I'm still making occasional mistakes with postgres compatibility. I think habeas can merge it. If not, I will as soon as I get the go-ahead.