Jump to content

Module: ProcessWire Core Upgrade


ryan

Recommended Posts

  • 3 months later...

I upgraded PW to the latest dev using the upgrade module from Ryan (I normally upgrade by hand) and got the message that Upgrade files are already present. Please remove them before continuing. Clicking on Remove button didn't help, had to manually delete /site/assets/cache/ProcessWireUpgrade folder. I'm on windows, I think this is important. Anyone else?

  • Like 2
Link to comment
Share on other sites

3 hours ago, matjazp said:

I upgraded PW to the latest dev using the upgrade module from Ryan (I normally upgrade by hand) and got the message that Upgrade files are already present. Please remove them before continuing. Clicking on Remove button didn't help, had to manually delete /site/assets/cache/ProcessWireUpgrade folder. I'm on windows, I think this is important. Anyone else?

I encountered the same issue after upgrading to 3.0.118.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
On 11/2/2018 at 9:43 PM, matjazp said:

I upgraded PW to the latest dev using the upgrade module from Ryan (I normally upgrade by hand) and got the message that Upgrade files are already present. Please remove them before continuing. Clicking on Remove button didn't help, had to manually delete /site/assets/cache/ProcessWireUpgrade folder. I'm on windows, I think this is important. Anyone else?

Had the same issue, deleting the cache worked out for me.

  • Like 1
Link to comment
Share on other sites

1 hour ago, Gadgetto said:

Same problem here! 

Removing the content of the /site/assets/cache/ProcessWireUpgrade folder wasn't enough. Needed to remove this folder completely.

Forgot to say, problem happens on version 3.0.118. After removing this folder and running upgrade to 3.0.119 I couldn’t reproduce the issue.

  • Like 1
Link to comment
Share on other sites

The problem is in WireFileTools.php in rmdir() method in foreach loop. The $path coming into rmdir() contains ending slash, and $pathame (actual directory name) eventually contains two slashes , that makes allowPath() method to throw an WireException. The possible solution is simple: $path = rtrim($path, "/");

Link to comment
Share on other sites

1 hour ago, gingebaker said:

There is also an open issue for this problem on github with some possible fixes. 

https://github.com/processwire/processwire-issues/issues/704

I know, I opened it ? Ryan tried to fix this issue, but introduced another one. Try:

$files->mkdir($config->paths->cache . "test/test/", true);
$files->rmdir($config->paths->cache . "test/", true, array('throw' => true));

By default throw is false, I set it to true just for you/others to see the results. The point is: rmdir() fails to remove a directory that contains subdirectories due to a bug. 

Edit: ? 

 

Edited by matjazp
Link to comment
Share on other sites

  • 8 months later...

Hey,
 

I keep getting errors when I try to visit the upgrades admin page.
I thought it was a memory limit problem and increased the memory, but I still get the errors.
 

/processwire/setup/upgrades/	
Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) (Zeile 1266 in /var/www/htdocs/wire/core/WireHttp.php)

Any hints? Never had problems with the upgrade module.

Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...

Hey @ryan, hey all,

I've to update some websites in order to make them work with PHP 8.1. While doing so I've noticed, that ProcessWire is not on all sites in the listed updates. I'd expected to be on top of the list like this:

1802821283_2023-01-2718_01_33-UpgradesProcessWireheydebreck.comMozillaFirefox.thumb.png.647758c8dd690d32d5301a9e4c6c11dc.png

But on some websites ProcessWire doesn't appear and I see no logic behind ?

1465822462_2023-01-2718_03_45-UpgradesProcessWirekowalewski-rolladenbau.deMozillaFirefox.thumb.png.178931a3523eba787087038c2ea85638.png

Any hints or an explanation?

Cheers ?

 

Link to comment
Share on other sites

  • 1 month later...

@DV-JF 

I also had the same behavior that no core updates were displayed. This phenomenon was only with Processwire installations that were already somewhat older.

