Directory

phpBB • Blog • Contributing

Blog

Posts Tagged ‘Contributing’

Attention developers: GitHub Codespaces enabled in phpBB!

Posted by battye in Development with the tags , , , on February 4th, 2023

If you’re a PHP developer, you’ll know that setting up a new development environment can be annoying and time consuming! You have to find a code editor, you have to install a web server like Apache, a database and PHP. Even if you’re using some virtualisation software like Vagrant or containerisation software like Docker to simplify the process, it still takes up time that you’d prefer to spend coding.

Enter: GitHub Codespaces.

The tech world is moving towards the cloud at a rapid pace and software development is no exception. A web-based project like phpBB is a good fit for cloud development and while a local development environment is wonderful, the ability to quickly code and test changes on any device with a browser is nice to have in the arsenal.

Codespaces includes a web-based code editor (VS Code) as well as a virtual machine which can be used to run software. Effective immediately, the phpBB project on GitHub contains a pre-configured Codespace with a LAMP stack and XDebug, allowing developers to modify and debug a vanilla board which is already automatically installed.

This tutorial explains how to:

  • Create a GitHub Codespace with an automatically created fresh installation of phpBB
  • Use a Codespace to make a code change to phpBB
  • Use XDebug to debug phpBB code in real time

Step 1

See if there is a ticket in the phpBB issue tracker describing the problem you would like to fix or the feature you would like to add. If there is not an existing ticket, you can create a new ticket, logging in using your phpBB.com login details.

In this case, we’ll look at a simple bug that was raised at https://tracker.phpbb.com/projects/PHPBB3/issues/PHPBB3-17025 – the number 0 appears as the default topic ID on the MCP move posts page, but there is no valid use case for this because it is an invalid ID. We will use this bug (resolved here) to demonstrate how GitHub Codespaces works and how it can be used for phpBB development.

The reporter provided some valuable information which acts as a good starting point, namely that the bug is on line 76 of prosilver/template/mcp_topic.html. We will come back to this in Step 3.

Step 2

Create a new branch on your own fork of phpBB. If you have never done this before, the procedure is outlined at https://area51.phpbb.com/docs/dev/3.3.x/development/git.html

Then on GitHub.com, create a new Codespace for this branch. It will already be preconfigured from the code in the phpbb/phpbb repository.

screenshot_create_codespace

This will create a brand new installation of phpBB with XDebug installed to assist developers.

Step 3

From the online VS Code website, which looks almost identical to the desktop version of VS Code, click on the files icon and navigate to mcp_topic.html – or use the shortcut Ctrl+P to search for the file.

screenshot_file_search

By looking at line 76 of that file, we can see that the “value” attribute listed in the ticket is set to a variable called TO_TOPIC_ID.

Using the Ctrl+Shift+F (global search) feature, if we search for that TO_TOPIC_ID variable we can see that it only gets used in one other place.

screenshot_global_search

Double click mcp_topic.php to open the other place where that variable is used – line 386 of the file.

The template variable is set to take the exact value of $to_topic_id.

Step 4

Using the power of XDebug, we can debug the issue in real time. Using the Ctrl+F (local search) feature, we can see where $to_topic_id is declared and how it is used.

On line 52 it takes input from the URL – and defaults to 0 if the parameter isn’t supplied in the URL. On line 357, it is forcibly set to 0 if a certain condition is met.

Line 376 is the best place to see XDebug in action though. Left click once just to the side of the line number so that a red breakpoint appears. A breakpoint is used to identify where execution should temporarily halt during debugging.

screenshot_breakpoint

Step 5

Now that a breakpoint has been set (you can set as many breakpoints as you wish), debugging can be turned on by clicking the “Run and Debug” button and then the green play button beside “Debug phpBB”.

screenshot_debug_on

Step 6

At this point, debug mode is active. Under the Ports tab at the bottom of screen, click the “Open in Browser” button and the fresh phpBB installation will open.

screenshot_open_site

