Update to php7 and PDO
ClosedPublic

Authored by ognarb on Sep 1 2019, 11:49 AM.

Details

Summary

Move planet feed reader to Feed class

Test Plan

Not tested yet

Diff Detail

Branch
/trunk/www/sites/www
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 17042
Build 17060: arc lint + arc unit
ognarb requested review of this revision.Sep 1 2019, 11:49 AM
ognarb created this revision.
ognarb updated this revision to Diff 65182.Sep 1 2019, 10:12 PM

Add my copyright to aetherlibs/feeds.php

Aside from the comments above, this looks fine.
Are all other parts of the codebase good to go from the perspective of PHP7? (including the Paypal donations stuff?)

aetherlibs/DB.php
21 ↗(On Diff #65182)

Just curious, what is this trying to do?

We already make sure that the path containing the files with the credentials is in the PHP include_path (as part of the general server setup) so no explicit code for that is needed.

24 ↗(On Diff #65182)

We should probably use UTC for this.

ognarb updated this revision to Diff 65233.Sep 2 2019, 12:20 PM
ognarb marked 2 inline comments as done.
  • Update fundraisers/yearend2017

@bcooksley Can you send me the content of fundraisers/yearend2016/donations_auth.inc with the password removed? Same probably for other directory in fundraisers.

aetherlibs/DB.php
21 ↗(On Diff #65182)

This was in the original code of the DB class, I will remove it.

ognarb updated this revision to Diff 65387.Sep 4 2019, 9:41 PM

More fundraiser pages update to php7 and PDO

ognarb updated this revision to Diff 65389.Sep 4 2019, 9:56 PM

Fix fundraisers/*/stat.php

ognarb updated this revision to Diff 65412.Sep 5 2019, 11:05 AM

More conversion to pdo

Remaining file is community/donations/statistics/index.php

One of the current outstanding issues with the KDE.org site is that it uses not one or two, but three different configuration files for the same database details.
These probably need to be unified.

The current content of donations_auth.inc is as follows:

<?php

$host = "localhost";
$db = "kdeorg";
$user = "kdeorg";
$pass = "<removed>";

$sq = mysql_connect($host,$user,$pass);
mysql_select_db($db);
mysql_set_charset('utf8', $sq);

?>

The contents of db_auth.inc is as follows:

<?php

$db_username = "kdeorg";
$db_password = "<removed>";
$db_database = "kdeorg";

?>

and finally, the contents of config.php is as follows:

<?php
$currency = 'EUR';
$kdeEvMail = "kde-ev-board@kde.org";
$dbhost = '<removed';
$dbuser = 'kdeorg';
$dbpass = '<removed>';
$dbname = 'kdeorg';
$dbConnection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname) or die (mysqli_connect_error());

?>
ognarb updated this revision to Diff 66509.Sep 19 2019, 9:28 PM

Fix notify.php with php7

ognarb planned changes to this revision.Sep 19 2019, 9:38 PM

There was so many error/warning in community/donations/graph.php that I decided to rewrite it using graph.js

I tested the paypal code using the sandbox and it works :)

TODO:

  • remove all the notify.php
  • Unify the database access to the following config.php located in capacity/includes:
<?php

$currency = 'EUR';
$kdeEvMail = "kde-ev-board@kde.org";
$dbhost = 'localhost';
$dbuser = 'kdeorg';
$dbpass = '';
$dbname = 'kdeorg';

$dbConnection = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass);
  • Write fixtures for all the donation compaign for testing purpose disabled by default (see setup-db.php)
  • Fix the error I just found ;)
fundraisers/yearend2016/index.php
26–27

query not used

63–64

I forgot execute()

aacid added inline comments.Sep 19 2019, 9:52 PM
aetherlibs/DB.php
5 ↗(On Diff #66509)

Affero isn't really one of our "approved" licenses https://community.kde.org/Policies/Licensing_Policy

community/donations/index.php
59 ↗(On Diff #66509)

you left the sandbox here

69 ↗(On Diff #66509)

and here

community/donations/notify.php
42

and here

ognarb updated this revision to Diff 66510.Sep 19 2019, 9:58 PM
  • Remove DB.php (not used anymore)
  • Cache request to planet rss feed

@aacid I see in the licensing policies that the AGPL is recommended for stuff running on a server and some part of capacity (where the first version of this file was copied) are licensed under AGPL. I deleted this file since it is not needed anymore.

ognarb updated this revision to Diff 66512.Sep 19 2019, 10:04 PM

Remove sandbox

aacid added inline comments.Sep 19 2019, 10:05 PM
aetherlibs/DB.php
5 ↗(On Diff #66509)

Actually it is, the thing only says AGPL and no Affero so my search failed ^_^

ognarb marked 5 inline comments as done.Sep 19 2019, 10:05 PM

Thanks for your continue work on this Carl! Just one thing I spotted while having a look through...

community/donations/graph.php
5–6

Given we're in 2019 maybe we should increase the limit to something like 2030?

aacid added a comment.Sep 21 2019, 6:01 PM

is there anything this is waiting on? otherwise i'd just commit it and be aware thing changed in case something breaks and fix it fast

community/donations/notify.php
34

do we need this?

58

i think we're always running in debug (double check with ben, so no need to have these error_log calls?)

65

this doesn't seem like an error

ognarb updated this revision to Diff 66736.Sep 24 2019, 10:51 AM
ognarb marked 5 inline comments as done.
  • Remove useless logging
  • Fix community/donations/statistics/index.php
  • Fix some divisions by zero

There is still a know bug in community/donations/previousdonation.php and then it's ready to go ;)

ognarb updated this revision to Diff 66737.Sep 24 2019, 10:53 AM
ognarb marked an inline comment as done.

Change date to 2030

ognarb updated this revision to Diff 66739.Sep 24 2019, 11:25 AM

Fix various bugs with the donation pages

ognarb updated this revision to Diff 66740.Sep 24 2019, 11:39 AM

Fix problem in community/donations/previousdonations.php

ognarb updated this revision to Diff 66741.Sep 24 2019, 11:42 AM
ognarb marked an inline comment as done.

Fix variable not used

ognarb updated this revision to Diff 66742.Sep 24 2019, 11:43 AM

Make sure user can execute setup-db.php

@bcooksley Ok I think this patch is now ready. Ping me in IRCC, when you have the time to change the server configuration, so that the homepage is not down to long

aacid added inline comments.Sep 24 2019, 3:50 PM
community/donations/notify.php
96

I would rather you don't change this since the current setup works, why are you changing it?

community/donations/previousdonations.php
27

Are we fine loading stuff form some random domain?

setup-db.php
52

All these inserts seem fishy

ognarb updated this revision to Diff 66771.Sep 24 2019, 4:10 PM
ognarb marked 2 inline comments as done.
  • Use our own cdn for chart.js
  • Revert email paypal
ognarb added inline comments.Sep 24 2019, 8:58 PM
community/donations/previousdonations.php
27
setup-db.php
52

This file is just for creating test data and is disabled see line 20

bcooksley accepted this revision.Sep 26 2019, 9:00 AM

This code looks good to me - let's get this in.

This revision is now accepted and ready to land.Sep 26 2019, 9:00 AM
ognarb updated this revision to Diff 66874.Sep 26 2019, 9:13 AM

Update configuration file name to www_config.php

bcooksley accepted this revision.Sep 26 2019, 9:17 AM