I then noticed that the ready.php in the site folder were different for these old installations. Replacing them with a new ready.php resulted in the coreupdates being displayed again. 

But be careful, if you already have a modified ready.php, you have to make these changes in the new file too.

 

Link to comment
Share on other sites

@Markus Thomas I am not sure this is the case as ready.php doesn't need to exist and it could be coincidence maybe? I think it is down to rate limiting for the Github API so sites that are on shared hosting may not display the results at one point, but they do the next, that was always my findings.

Link to comment
Share on other sites

  • 1 month later...

I am working on and thinking about automating quite some tasks in ProcessWire and just stumbled about the thought to take updates into my list of possible tasks.

Has anyone an idea if it's possible to hook LazyCron into/or hook directly into ProcessWireUpgrades to look for updates with this module (including updating the directory listings) and go from there, like sending an email with all existing updates/changes?

As far as I could tell the answer is probably: NO

Any ideas or thoughts?
First of all my main goal is receiving an email once in a while for each instance in which updates could be done/are available.
No automated updates (I am not an adrenalin enthusiast)!

 

Oh, and yes... please feel free to "steal" this idea for a module if you like or add a recipe for this. 

  • Like 3
Link to comment
Share on other sites

It wouldn’t be too difficult using ProcessWireUpgradeCheck::getModuleVersions. You can also have a look at ProcessWireUpgradeCheck::loginHook to see how it's used. Something like:

$wire->addHook("LazyCron::everyMonth", function(HookEvent $event) {
    $checker = $event->modules->get("ProcessWireUpgradeCheck");
    if(!$checker) return;

    $upgrades = $checker->getModulesVersions(true); // we only want modules with new versions
    if(!count($upgrades)) return;

    $subject = "There are " . count($upgrades) . " modules to update on $config->httpHost";

    $body = "Hi!\n\nAn upgrade is available for these modules on $config->httpHost:\n\n";

    foreach($upgrades as $name => $info) {
        $body .= "- $name ($info[remote])\n";
    }

    $body .= "\nHead to " . $event->pages->get("process=ProcessWireUpgrades")->url . " to upgrade"; // not sure if this `get` would work?

    $mail = new wireMail();
    $mail->from("upgrade@$config->httpHost")
        ->to("you@mail.com")
        ->subject($subject)
        ->body($body)
        ->send();
});

(non tested code written from my phone, so please forgive the formatting and/or mistakes ?)

Edited by monollonom
Formatted code :-)
  • Like 4
  • Thanks 1
  • Haha 1
Link to comment
Share on other sites

This is brilliant! Just minor tweaks. You already did 99,9% of the job.

Awesome! Thank you.

wire()->addHookAfter("LazyCron::every4Weeks", function(HookEvent $event) {
    $checker = $event->modules->get("ProcessWireUpgradeCheck");
    if(!$checker) return;

    $upgrades = $checker->getModuleVersions(true); // we only want modules with new versions
    if(!count($upgrades)) return;

    $subject = "There are " . count($upgrades) . " modules to update";
    
    $body = "Hi!\n\nAn upgrade is available for these modules on " . wire('config')->httpHost . ":\n\n";

    foreach($upgrades as $name => $info) {
        $body .= "- $name ($info[remote])\n";
    }

    $body .= "\nHead to " . $event->pages->get("process=ProcessWireUpgrade")->httpUrl . " to upgrade."; // not sure if this `get` would work?

    $mail = wireMail();
    $mail->from("wwwuser@example.com")
        ->to("admin@example.com")
        ->subject($subject)
        ->body($body)
        ->send();
});

Just added this to an existing site. Works perfectly fine.

 

Follow up

Added public recipe for all:
https://processwire.recipes/recipes/automate-module-upgrade-check/

Edited by wbmnfktr
Added follow up and recipe link
  • Like 4
  • Thanks 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
  • Recently Browsing   0 members

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