Log in to the board with the credentials admin/adminadmin and, for the purposes of this example, add some posts and topics so that posts can be moved in the MCP to replicate the original bug.

Step 7

When the move posts page of the MCP is loaded, the XDebug breakpoint will automatically be hit – meaning the execution of the page is paused at that point to give developers the chance to analyse the code before it has finished running.

The browser tab will show a small red circle to indicate a breakpoint has been hit. Within VS Code, the line will be highlighted as well.

To identify the value of the variables at the point the execution has paused, either hover over a variable (like in the case of $to_topic_id on the right of screen) or look at the variable list on the left of screen.

screenshot_hit_breakpoint

Step 8

From this information, we learn that $to_topic_id is set to 0 as a default and it has been done intentionally. So to fix the bug of 0 appearing by default in the template, we don’t want to refactor the entire file and potentially introduce a new problem.

The sensible approach is to just change the way the value is passed to the template because, as we discovered from the global search in Step 3, the template variable does not get used anywhere else.

Using the ternary operator we can make a simple change so that the template variable declaration reads as:

‘TO_TOPIC_ID’ => $to_topic_id ?: ”,

This means that if $to_topic_id evaluates to true (the integer 0 does not evaluate to true, but if a valid topic ID is passed through the URL as explained in Step 4 it does evaluate to true), then $to_topic_id will be passed as the default value to the input field – otherwise, an empty string will.

Step 9

By returning to the tab with the phpBB board open, we can confirm that the fix is working as intended.

screenshot_bug_fixed

Step 10

Satisfied that the fix is correct, we can now commit and push the change to the local branch. This is easily done in VS Code, simply click the “Source Control” tab and stage the change to mcp_topic.php (the file we edited) by right clicking it and clicking “Stage Changes”.

