Jump to content

Upgrade and Update ProcessWire in PHP7.2 Host


DaveC
 Share

Recommended Posts

17 hours ago, kongondo said:

Not necessarily. You have at least two other options.

  • If it's not a lot of work and you really need this to be sorted, you can grant someone here from the forums (not just anyone!) temporary superuser access either to the remote site or send them the original DB dump of the site before you started working on it. If you have very sensitive data in the dump/site, then this becomes a bit tricky.
  • If you have a budget, pay someone from the forums (post in the Job's board) to sort this out for you.

Thank you very much for your help - and suggestions.

As it's not a big site I'm more or less starting from scratch using parts of the old 'site' folder at a time so that it is easy [!] to roll back changes.

I'm also using it as a brain activity - I've been meaning to learn about php & cms for a few years now, ever since people stopped wanting me to develop html sites!

So once again, thank you - and I'll probably be back!!

Latest: http://vivesport.co.uk/

  • Like 1
Link to comment
Share on other sites

4 minutes ago, DaveC said:

I've been meaning to learn about php & cms for a few years now

If you pick ProcessWire as the bases of your PHP CMS based sites, you get the best tool for "easy" introduction to this world for sure!

Link to comment
Share on other sites

11 minutes ago, DaveC said:

So once again, thank you - and I'll probably be back!!

No worries!

We can help you with the 'internal server error' bit if you could tells us or show us the script that was used to generate the footer menu. It is most likely being called from one of your /site/templates/something.php 

  • Like 1
Link to comment
Share on other sites

15 minutes ago, DaveC said:

The current host didn't upgrade without telling me.

Sorry, I should have read the thread more carefully. In my world if a live site broke like this it would be a pretty big deal and the imperative would be to get it functioning again as quickly as possible. But it sounds like there's no pressure in this case.

Link to comment
Share on other sites

41 minutes ago, kongondo said:

No worries!

We can help you with the 'internal server error' bit if you could tells us or show us the script that was used to generate the footer menu. It is most likely being called from one of your /site/templates/something.php 

Thanks.

I assume it will be _foot.php:


    </div><!--/#main-->

    <!-- footer -->
    <footer id='footer'>
        <p>
        Powered by <a href='https://processwire.com'>ProcessWire CMS</a>  &nbsp; / &nbsp;
        <?php
        if($user->isLoggedin()) {
            // if user is logged in, show a logout link
            echo "<a href='{$config->urls->admin}login/logout/'>Logout ($user->name)</a>";
        } else {
            // if user not logged in, show a login link
            echo "<a href='{$config->urls->admin}'>Admin Login</a>";
        }
        ?>
        </p>
    </footer>

</body>
</html>

 

 

Link to comment
Share on other sites

Not sure where to look. This is what Superuser sees:

Error: Exception: Field does not exist: footerlink (in /vhost/vhost21/v/i/v/vivesport.co.uk/www/wire/core/PageFinder.php line 1272)

#0 /vhost/vhost21/v/i/v/vivesport.co.uk/www/wire/core/Wire.php(386): ProcessWire\PageFinder->___getQuery(Object(ProcessWire\Selectors), Array)
#1 /vhost/vhost21/v/i/v/vivesport.co.uk/www/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod('___getQuery', Array)
#2 /vhost/vhost21/v/i/v/vivesport.co.uk/www/wire/core/Wire.php(450): ProcessWire\WireHooks->runHooks(Object(ProcessWire\PageFinder), 'getQuery', Array)
#3 /vhost/vhost21/v/i/v/vivesport.co.uk/www/wire/core/PageFinder.php(411): ProcessWire\Wire->__call('getQuery', Array)
#4 /vhost/vhost21/v/i/v/vivesport.co.uk/www/wire/core/Wire.php(386): ProcessWire\PageFinder->___find(Object(ProcessWire\Selectors), Array)
#5 /vhost/vhost21/v/i/v/vivesport.co.uk/www/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod('___find', Array)
#6 /vhost/vhost21/v/i/v/vivesport.co.uk/www/wire/core/Wire.php(450): ProcessWire\WireHooks->runHo


This error message was shown because: you are logged in as a Superuser. Error has been logged.

Link to comment
Share on other sites

29 minutes ago, DaveC said:

Not sure where to look. This is what Superuser sees:

Aha! That looks like it! As the error says, you are missing a field called footerlink.

  • From your original install, are you able to tell what type of field it was? 
  • You can also search your template files for code like $page->footerlink or $something->footerlink. That will at least tell us where it is being called from.
Link to comment
Share on other sites

Is this it [in footer.inc]?

<div class="row">
                    <div class="col-md-12">

                    <ul class="nav navbar-nav footer-nav">
                        <?php
                            // nav based on checkbox field
                            foreach($pages->find('footerlink=1') as $item) {
                                echo "<li><a href='$item->url'>$item->title</a></li> ";
                            }
                            if($user->isLoggedin()) {
                                // if user is logged in, show a logout link
                                echo "<li><a href='{$config->urls->admin}login/logout/'>Logout ($user->name)</a></li>";
                            } else {
                                // if user not logged in, show a login link
                                echo "<li><a href='{$config->urls->admin}'>Admin Login</a></li>";
                            }

                        ?>
                    </ul>

                        <div class="footer-copyright">&copy; 2020 ViveSport</div>
                    </div>
                </div>

Edited by DaveC
Pasted this before reading your last comment. Sorry.
Link to comment
Share on other sites

3 hours ago, DaveC said:

Is this it [in footer.inc]?

Bingo! 

From the looks of it, this was the setup:

  • There was a field of type Checkbox with the name footerlink.
  • This was assigned to a template (or even templates).
  • When editing a page with that template, if you wanted that page to appear in the footer menu/nav as a link, you had to tick the checkbox.
  • ProcessWire stores a ticked checkbox as 1 in the database.
  • The code in footer.inc would look for all pages that had their checkboxes ticked (this is the $pages->find("footerlink=1").
  • It would then output them in the footer menu/nav.

Since you have no footerlink field, ProcessWire throws the error. For non-superusers, we are not shown the real error, so we get a generic 500 error.

Quick remedy

  1. Create a field of type Checkbox and name it footerlink.
  2. Add it to the template(s) whose pages you'd like to appear in the footer menu/nav (@note: editors should be instructed not to tick too many pages' checkboxes, otherwise it could break the design, but this is up to you. You might even want (as the developer) to take control of this).
  3. Change the code in footer.inc as below:
<div class="row">
    <div class="col-md-12">
        <ul class="nav navbar-nav footer-nav">
            <?php
            // nav based on checkbox field
            $footerNavItems = $pages->find('footerlink=1');
            if($footerNavItems->count) {
                foreach($footerNavItems as $item) {
                    echo "<li><a href='$item->url'>$item->title</a></li> ";
                }
            }

            if($user->isLoggedin()) {
                // if user is logged in, show a logout link
                echo "<li><a href='{$config->urls->admin}login/logout/'>Logout ($user->name)</a></li>";
            } else {
                // if user not logged in, show a login link
                echo "<li><a href='{$config->urls->admin}'>Admin Login</a></li>";
            }
            ?>
        </ul>
    <div class="footer-copyright">&copy; 2020 ViveSport</div>
    </div>
</div>

Some things to Note

  • Some people don't like exposing the link to the admin of their ProcessWire sites in cases where they have changed the name of the admin login from the default one (ie. processwire). If that's the case, remove the logged in user code.
  • I know you were debugging and it has helped us, but live sites should not have their config->debug set to true. An easier way would have been to debug whilst logged in as superuser. A better way is to install the module TracyDebugger. 

Hope this helps.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...