Type a commit message in the box (using the format described at https://area51.phpbb.com/docs/dev/3.3.x/development/git.html), and then select “Commit and Push” from the dropdown option.

screenshot_commit_push

The list of files in the install directory can be safely ignored – they are deleted when setting up the Codespace to allow phpBB to run normally.

Step 11

Finally, create a pull request on GitHub.com from your local branch to either the phpbb/phpbb 3.3.x branch or the master branch. phpBB’s GitHub Actions will run unit tests, ensuring no features were broken accidentally as a result of the change, and then the development team will review the code.

And with that, it becomes clear that GitHub Codespaces is a really handy tool to be aware of and which can be used to easily and powerfully make code changes for phpBB.

OSCON 2010

Posted by Sam in Events with the tags , , , , , on July 28th, 2010

The O’Reilly Open Source Convention has been held annually since 1999, allowing students, entrepreneurs, enthusiasts, and professionals to attend informative sessions and tutorials as well as visit the expo hall and mingle with others holding a common technical interest. This year, for the first time ever, phpBB was among the exhibitors in the Expo Hall.

Left to Right: Yuriy, Nathan, Cullen, Sam

What we expected

Despite phpBB3’s fantastic security record, we expected to meet some attendees who were only familiar with phpBB2. Anticipating questions dealing with security, we came prepared with laminated placards displaying pie charts and details of all issues reported for the phpBB3 line – the flagship phpBB version for the past 3 years.

What we didn’t expect

Very few people asked about phpBB’s security and walked past the placards to ask us questions about features, bridges, future plans, etc. Many of the other Open Source project exhibitors visited our booth and expressed their warm feelings toward the project and positive experiences using the phpBB software. Rather than having to defend ourselves, we were instead answering interesting questions and tipping our hats to compliments.

New Beginnings

Of all the different questions we were asked, the most common was surprising, to say the least. Over the course of the two days, we heard “Does phpBB integrate with Drupal?” so often that we began keeping count. This sparked some internal discussion, and we visited the Drupal booth, which was conveniently located just around the corner from us. There is already a community developed Drupal module for integration with phpBB, but multiple reports suggested that it was unstable and poorly written. Its scores within the Drupal database suggest that it is largely unusable in a live environment, which was a huge shock to us. After the first night, we returned to our hotel room and began planning a new phpBB-maintained Drupal plugin. Work on this has already begun and more information will be available soon.

Some very popular open source projects were present at OSCON, and a number of them approached us about presenting at their upcoming events. We are, of course, very excited about these plans and will keep you updated on our upcoming speaking/presentation engagements either via this blog or on the board.

After the Expo

On Thursday evening, we attended an informal “Birds of a Feather” session. Organizer Douglas Bell (Webmacster87), Cullen Walsh (ckwalsh) and Lorelle VanFossen all spoke about running online communities. We later joined them for dinner at a local restaurant.

phpBB.com server

The following day we joined the OSUOSL Open Bus Tour for a view of the Oregon State University campus and Open Source Lab. OSUOSL rented a wifi and power equipped bus for the 90 minute journey and we had a blast with the other attendees. You can see us with Lance from OSUOSL and the 2 phpBB.com servers (underneath the Berties) to the left.

We are very grateful to have such friends in the Open Source world.

What we took from this

We are glad to have met so many wonderful people at OSCON and look forward to maintaining the new bridges that have been formed. Speaking directly to phpBB users was a unique experience and we walk away with a better perspective of what the community expects from us. We will continue to improve over the next year and will be ready to address your updated concerns at next year’s event.

Please discuss this blog post in the phpBB OSCON 2010 topic in the Discussion Forum.

Please discuss this blog post in the phpBB OSCON 2010 topic in the Discussion Forum.

At TekX Chicago

Posted by A_Jelly_Doughnut in Events with the tags , , , on May 29th, 2010

(That’s Tek-Ten, by the way)

A week ago, I was recovering from a weeklong trip to Chicago for php|tek. Here’s a few of the things I heard about:

  • Derick Rethans on the DateTime functions added to PHP 5.2. The power of the DateTime class is pretty awesome. The class’s essential beauty is in the fact that it stores a time and a time zone. It can also do accurate math against times and solves the 2038 problem. phpBB will be moving this way for Ascraeus.
  • Git is here to stay. Talks from Travis Swicegood, Lorna Jane Mitchell, and Matthew Schmidt all talked about version control systems in some way or another, and a great number of the conference attendees are trying to move their projects to Git. Matthew gave the keynote on Thursday, and included phpBB in his listing of “open source projects driving the move to Git”. Thanks Matt!
  • HipHop for PHP, a technology created by Facebook, and open-sourced for anyone to use, essentially compiles PHP into C++ for performance. Scott MacVicar, now at Facebook, formerly of vBulletin had a conversation about the future of bulletin boards – the name of the game is doing it better, not about doing more. I’m looking forward to the day that someone compiles phpBB using HipHop and reports their performance gains.
  • JIRA is successfully used in other open-source projects. I spoke with Matthew Weier O’Phinney, project lead of Zend Framework, who says that they’ve been very happy with JIRA. I was surprised that I was able to talk with him on an intelligent level about it, because Zend Framework has used it for years, and phpBB has used it for just a couple of months. Unfortunately at Tek, very few of the “front-end” open source projects were represented. For example, I don’t know of anyone in attendance who had submitted code to Drupal, WordPress, Joomla, MyBB, or Magento. There were, however, numerous framework developers running about.
  • Some Things Never Change. As I went around during social periods telling people “Hi, I’m Josh, I work on phpBB”, I got several responses:
    1. Oh, that software that gets hacked more often than ? (This is the “take another look” argument. I politely informed these people that phpBB3’s security record is greatly improved compared to phpBB2.)
    2. Its nice to see open-source projects represented at Tek.
    3. I spent hours trying to integrate that with WordPress and failed. What’s the deal with that?
    4. How’s the transistion from 2 to 3 going?
    5. How do you bear to work with that code?

I came away from these conversations with the opinion that phpBB is well known in the community, but not necessarily well-liked. A lot of this is because it can be difficult for these experienced developers to integrate with their products. Some wanted single-sign-on, others found that the layout was hard to customize to match an existing site, and still others wanted to add custom features but weren’t sure where to start.
I told people in person that we want to work on that, and we will, with some improvements slated for Ascraeus.

A large portion of the learning these conferences is not the talks, but the socialization that happens around them. A lot of the un-conference portion of the conference revolved around frameworks. It seems that everyone hates at least one of them, but many of them are looking forward to Symfony 2 and Zend Framework 2, both expected by the end of the year.

This was my first major PHP conference, and it was a good experience. With any luck, I’ll be there again in 2011.

Junior Validators

Posted by battye in Modifications with the tags , , , on January 10th, 2010

What is a Junior Validator?

Junior Validators assist the MOD Team with the validation of MODs. They help the MOD Team validators with pre-validation and testing.

Pre-validation involves running a check on MODs newly submitted to the MOD Database queue using the MOD Pre-Validation tool (MPV) and setting a status on the MOD accordingly.

Testing is the major role of a Junior Validator, and requires installing the MOD on a vanilla phpBB3 board through AutoMOD. After installing the MOD, all functions of the MOD and board should then be tested – all to make sure that the MOD and the board run error-free. The Junior Validator then makes any notes or suggestions to the MOD Team concerning the MOD and, again, the MOD status is set accordingly (“approve”, “deny”, “repack”, etc). In a nutshell, this is the role of a Junior Validator.

Why should I become a Junior Validator?

As a Junior Validator you will be gaining valuable first-hand experience with MOD Team processes which could lead to consideration for a position on the MOD Team. You will also have access to private forums including a Junior MOD Validators forum where you can discuss MOD validation with fellow Junior Validators and MOD Team members.

Most importantly, it will be fun! If you have a passion for writing MODs you will find working with the MOD Team to help validate MODs, and also the opportunity to give something back to the community, very rewarding. The phpBB Team is a very friendly group of people so the chance to work closely with the MOD Team will be very enjoyable.

What are the requirements?

To be considered for a position as a Junior Validator, it is important that you:

– have authored a MOD and submitted it to the MOD Database.
– can communicate in English.
– understand the phpBB3 codebase.
– have an understanding of MODX and MOD policies
– are familiar with the MOD Validation checklist

Where can I apply?

To apply, please fill out the form at the bottom of the Junior Validators page and your application will be reviewed by the MOD Team shortly thereafter. Successful applicants will be notified by private message on phpBB.com.

Junior Developers

Posted by naderman in Development with the tags , , , , , on June 17th, 2009

phpBB is continuing its process of opening up the development process. After an internal trial phase we have now opened up the Junior Developer Team to regular members of our community. An increasing amount of people involved in phpBB development should both speed up the development and improve quality.

Read the rest of this entry »

Guest Post: Supporting phpBB by JimA

Posted by wGEric in Support with the tags , , on April 6th, 2009

Because phpBB is a very large product, it needs to be supported. People who have a problem/question and they come here to find an answer or solution. Have you ever looked at the support forums? If so, you might have seen that there are many many topics a day and just a few people answering the topics, which is great of course.

Read the rest of this entry »

The phpBB Code Wiki – How you can help

Posted by Highway of Life in Development, Modifications, Styles with the tags , , on September 9th, 2008

If you have not yet read the phpBB Wiki Announcement or have not followed the discussion topic. I would encourage you to do so and take a look at the new development wiki:


http://wiki.phpbb.com

What is a Wiki and what can I do with it?

A Wiki is a type of website that allows the users and visitors to add, remove, and edit the available content. — Anyone who is interested in working with the phpBB Codebase, from website administrators who want to integrate phpBB into their site, or create a quick-script, to bridge or application developers to bridge phpBB with their application, to MOD Authors. The wiki is for those who want to learn more about the phpBB Codebase or simply have a question about how to do something or how something works within phpBB.

The wiki is also a great way to learn about how to begin programming in PHP/phpBB and developing a MOD.

Read the rest of this entry »